Skip to content

iox::roudi::GenericMemoryBlock🔗

The GenericMemoryBlock is an implementation of a MemoryBlock for a common use case. More...

#include <iceoryx_posh/roudi/memory/generic_memory_block.hpp>

Inherits from iox::roudi::MemoryBlock

Public Functions🔗

Name
GenericMemoryBlock() =default
~GenericMemoryBlock()
GenericMemoryBlock(const GenericMemoryBlock & )
GenericMemoryBlock(GenericMemoryBlock && )
GenericMemoryBlock & operator=(const GenericMemoryBlock & )
GenericMemoryBlock & operator=(GenericMemoryBlock && )
virtual uint64_t size() const override
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 override
This function provides the alignment of the memory for the underlying data. This information is needed for the MemoryProvider.
template <typename... Targs>
cxx::optional< T * >
emplace(Targs &&... args)
A new element is constructed by forwarding the arguments to the constructor of T. If the MemoryBlock has a value then the destructor of T is called.
cxx::optional< T * > value() const
This function enables the access to the underlying type.

Protected Functions🔗

Name
virtual void destroy() override
The MemoryProvider calls this either when MemoryProvider::destroy is called or in its destructor.

Friends🔗

Name
class MemoryProvider

Additional inherited members🔗

Public Functions inherited from iox::roudi::MemoryBlock

Name
MemoryBlock() =default
virtual ~MemoryBlock() =default
MemoryBlock(const MemoryBlock & )
MemoryBlock(MemoryBlock && )
cxx::optional< void * > memory() const
This function provides the pointer to the requested memory.

Protected Functions inherited from iox::roudi::MemoryBlock

Name
virtual void onMemoryAvailable(cxx::not_null< void * > memory)
This function is called once the memory is available and is therefore the earliest possibility to use the memory.

Detailed Description🔗

template <typename T >
class iox::roudi::GenericMemoryBlock;

The GenericMemoryBlock is an implementation of a MemoryBlock for a common use case.

Public Functions Documentation🔗

function GenericMemoryBlock🔗

GenericMemoryBlock() =default

function ~GenericMemoryBlock🔗

~GenericMemoryBlock()

function GenericMemoryBlock🔗

GenericMemoryBlock(
    const GenericMemoryBlock & 
)

function GenericMemoryBlock🔗

GenericMemoryBlock(
    GenericMemoryBlock && 
)

function operator=🔗

GenericMemoryBlock & operator=(
    const GenericMemoryBlock & 
)

function operator=🔗

GenericMemoryBlock & operator=(
    GenericMemoryBlock && 
)

function size🔗

virtual uint64_t size() const override

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.

Return: the required memory as multiple of the alignment

Note: The size of the underlying type T

Reimplements: iox::roudi::MemoryBlock::size

function alignment🔗

virtual uint64_t alignment() const override

This function provides the alignment of the memory for the underlying data. This information is needed for the MemoryProvider.

Return: the alignment of the underlying data.

Note: The alignment of the underlying type T

Reimplements: iox::roudi::MemoryBlock::alignment

function emplace🔗

template <typename... Targs>
cxx::optional< T * > emplace(
    Targs &&... args
)

A new element is constructed by forwarding the arguments to the constructor of T. If the MemoryBlock has a value then the destructor of T is called.

Parameters:

  • args are perfectly forwarded to the constructor of T to perform a placement new

Return: an optional pointer to the underlying type, cxx::nullopt_t if memory was not yet available

function value🔗

cxx::optional< T * > value() const

This function enables the access to the underlying type.

Return: an optional pointer to the underlying type, cxx::nullopt_t if value is not initialized

Protected Functions Documentation🔗

function destroy🔗

virtual void destroy() override

The MemoryProvider calls this either when MemoryProvider::destroy is called or in its destructor.

Note:

  • This function can be called multiple times. Make sure that the implementation can handle this.
  • This will destroy the underlying type T

Reimplements: iox::roudi::MemoryBlock::destroy

Friends🔗

friend MemoryProvider🔗

friend class MemoryProvider;

Updated on 18 December 2023 at 13:02:35 CET