iceoryx_posh
2.0.2
|
Creates the shared memory based on a provided configuration. More...
#include <iceoryx_posh/roudi/memory/posix_shm_memory_provider.hpp>
Public Member Functions | |
PosixShmMemoryProvider (const ShmName_t &shmName, const posix::AccessMode accessMode, const posix::OpenMode openMode) noexcept | |
Constructs a PosixShmMemoryProvider which can be used to request memory via MemoryBlocks. More... | |
PosixShmMemoryProvider (PosixShmMemoryProvider &&)=delete | |
PosixShmMemoryProvider & | operator= (PosixShmMemoryProvider &&)=delete |
PosixShmMemoryProvider (const PosixShmMemoryProvider &)=delete | |
PosixShmMemoryProvider & | operator= (const PosixShmMemoryProvider &)=delete |
![]() | |
MemoryProvider (const MemoryProvider &)=delete | |
MemoryProvider (MemoryProvider &&)=delete | |
MemoryProvider & | operator= (const MemoryProvider &)=delete |
MemoryProvider & | operator= (MemoryProvider &&)=delete |
cxx::expected< MemoryProviderError > | addMemoryBlock (cxx::not_null< MemoryBlock * > memoryBlock) noexcept |
This function add a MemoryBlock to the list of memory requester. More... | |
cxx::expected< MemoryProviderError > | create () 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< MemoryProviderError > | destroy () 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 *, MemoryProviderError > | createMemory (const uint64_t size, const uint64_t alignment) noexcept |
This function needs to be implemented to provide the actual memory, e.g. in case of POSIX SHM, shm_open and mmap would need to be called in the implementation of this function. More... | |
cxx::expected< MemoryProviderError > | destroyMemory () noexcept |
This function needs to be implemented to free the actual memory, e.g. in case of POSIX SHM, shm_unlink and munmap would need to be called in the implementation of this function. More... | |
Additional Inherited Members | |
![]() | |
static const char * | getErrorString (const MemoryProviderError error) noexcept |
Creates the shared memory based on a provided configuration.
|
noexcept |
Constructs a PosixShmMemoryProvider which can be used to request memory via MemoryBlocks.
[in] | shmName | is the name of the posix share memory |
[in] | accessMode | defines the read and write access to the memory |
[in] | openMode | defines the creation/open mode of the shared memory. |
|
protectedvirtualnoexcept |
This function needs to be implemented to provide the actual memory, e.g. in case of POSIX SHM, shm_open and mmap would need to be called in the implementation of this function.
[in] | size | is the size in bytes for the requested memory, the size should already be calculated according to the alignment requirements |
[in] | alignment | the required alignment for the memory |
Implements iox::roudi::MemoryProvider.
|
protectedvirtualnoexcept |
This function needs to be implemented to free the actual memory, e.g. in case of POSIX SHM, shm_unlink and munmap would need to be called in the implementation of this function.
Implements iox::roudi::MemoryProvider.