µOS++ IIIe Reference  v6.3.15
“Perfekt ist nicht gut genug”
The third edition of µOS++, a POSIX inspired open source system, written in C++.
os::rtos::memory Namespace Reference

Classes

class  allocator_deleter
 Allocator deleter. More...
 
class  allocator_stateless_default_resource
 Standard allocator based on the RTOS system default memory manager. More...
 
class  allocator_stateless_polymorphic_synchronized
 Allocator using memory resources. More...
 
class  memory_resource
 Memory resource manager (abstract class). More...
 

Types

template<typename T >
using allocator = allocator_stateless_default_resource< T >
 Type of allocator used by the system objects. Must be stateless. More...
 
template<typename T , typename U = T>
using allocator_typed = allocator_stateless_polymorphic_synchronized< T, scheduler::lockable, get_resource_typed< U > >
 Type of an allocator for objects of type T. More...
 
using out_of_memory_handler_t = void(*)(void)
 Type of out of memory handler. More...
 
template<typename T , typename U = T>
using unique_ptr = std::unique_ptr< T, allocator_deleter< allocator_typed< T, U > >>
 Type of a RTOS unique pointer to objects of type T. More...
 

Functions

constexpr std::size_t align_size (std::size_t size, std::size_t align) noexcept
 Helper function to align size values. More...
 
template<typename T , typename A , typename ... Args>
auto allocate_unique (const A &allocator, Args &&... args)
 Function template to allocate a unique pointer. More...
 
constexpr std::size_t max (std::size_t a, std::size_t b)
 
template<typename T1 , typename T2 , typename L , F get_resource>
bool operator!= (const allocator_stateless_polymorphic_synchronized< T1, L, get_resource > &lhs, const allocator_stateless_polymorphic_synchronized< T2, L, get_resource > &rhs) noexcept
 
template<typename T , typename U , typename L , F get_resource>
bool operator!= (allocator_stateless_polymorphic_synchronized< T, L, get_resource > const &lhs, allocator_stateless_polymorphic_synchronized< U, L, get_resource > const &rhs) noexcept
 
template<typename T1 , typename T2 , typename L , F get_resource>
bool operator== (const allocator_stateless_polymorphic_synchronized< T1, L, get_resource > &lhs, const allocator_stateless_polymorphic_synchronized< T2, L, get_resource > &rhs) noexcept
 
template<typename T , typename U , typename L , F get_resource>
bool operator== (allocator_stateless_polymorphic_synchronized< T, L, get_resource > const &lhs, allocator_stateless_polymorphic_synchronized< U, L, get_resource > const &rhs) noexcept
 
RTOS System Memory Functions
memory_resourcemalloc_resource (void) noexcept
 Get the address of a memory manager based on POSIX malloc(). More...
 
memory_resourceset_default_resource (memory_resource *res) noexcept
 Set the default RTOS system memory manager. More...
 
memory_resourceget_default_resource (void) noexcept
 Get the default RTOS system memory manager. More...
 
void init_once_default_resource (void)
 
Operators
bool operator== (const memory_resource &lhs, const memory_resource &rhs) noexcept
 Compare the memory_resource instances for equality. More...
 
bool operator!= (const memory_resource &lhs, const memory_resource &rhs) noexcept
 Compare the memory_resource instances for inequality. More...
 
Type Specific Resource Managers
template<typename T >
memory_resourceset_resource_typed (memory_resource *res) noexcept
 Function template to set a memory resource. More...
 
template<typename T >
memory_resourceget_resource_typed (void) noexcept
 Function template to get a memory resource. More...
 
template<>
memory_resourceset_resource_typed< thread > (memory_resource *res) noexcept
 
template<>
memory_resourceget_resource_typed< thread > (void) noexcept
 
template<>
memory_resourceset_resource_typed< condition_variable > (memory_resource *res) noexcept
 
template<>
memory_resourceget_resource_typed< condition_variable > (void) noexcept
 
template<>
memory_resourceset_resource_typed< event_flags > (memory_resource *res) noexcept
 
template<>
memory_resourceget_resource_typed< event_flags > (void) noexcept
 
template<>
memory_resourceset_resource_typed< memory_pool > (memory_resource *res) noexcept
 
template<>
memory_resourceget_resource_typed< memory_pool > (void) noexcept
 
template<>
memory_resourceset_resource_typed< message_queue > (memory_resource *res) noexcept
 
template<>
memory_resourceget_resource_typed< message_queue > (void) noexcept
 
template<>
memory_resourceset_resource_typed< mutex > (memory_resource *res) noexcept
 
template<>
memory_resourceget_resource_typed< mutex > (void) noexcept
 
template<>
memory_resourceset_resource_typed< semaphore > (memory_resource *res) noexcept
 
template<>
memory_resourceget_resource_typed< semaphore > (void) noexcept
 
template<>
memory_resourceset_resource_typed< timer > (memory_resource *res) noexcept
 
template<>
memory_resourceget_resource_typed< timer > (void) noexcept
 

Function Documentation

◆ align_size()

constexpr std::size_t os::rtos::memory::align_size ( std::size_t  size,
std::size_t  align 
)
noexcept

Helper function to align size values.

Parameters
sizeUnaligned size.
alignAlignment requirement (power of 2).
Returns
Aligned size.

Definition at line 86 of file os-memory.h.

◆ max()

constexpr std::size_t os::rtos::memory::max ( std::size_t  a,
std::size_t  b 
)

Definition at line 74 of file os-memory.h.

◆ operator!=()

template<typename T , typename U , typename L , F get_resource>
bool os::rtos::memory::operator!= ( allocator_stateless_polymorphic_synchronized< T, L, get_resource > const &  lhs,
allocator_stateless_polymorphic_synchronized< U, L, get_resource > const &  rhs 
)
inlinenoexcept

Definition at line 1529 of file os-memory.h.

◆ operator==()

template<typename T , typename U , typename L , F get_resource>
bool os::rtos::memory::operator== ( allocator_stateless_polymorphic_synchronized< T, L, get_resource > const &  lhs,
allocator_stateless_polymorphic_synchronized< U, L, get_resource > const &  rhs 
)
inlinenoexcept

Definition at line 1520 of file os-memory.h.