Skip to content

iox::mepoo::ShmSafeUnmanagedChunk🔗

This class to safely store a chunk in shared memory. To be able to do so, torn writes/reads need to prevented, since they create Frankenstein objects. Therefore, the class must not be larger than 64 bits and trivially copy-able in case an application dies while writing this and RouDi needs to clean up.

#include <shm_safe_unmanaged_chunk.hpp>

Public Functions🔗

Name
ShmSafeUnmanagedChunk() =default
ShmSafeUnmanagedChunk(SharedChunk chunk)
takes a SharedChunk without decrementing the chunk reference counter
SharedChunk releaseToSharedChunk()
Creates a SharedChunk without incrementing the chunk reference counter and invalidates itself.
SharedChunk cloneToSharedChunk()
Creates a SharedChunk with incrementing the chunk reference counter and does not invalidate itself.
bool isLogicalNullptr() const
Checks if the underlying RelativePointerData to the chunk is logically a nullptr.
ChunkHeader * getChunkHeader()
Access to the ChunkHeader of the underlying chunk.
const ChunkHeader * getChunkHeader() const
const access to the ChunkHeader of the underlying chunk
bool isNotLogicalNullptrAndHasNoOtherOwners() const
Checks if the underlying RelativePointerData to the chunk is neither logically a nullptr nor that the chunk has other owner.

Public Functions Documentation🔗

function ShmSafeUnmanagedChunk🔗

ShmSafeUnmanagedChunk() =default

function ShmSafeUnmanagedChunk🔗

ShmSafeUnmanagedChunk(
    SharedChunk chunk
)

takes a SharedChunk without decrementing the chunk reference counter

function releaseToSharedChunk🔗

SharedChunk releaseToSharedChunk()

Creates a SharedChunk without incrementing the chunk reference counter and invalidates itself.

function cloneToSharedChunk🔗

SharedChunk cloneToSharedChunk()

Creates a SharedChunk with incrementing the chunk reference counter and does not invalidate itself.

function isLogicalNullptr🔗

bool isLogicalNullptr() const

Checks if the underlying RelativePointerData to the chunk is logically a nullptr.

Return: true if logically a nullptr otherwise false

function getChunkHeader🔗

ChunkHeader * getChunkHeader()

Access to the ChunkHeader of the underlying chunk.

Return: the pointer to the ChunkHeader of the underlying chunk or nullptr if isLogicalNullptr would return true

function getChunkHeader🔗

const ChunkHeader * getChunkHeader() const

const access to the ChunkHeader of the underlying chunk

Return: the const pointer to the ChunkHeader of the underlying chunk or nullptr if isLogicalNullptr would return true

function isNotLogicalNullptrAndHasNoOtherOwners🔗

bool isNotLogicalNullptrAndHasNoOtherOwners() const

Checks if the underlying RelativePointerData to the chunk is neither logically a nullptr nor that the chunk has other owner.

Return: true if neither logically a nullptr nor other owner chunk owners present, otherwise false


Updated on 17 June 2021 at 11:15:27 CEST