Template Class ChunkReceiver

Inheritance Relationships

Base Type

Class Documentation

template<typename ChunkReceiverDataType>
class ChunkReceiver : public iox::popo::ChunkQueuePopper<ChunkReceiverDataType::ChunkQueueData_t>

The ChunkReceiver is a building block of the shared memory communication infrastructure. It extends the functionality of a ChunkQueuePopper with the abililty to pass chunks to the user side (user process). Together with the ChunkSender, they are the next abstraction layer on top of ChunkDistributor and ChunkQueuePopper. The ChunkRceiver holds the ownership of the SharedChunks and does a bookkeeping which chunks are currently passed to the user side.

Public Types

using MemberType_t = ChunkReceiverDataType
using Base_t = ChunkQueuePopper<typename ChunkReceiverDataType::ChunkQueueData_t>

Public Functions

explicit ChunkReceiver(cxx::not_null<MemberType_t*const> chunkReceiverDataPtr) noexcept
ChunkReceiver(const ChunkReceiver &other) = delete
ChunkReceiver &operator=(const ChunkReceiver&) = delete
ChunkReceiver(ChunkReceiver &&rhs) noexcept = default
ChunkReceiver &operator=(ChunkReceiver &&rhs) noexcept = default
~ChunkReceiver() noexcept = default
cxx::expected<const mepoo::ChunkHeader*, ChunkReceiveResult> tryGet() noexcept

Tries to get the next received chunk. If there is a new one the ChunkHeader of this new chunk is received The ownerhip of the SharedChunk remains in the ChunkReceiver for being able to cleanup if the user process disappears.

Returns:

New chunk header, ChunkReceiveResult on error or if there are no new chunks in the underlying queue

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

Release a chunk that was obtained with get.

Parameters:

chunkHeader, pointer[in] to the ChunkHeader to release

void releaseAll() noexcept

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.