µ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::allocator_stateless_default_resource< T > Class Template Reference

Standard allocator based on the RTOS system default memory manager. More...

#include <cmsis-plus/rtos/os.h>

Public Types

using value_type = T
 Type of elements to be allocated.
 

Public Member Functions

Constructors & Destructor
 allocator_stateless_default_resource () noexcept=default
 Default constructor. Construct a default resource allocator object instance.
 
 allocator_stateless_default_resource (allocator_stateless_default_resource const &other)=default
 Copy constructor.
 
template<typename U >
 allocator_stateless_default_resource (allocator_stateless_default_resource< U > const &other) noexcept
 Copy constructor template.
 
 allocator_stateless_default_resource (allocator_stateless_default_resource &&other)=default
 Move constructor.
 
 ~allocator_stateless_default_resource ()=default
 Destruct the default resource allocator object instance.
 
Operators
allocator_stateless_default_resourceoperator= (allocator_stateless_default_resource const &other)=default
 Copy assignment operator.
 
allocator_stateless_default_resourceoperator= (allocator_stateless_default_resource &&other)=default
 Move assignment operator.
 
Public Member Functions
value_typeallocate (std::size_t elements)
 Allocate a number of memory blocks of type value_type.
 
void deallocate (value_type *addr, std::size_t elements) noexcept
 Deallocate the number of memory blocks of type value_type.
 
std::size_t max_size (void) const noexcept
 The maximum number of elements that can be passed to allocate().
 

Detailed Description

template<typename T>
class os::rtos::memory::allocator_stateless_default_resource< T >

Standard allocator based on the RTOS system default memory manager.

Template Parameters
TType of elements to be allocated.

This class template is used as the default allocator for system classes. It gets memory from the system default memory manager os::rtos::memory::get_default_resource().

Note
As default allocator, this class must be stateless, i.e. have no member variables.

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

Member Typedef Documentation

◆ value_type

template<typename T >
using os::rtos::memory::allocator_stateless_default_resource< T >::value_type = T

Type of elements to be allocated.

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

Constructor & Destructor Documentation

◆ allocator_stateless_default_resource() [1/4]

template<typename T >
os::rtos::memory::allocator_stateless_default_resource< T >::allocator_stateless_default_resource ( )
defaultnoexcept

Default constructor. Construct a default resource allocator object instance.

◆ allocator_stateless_default_resource() [2/4]

template<typename T >
os::rtos::memory::allocator_stateless_default_resource< T >::allocator_stateless_default_resource ( allocator_stateless_default_resource< T > const &  other)
default

Copy constructor.

Parameters
otherReference to existing allocator.

◆ allocator_stateless_default_resource() [3/4]

template<typename T >
template<typename U >
os::rtos::memory::allocator_stateless_default_resource< T >::allocator_stateless_default_resource ( allocator_stateless_default_resource< U > const &  other)
noexcept

Copy constructor template.

Parameters
otherReference to allocator.

◆ allocator_stateless_default_resource() [4/4]

template<typename T >
os::rtos::memory::allocator_stateless_default_resource< T >::allocator_stateless_default_resource ( allocator_stateless_default_resource< T > &&  other)
default

Move constructor.

Parameters
otherReference to existing allocator.

◆ ~allocator_stateless_default_resource()

Destruct the default resource allocator object instance.

Member Function Documentation

◆ allocate()

template<typename T >
value_type * os::rtos::memory::allocator_stateless_default_resource< T >::allocate ( std::size_t  elements)

Allocate a number of memory blocks of type value_type.

Parameters
elementsNumber of elements of type value_type.
Returns
Pointer to newly allocated memory blocks.

◆ deallocate()

template<typename T >
void os::rtos::memory::allocator_stateless_default_resource< T >::deallocate ( value_type addr,
std::size_t  elements 
)
noexcept

Deallocate the number of memory blocks of type value_type.

Parameters
addrPointer to previously allocated memory blocks.
elementsNumber of elements of type value_type.
Returns
Nothing.

◆ max_size()

template<typename T >
std::size_t os::rtos::memory::allocator_stateless_default_resource< T >::max_size ( void  ) const
noexcept

The maximum number of elements that can be passed to allocate().

Returns
Number of elements of type value_type.

◆ operator=() [1/2]

Move assignment operator.

Parameters
otherReference to existing allocator.
Returns
Reference to allocator.

◆ operator=() [2/2]

Copy assignment operator.

Parameters
otherReference to existing allocator.
Returns
Reference to allocator.

The documentation for this class was generated from the following files: