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

Memory pool attributes. More...

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

+ Inheritance diagram for os::rtos::memory_pool::attributes:

Public Member Functions

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

Public Attributes

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

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.

If the attributes are modified after the memory_pool creation, the memory_pool attributes shall not be affected.

Example

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];
void
func(void)
{
// Do something
// Define pool attributes.
memory_pool::attributes attr { "properties" };
attr.mp_pool_size_bytes = sizeof(pool);
// Construct the pool object instance.
memory_pool mp { attr, pool_size, sizeof(properties_t) };
// Do something else.
}
Memory pool attributes.
Definition os-mempool.h:99
void * mp_pool_address
Address of the user defined storage for the memory pool.
Definition os-mempool.h:144
Synchronised memory pool, using the default RTOS allocator.
Definition os-mempool.h:68
void * pool(void)
Get the pool storage address.
Definition os-mempool.h:967
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 98 of file os-mempool.h.

Constructor & Destructor Documentation

◆ attributes() [1/3]

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

Construct a memory pool attributes object instance.

Parameters
None.

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

◆ attributes() [2/3]

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

◆ attributes() [3/3]

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

◆ ~attributes()

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

Destruct the memory pool attributes object instance.

Member Function Documentation

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Member Data Documentation

◆ clock

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

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 144 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 149 of file os-mempool.h.


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