Skip to content

iox::roudi::PosixShmMemoryProvider🔗

Creates the shared memory based on a provided configuration.

#include <posix_shm_memory_provider.hpp>

Inherits from iox::roudi::MemoryProvider

Public Functions🔗

Name
PosixShmMemoryProvider(const ShmName_t & shmName, const posix::AccessMode accessMode, const posix::OwnerShip ownership)
Constructs a PosixShmMemoryProvider which can be used to request memory via MemoryBlocks.
~PosixShmMemoryProvider()
PosixShmMemoryProvider(PosixShmMemoryProvider && )
PosixShmMemoryProvider & operator=(PosixShmMemoryProvider && )
PosixShmMemoryProvider(const PosixShmMemoryProvider & )
PosixShmMemoryProvider & operator=(const PosixShmMemoryProvider & )

Protected Functions🔗

Name
virtual cxx::expected< void *, MemoryProviderError > createMemory(const uint64_t size, const uint64_t alignment)
Implementation of MemoryProvider::createMemory.
virtual cxx::expected< MemoryProviderError > destroyMemory()
Implementation of MemoryProvider::destroyMemory.

Additional inherited members🔗

Public Functions inherited from iox::roudi::MemoryProvider

Name
MemoryProvider() =default
~MemoryProvider()
MemoryProvider(const MemoryProvider & )
MemoryProvider(MemoryProvider && )
cxx::expected< MemoryProviderError > addMemoryBlock(cxx::not_null< MemoryBlock * > memoryBlock)
This function add a MemoryBlock to the list of memory requester.
cxx::expected< MemoryProviderError > create()
With this call the memory requested by the MemoryBlocks need to be created. The function should be called from a MemoryManager which handles one or more MemoryProvider.
void announceMemoryAvailable()
This function announces the availability of the memory to the MemoryBlocks. The function should be called from a MemoryManager which handles one or more MemoryProvider.
cxx::expected< MemoryProviderError > destroy()
This function destroys the previously allocated memory. Before the destruction, all MemoryBlocks are requested to handle this appropriately, e.g. call the destructor of the underlying type. The function should be called from a MemoryManager which handles one or more MemoryProvider.
cxx::optional< void * > baseAddress() const
This function provides the base address of the created memory.
uint64_t size() const
This function provides the size of the created memory.
cxx::optional< uint64_t > segmentId() const
This function provides the segment id of the relocatable memory segment which is owned by the MemoryProvider.
bool isAvailable() const
This function can be used to check if the requested memory is already available.
bool isAvailableAnnounced() const
This function can be used to check if the availability of the memory was announced to the MemoryBlocks.

Protected Functions inherited from iox::roudi::MemoryProvider

Name
const char * getErrorString(const MemoryProviderError error)

Friends inherited from iox::roudi::MemoryProvider

Name
class RouDiMemoryManager

Public Functions Documentation🔗

function PosixShmMemoryProvider🔗

PosixShmMemoryProvider(
    const ShmName_t & shmName,
    const posix::AccessMode accessMode,
    const posix::OwnerShip ownership
)

Constructs a PosixShmMemoryProvider which can be used to request memory via MemoryBlocks.

Parameters:

  • shmName is the name of the posix share memory
  • accessMode defines the read and write access to the memory
  • ownership defines the ownership of the shared memory. "mine" controls the lifetime of the memory and "openExisting" will just use an already existing shared memory

function ~PosixShmMemoryProvider🔗

~PosixShmMemoryProvider()

function PosixShmMemoryProvider🔗

PosixShmMemoryProvider(
    PosixShmMemoryProvider && 
)

function operator=🔗

PosixShmMemoryProvider & operator=(
    PosixShmMemoryProvider && 
)

function PosixShmMemoryProvider🔗

PosixShmMemoryProvider(
    const PosixShmMemoryProvider & 
)

function operator=🔗

PosixShmMemoryProvider & operator=(
    const PosixShmMemoryProvider & 
)

Protected Functions Documentation🔗

function createMemory🔗

virtual cxx::expected< void *, MemoryProviderError > createMemory(
    const uint64_t size,
    const uint64_t alignment
)

Implementation of MemoryProvider::createMemory.

Parameters:

  • size is the size in bytes for the requested memory, the size should already be calculated according to the alignment requirements
  • alignment the required alignment for the memory

Return: the pointer of the begin of the created memory, nullptr if the memory could not be created

Reimplements: iox::roudi::MemoryProvider::createMemory

function destroyMemory🔗

virtual cxx::expected< MemoryProviderError > destroyMemory()

Implementation of MemoryProvider::destroyMemory.

Return: a MemoryProviderError if the destruction failed, otherwise success

Reimplements: iox::roudi::MemoryProvider::destroyMemory


Updated on 26 April 2021 at 15:31:02 CEST