Skip to content

iox::popo::ChunkReceiver🔗

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. More...

#include <chunk_receiver.hpp>

Inherits from iox::popo::ChunkQueuePopper< ChunkReceiverDataType::ChunkQueueData_t >

Public Types🔗

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

Public Functions🔗

Name
ChunkReceiver(cxx::not_null< MemberType_t *const > chunkReceiverDataPtr)
ChunkReceiver(const ChunkReceiver & other)
ChunkReceiver & operator=(const ChunkReceiver & )
ChunkReceiver(ChunkReceiver && rhs) =default
ChunkReceiver & operator=(ChunkReceiver && rhs) =default
~ChunkReceiver() =default
cxx::expected< const mepoo::ChunkHeader *, ChunkReceiveResult > tryGet()
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.
void release(const mepoo::ChunkHeader *const chunkHeader)
Release a chunk that was obtained with get.
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 Functions inherited from iox::popo::ChunkQueuePopper< ChunkReceiverDataType::ChunkQueueData_t >

Name
ChunkQueuePopper(cxx::not_null< MemberType_t *const > chunkQueueDataPtr)
ChunkQueuePopper(const ChunkQueuePopper & other)
ChunkQueuePopper(ChunkQueuePopper && rhs) =default
virtual ~ChunkQueuePopper() =default
cxx::optional< mepoo::SharedChunk > tryPop()
pop a chunk from the chunk queue
bool hasLostChunks()
check if chunks were lost and reset flag
bool empty() const
pop a chunk from the chunk queue
uint64_t size()
get the current size of the queue. Caution, another thread can have changed the size just after reading it
void setCapacity(const uint64_t newCapacity)
set the capacity of the queue
uint64_t getCurrentCapacity() const
get the current capacity of the queue.
uint64_t getMaximumCapacity() const
get the maximum capacity of the queue.
void clear()
clear the queue
void setConditionVariable(ConditionVariableData & conditionVariableDataRef, const uint64_t notificationIndex)
Attaches a condition variable.
void unsetConditionVariable()
Detaches a condition variable.
bool isConditionVariableSet() const
Returns the information whether a condition variable is attached.

Detailed Description🔗

template <typename ChunkReceiverDataType >
class iox::popo::ChunkReceiver;

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 Documentation🔗

using MemberType_t🔗

using iox::popo::ChunkReceiver< ChunkReceiverDataType >::MemberType_t =  ChunkReceiverDataType;

using Base_t🔗

using iox::popo::ChunkReceiver< ChunkReceiverDataType >::Base_t =  ChunkQueuePopper<typename ChunkReceiverDataType::ChunkQueueData_t>;

Public Functions Documentation🔗

function ChunkReceiver🔗

inline explicit ChunkReceiver(
    cxx::not_null< MemberType_t *const > chunkReceiverDataPtr
)

function ChunkReceiver🔗

ChunkReceiver(
    const ChunkReceiver & other
)

function operator=🔗

ChunkReceiver & operator=(
    const ChunkReceiver & 
)

function ChunkReceiver🔗

ChunkReceiver(
    ChunkReceiver && rhs
) =default

function operator=🔗

ChunkReceiver & operator=(
    ChunkReceiver && rhs
) =default

function ~ChunkReceiver🔗

~ChunkReceiver() =default

function tryGet🔗

inline cxx::expected< const mepoo::ChunkHeader *, ChunkReceiveResult > tryGet()

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.

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

function release🔗

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

Release a chunk that was obtained with get.

Parameters:

  • chunkHeaderpointer to the ChunkHeader to release

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 26 April 2021 at 15:31:02 CEST