iceoryx_doc  1.0.1
Public Member Functions | Protected Member Functions | List of all members
iox::roudi::PosixShmMemoryProvider Class Reference

Creates the shared memory based on a provided configuration. More...

#include <posix_shm_memory_provider.hpp>

Inheritance diagram for iox::roudi::PosixShmMemoryProvider:
Inheritance graph
[legend]
Collaboration diagram for iox::roudi::PosixShmMemoryProvider:
Collaboration graph
[legend]

Public Member Functions

 PosixShmMemoryProvider (const ShmName_t &shmName, const posix::AccessMode accessMode, const posix::OwnerShip ownership) noexcept
 Constructs a PosixShmMemoryProvider which can be used to request memory via MemoryBlocks. More...
 
 PosixShmMemoryProvider (PosixShmMemoryProvider &&)=delete
 
PosixShmMemoryProvideroperator= (PosixShmMemoryProvider &&)=delete
 
 PosixShmMemoryProvider (const PosixShmMemoryProvider &)=delete
 
PosixShmMemoryProvideroperator= (const PosixShmMemoryProvider &)=delete
 
- Public Member Functions inherited from iox::roudi::MemoryProvider
 MemoryProvider (const MemoryProvider &)=delete
 
 MemoryProvider (MemoryProvider &&)=delete
 
MemoryProvideroperator= (const MemoryProvider &)=delete
 
MemoryProvideroperator= (MemoryProvider &&)=delete
 
cxx::expected< MemoryProviderErroraddMemoryBlock (cxx::not_null< MemoryBlock * > memoryBlock) noexcept
 This function add a MemoryBlock to the list of memory requester. More...
 
cxx::expected< MemoryProviderErrorcreate () noexcept
 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. More...
 
void announceMemoryAvailable () noexcept
 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< MemoryProviderErrordestroy () noexcept
 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. More...
 
cxx::optional< void * > baseAddress () const noexcept
 This function provides the base address of the created memory. More...
 
uint64_t size () const noexcept
 This function provides the size of the created memory. More...
 
cxx::optional< uint64_t > segmentId () const noexcept
 This function provides the segment id of the relocatable memory segment which is owned by the MemoryProvider. More...
 
bool isAvailable () const noexcept
 This function can be used to check if the requested memory is already available. More...
 
bool isAvailableAnnounced () const noexcept
 This function can be used to check if the availability of the memory was announced to the MemoryBlocks. More...
 

Protected Member Functions

cxx::expected< void *, MemoryProviderErrorcreateMemory (const uint64_t size, const uint64_t alignment) noexcept
 Implementation of MemoryProvider::createMemory. More...
 
cxx::expected< MemoryProviderErrordestroyMemory () noexcept
 Implementation of MemoryProvider::destroyMemory. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from iox::roudi::MemoryProvider
static const char * getErrorString (const MemoryProviderError error)
 

Detailed Description

Creates the shared memory based on a provided configuration.

Constructor & Destructor Documentation

◆ PosixShmMemoryProvider()

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

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

Parameters
[in]shmNameis the name of the posix share memory
[in]accessModedefines the read and write access to the memory
[in]ownershipdefines the ownership of the shared memory. "mine" controls the lifetime of the memory and "openExisting" will just use an already existing shared memory

Member Function Documentation

◆ createMemory()

cxx::expected<void*, MemoryProviderError> iox::roudi::PosixShmMemoryProvider::createMemory ( const uint64_t  size,
const uint64_t  alignment 
)
protectedvirtualnoexcept

Implementation of MemoryProvider::createMemory.

Parameters
[in]sizeis the size in bytes for the requested memory, the size should already be calculated according to the alignment requirements
[in]alignmentthe required alignment for the memory
Returns
the pointer of the begin of the created memory, nullptr if the memory could not be created

Implements iox::roudi::MemoryProvider.

◆ destroyMemory()

cxx::expected<MemoryProviderError> iox::roudi::PosixShmMemoryProvider::destroyMemory ( )
protectedvirtualnoexcept

Implementation of MemoryProvider::destroyMemory.

Returns
a MemoryProviderError if the destruction failed, otherwise success

Implements iox::roudi::MemoryProvider.


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