The MemoryBlock is a container for general purpose memory. It is used to request some memory from a MemoryProvider, which can be POSIX SHM, the stack or something completely different. To be able to use the container, some functions need to be implemented. For most use cases the GenericMemoryBlock can be used, which is a templated class and implements the most common case.
More...
#include <iceoryx_posh/roudi/memory/memory_block.hpp>
|
| MemoryBlock (const MemoryBlock &)=delete |
|
| MemoryBlock (MemoryBlock &&)=delete |
|
MemoryBlock & | operator= (const MemoryBlock &)=delete |
|
MemoryBlock & | operator= (MemoryBlock &&)=delete |
|
virtual uint64_t | size () const noexcept=0 |
| This function provides the size of the required memory for the underlying data. It is needed for the MemoryProvider to calculate the total size of memory.
|
|
virtual uint64_t | alignment () const noexcept=0 |
| This function provides the alignment of the memory for the underlying data. This information is needed for the MemoryProvider.
|
|
cxx::optional< void * > | memory () const noexcept |
| This function provides the pointer to the requested memory.
|
|
The MemoryBlock is a container for general purpose memory. It is used to request some memory from a MemoryProvider, which can be POSIX SHM, the stack or something completely different. To be able to use the container, some functions need to be implemented. For most use cases the GenericMemoryBlock can be used, which is a templated class and implements the most common case.
◆ MemoryBlock()
iox::roudi::MemoryBlock::MemoryBlock |
( |
const MemoryBlock & |
| ) |
|
|
delete |
- Note
- this is intentional not movable/copyable, since a pointer to the memory block is registered at a MemoryProvider and therefore an instance of a MemoryBlock must be pinned to memory
◆ alignment()
virtual uint64_t iox::roudi::MemoryBlock::alignment |
( |
| ) |
const |
|
pure virtualnoexcept |
◆ destroy()
virtual void iox::roudi::MemoryBlock::destroy |
( |
| ) |
|
|
protectedpure virtualnoexcept |
◆ memory()
cxx::optional< void * > iox::roudi::MemoryBlock::memory |
( |
| ) |
const |
|
noexcept |
This function provides the pointer to the requested memory.
- Returns
- an optional pointer to a memory block with the requested size and alignment if the memory is available, otherwise a cxx::nullopt_t
◆ onMemoryAvailable()
virtual void iox::roudi::MemoryBlock::onMemoryAvailable |
( |
cxx::not_null< void * > |
memory | ) |
|
|
protectedvirtualnoexcept |
This function is called once the memory is available and is therefore the earliest possibility to use the memory.
- Parameters
-
[in] | memory | pointer to a valid memory block, the same one that the memory() member function would return |
◆ size()
virtual uint64_t iox::roudi::MemoryBlock::size |
( |
| ) |
const |
|
pure virtualnoexcept |
This function provides the size of the required memory for the underlying data. It is needed for the MemoryProvider to calculate the total size of memory.
- Returns
- the required memory as multiple of the alignment
Implemented in iox::roudi::GenericMemoryBlock< T >.
The documentation for this class was generated from the following file: