Skip to content

iox::popo::ChunkSender🔗

The ChunkSender is a building block of the shared memory communication infrastructure. It extends the functionality of a ChunkDistributor with the abililty to allocate and free memory chunks. For getting chunks of memory the MemoryManger is used. Together with the ChunkReceiver, they are the next abstraction layer on top of ChunkDistributor and ChunkQueuePopper. The ChunkSender holds the ownership of the SharedChunks and does a bookkeeping which chunks are currently passed to the user side. More...

#include <chunk_sender.hpp>

Inherits from iox::popo::ChunkDistributor< ChunkSenderDataType::ChunkDistributorData_t >

Public Types🔗

Name
using ChunkSenderDataType MemberType_t
using ChunkDistributor< typename ChunkSenderDataType::ChunkDistributorData_t > Base_t

Public Functions🔗

Name
ChunkSender(cxx::not_null< MemberType_t *const > chunkSenderDataPtr)
ChunkSender(const ChunkSender & other)
ChunkSender & operator=(const ChunkSender & )
ChunkSender(ChunkSender && rhs) =default
ChunkSender & operator=(ChunkSender && rhs) =default
~ChunkSender() =default
cxx::expected< mepoo::ChunkHeader *, AllocationError > tryAllocate(const UniquePortId originId, const uint32_t userPayloadSize, const uint32_t userPayloadAlignment, const uint32_t userHeaderSize, const uint32_t userHeaderAlignment)
allocate a chunk, the ownership of the SharedChunk remains in the ChunkSender for being able to cleanup if the user process disappears
void release(const mepoo::ChunkHeader *const chunkHeader)
Release an allocated chunk without sending it.
void send(mepoo::ChunkHeader *const chunkHeader)
Send an allocated chunk to all connected ChunkQueuePopper.
void pushToHistory(mepoo::ChunkHeader *const chunkHeader)
Push an allocated chunk to the history without sending it.
cxx::optional< const mepoo::ChunkHeader * > tryGetPreviousChunk() const
Returns the last sent chunk if there is one.
void releaseAll()
Release all the chunks that are currently held. Caution: Only call this if the user process is no more running E.g. This cleans up chunks that were held by a user process that died unexpectetly, for avoiding lost chunks in the system.

Additional inherited members🔗

Public Types inherited from iox::popo::ChunkDistributor< ChunkSenderDataType::ChunkDistributorData_t >

Name
using typename ChunkDistributorDataType::ChunkQueueData_t ChunkQueueData_t
using typename ChunkDistributorDataType::ChunkQueuePusher_t ChunkQueuePusher_t

Public Functions inherited from iox::popo::ChunkDistributor< ChunkSenderDataType::ChunkDistributorData_t >

Name
ChunkDistributor(cxx::not_null< MemberType_t *const > chunkDistrubutorDataPtr)
ChunkDistributor(const ChunkDistributor & other)
ChunkDistributor(ChunkDistributor && rhs) =default
virtual ~ChunkDistributor() =default
cxx::expected< ChunkDistributorError > tryAddQueue(cxx::not_null< ChunkQueueData_t *const > queueToAdd, const uint64_t requestedHistory =0u)
Add a queue to the internal list of chunk queues to which chunks are delivered when calling deliverToAllStoredQueues.
cxx::expected< ChunkDistributorError > tryRemoveQueue(cxx::not_null< ChunkQueueData_t *const > queueToRemove)
Remove a queue from the internal list of chunk queues.
void removeAllQueues()
Delete all the stored chunk queues.
bool hasStoredQueues() const
Get the information whether there are any stored chunk queues.
void deliverToAllStoredQueues(mepoo::SharedChunk chunk)
Deliver the provided shared chunk to all the stored chunk queues. The chunk will be added to the chunk history.
bool deliverToQueue(cxx::not_null< ChunkQueueData_t *const > queue, mepoo::SharedChunk chunk)
Deliver the provided shared chunk to the provided chunk queue. The chunk will NOT be added to the chunk history.
void addToHistoryWithoutDelivery(mepoo::SharedChunk chunk)
Update the chunk history but do not deliver the chunk to any chunk queue. E.g. use case is to to update a non offered field in ara.
uint64_t getHistorySize()
Get the current size of the chunk history.
uint64_t getHistoryCapacity() const
Get the capacity of the chunk history.
void clearHistory()
Clears the chunk history.
void cleanup()
cleanup the used shrared memory chunks

Detailed Description🔗

template <typename ChunkSenderDataType >
class iox::popo::ChunkSender;

The ChunkSender is a building block of the shared memory communication infrastructure. It extends the functionality of a ChunkDistributor with the abililty to allocate and free memory chunks. For getting chunks of memory the MemoryManger is used. Together with the ChunkReceiver, they are the next abstraction layer on top of ChunkDistributor and ChunkQueuePopper. The ChunkSender holds the ownership of the SharedChunks and does a bookkeeping which chunks are currently passed to the user side.

Public Types Documentation🔗

using MemberType_t🔗

using iox::popo::ChunkSender< ChunkSenderDataType >::MemberType_t =  ChunkSenderDataType;

using Base_t🔗

using iox::popo::ChunkSender< ChunkSenderDataType >::Base_t =  ChunkDistributor<typename ChunkSenderDataType::ChunkDistributorData_t>;

Public Functions Documentation🔗

function ChunkSender🔗

inline explicit ChunkSender(
    cxx::not_null< MemberType_t *const > chunkSenderDataPtr
)

function ChunkSender🔗

ChunkSender(
    const ChunkSender & other
)

function operator=🔗

ChunkSender & operator=(
    const ChunkSender & 
)

function ChunkSender🔗

ChunkSender(
    ChunkSender && rhs
) =default

function operator=🔗

ChunkSender & operator=(
    ChunkSender && rhs
) =default

function ~ChunkSender🔗

~ChunkSender() =default

function tryAllocate🔗

inline cxx::expected< mepoo::ChunkHeader *, AllocationError > tryAllocate(
    const UniquePortId originId,
    const uint32_t userPayloadSize,
    const uint32_t userPayloadAlignment,
    const uint32_t userHeaderSize,
    const uint32_t userHeaderAlignment
)

allocate a chunk, the ownership of the SharedChunk remains in the ChunkSender for being able to cleanup if the user process disappears

Parameters:

  • originIdthe unique id of the entity which requested this allocate
  • userPayloadSizesize of the user-payload without additional headers
  • userPayloadAlignmentalignment of the user-payload
  • userHeaderSizesize of the user-header; use iox::CHUNK_NO_USER_HEADER_SIZE to omit a user-header
  • userHeaderAlignmentalignment of the user-header; use iox::CHUNK_NO_USER_HEADER_ALIGNMENT to omit a user-header

Return: on success pointer to a ChunkHeader which can be used to access the chunk-header, user-header and user-payload fields, error if not

function release🔗

inline void release(
    const mepoo::ChunkHeader *const chunkHeader
)

Release an allocated chunk without sending it.

Parameters:

  • chunkHeaderpointer to the ChunkHeader to release

function send🔗

inline void send(
    mepoo::ChunkHeader *const chunkHeader
)

Send an allocated chunk to all connected ChunkQueuePopper.

Parameters:

  • chunkHeaderpointer to the ChunkHeader to send

function pushToHistory🔗

inline void pushToHistory(
    mepoo::ChunkHeader *const chunkHeader
)

Push an allocated chunk to the history without sending it.

Parameters:

  • chunkHeaderpointer to the ChunkHeader to push to the history

function tryGetPreviousChunk🔗

inline cxx::optional< const mepoo::ChunkHeader * > tryGetPreviousChunk() const

Returns the last sent chunk if there is one.

Return: pointer to the ChunkHeader of the last sent Chunk if there is one, empty optional if not

function releaseAll🔗

inline void releaseAll()

Release all the chunks that are currently held. Caution: Only call this if the user process is no more running E.g. This cleans up chunks that were held by a user process that died unexpectetly, for avoiding lost chunks in the system.


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