µ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_pool::attributes Class Reference

Memory pool attributes. More...

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

Inherits os::rtos::internal::attributes_clocked.

Public Member Functions

Constructors & Destructor
constexpr attributes ()
 Construct a memory pool attributes object instance. More...
 attributes (const attributes &)=default
 attributes (attributes &&)=default
attributesoperator= (const attributes &)=default
attributesoperator= (attributes &&)=default
 ~attributes ()=default
 Destruct the memory pool attributes object instance. More...

Public Attributes

Public Member Variables
void * mp_pool_address = nullptr
 Address of the user defined storage for the memory pool. More...
std::size_t mp_pool_size_bytes = 0
 Size of the user defined storage for the memory pool. More...
Public Member Variables
rtos::clockclock = nullptr
 Attribute with the address of the clock to be used for timeouts. More...

Detailed Description

Memory pool attributes.

Allow to assign a name and custom attributes (like a static address) to the memory pool.

To simplify access, the member variables are public and do not require accessors or mutators.


Define an array of structures and pass its address and size via the attributes.

// Define the type of one pool block.
typedef struct {
uint32_t length;
uint32_t width;
uint32_t height;
uint32_t weight;
} properties_t;
// Define the pool size.
constexpr uint32_t pool_size = 10;
// Allocate static storage for the pool.
properties_t pool[pool_size];
// Do something
// Define pool attributes.
memory_pool::attributes attr { "properties" };
attr.mp_pool_address = pool;
attr.mp_pool_size_bytes = sizeof(pool);
// Construct the pool object instance.
memory_pool mp { attr, pool_size, sizeof(properties_t) };
// Do something else.
POSIX compatibility
No POSIX similar functionality identified, but inspired by POSIX attributes used in <pthread.h> (IEEE Std 1003.1, 2013 Edition).

Definition at line 89 of file os-mempool.h.

Constructor & Destructor Documentation

◆ attributes() [1/3]

constexpr os::rtos::memory_pool::attributes::attributes ( )

Construct a memory pool attributes object instance.


Definition at line 885 of file os-mempool.h.

◆ attributes() [2/3]

os::rtos::memory_pool::attributes::attributes ( const attributes )

◆ attributes() [3/3]

os::rtos::memory_pool::attributes::attributes ( attributes &&  )

◆ ~attributes()

os::rtos::memory_pool::attributes::~attributes ( )

Destruct the memory pool attributes object instance.

Member Function Documentation

◆ operator=() [1/2]

attributes& os::rtos::memory_pool::attributes::operator= ( const attributes )

◆ operator=() [2/2]

attributes& os::rtos::memory_pool::attributes::operator= ( attributes &&  )

Member Data Documentation

◆ clock

rtos::clock* os::rtos::internal::attributes_clocked::clock = nullptr

Attribute with the address of the clock to be used for timeouts.

It may be one of os::rtos::sysclock, os::rtos::rtclock, or any other user object derived from class os::rtos::clock.

If nullptr, the default clock is os::rtos::sysclock.

Definition at line 615 of file os-decls.h.

◆ mp_pool_address

void * os::rtos::memory_pool::attributes::mp_pool_address = nullptr

Address of the user defined storage for the memory pool.

Set this variable to a user defined memory area large enough to store the memory pool. Usually this is a statically allocated array of structures.

The default value is nullptr, which means there is no user defined memory pool.

Definition at line 135 of file os-mempool.h.

◆ mp_pool_size_bytes

memory_pool::size_t os::rtos::memory_pool::attributes::mp_pool_size_bytes = 0

Size of the user defined storage for the memory pool.

The memory pool size must match exactly the allocated size. It is used for validation; when the memory pool is initialised, this size must be large enough to accommodate the desired memory pool.

If the mp_pool_address is nullptr, this variable is not checked, but it is recommended to leave it zero.

Definition at line 140 of file os-mempool.h.

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