µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
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...
 

Typedefs

template<typename T >
using allocator = allocator_stateless_default_resource< T >
 Type of allocator used by the system objects. Must be stateless.
 
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.
 
using out_of_memory_handler_t = void(*)(void)
 Type of out of memory handler.
 
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.
 

Functions

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

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 
)
constexpr

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