iceoryx_doc  1.0.1
Public Types | Public Member Functions | List of all members
iox::popo::ChunkSender< ChunkSenderDataType > Class Template Reference

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>

Inheritance diagram for iox::popo::ChunkSender< ChunkSenderDataType >:
Inheritance graph
[legend]
Collaboration diagram for iox::popo::ChunkSender< ChunkSenderDataType >:
Collaboration graph
[legend]

Public Types

using MemberType_t = ChunkSenderDataType
 
using Base_t = ChunkDistributor< typename ChunkSenderDataType::ChunkDistributorData_t >
 
- Public Types inherited from iox::popo::ChunkDistributor< ChunkSenderDataType::ChunkDistributorData_t >
using MemberType_t = ChunkSenderDataType::ChunkDistributorData_t
 
using ChunkQueueData_t = typename ChunkDistributorDataType::ChunkQueueData_t
 
using ChunkQueuePusher_t = typename ChunkDistributorDataType::ChunkQueuePusher_t
 

Public Member Functions

 ChunkSender (cxx::not_null< MemberType_t *const > chunkSenderDataPtr) noexcept
 
 ChunkSender (const ChunkSender &other)=delete
 
ChunkSenderoperator= (const ChunkSender &)=delete
 
 ChunkSender (ChunkSender &&rhs)=default
 
ChunkSenderoperator= (ChunkSender &&rhs)=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) noexcept
 allocate a chunk, the ownership of the SharedChunk remains in the ChunkSender for being able to cleanup if the user process disappears More...
 
void release (const mepoo::ChunkHeader *const chunkHeader) noexcept
 Release an allocated chunk without sending it. More...
 
void send (mepoo::ChunkHeader *const chunkHeader) noexcept
 Send an allocated chunk to all connected ChunkQueuePopper. More...
 
void pushToHistory (mepoo::ChunkHeader *const chunkHeader) noexcept
 Push an allocated chunk to the history without sending it. More...
 
cxx::optional< const mepoo::ChunkHeader * > tryGetPreviousChunk () const noexcept
 Returns the last sent chunk if there is one. More...
 
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.
 
- Public Member Functions inherited from iox::popo::ChunkDistributor< ChunkSenderDataType::ChunkDistributorData_t >
 ChunkDistributor (cxx::not_null< MemberType_t *const > chunkDistrubutorDataPtr) noexcept
 
 ChunkDistributor (const ChunkDistributor &other)=delete
 
 ChunkDistributor (ChunkDistributor &&rhs)=default
 
ChunkDistributoroperator= (const ChunkDistributor &)=delete
 
ChunkDistributoroperator= (ChunkDistributor &&rhs)=default
 
cxx::expected< ChunkDistributorError > tryAddQueue (cxx::not_null< ChunkQueueData_t *const > queueToAdd, const uint64_t requestedHistory=0u) noexcept
 Add a queue to the internal list of chunk queues to which chunks are delivered when calling deliverToAllStoredQueues. More...
 
cxx::expected< ChunkDistributorError > tryRemoveQueue (cxx::not_null< ChunkQueueData_t *const > queueToRemove) noexcept
 Remove a queue from the internal list of chunk queues. More...
 
void removeAllQueues () noexcept
 Delete all the stored chunk queues.
 
bool hasStoredQueues () const noexcept
 Get the information whether there are any stored chunk queues. More...
 
void deliverToAllStoredQueues (mepoo::SharedChunk chunk) noexcept
 Deliver the provided shared chunk to all the stored chunk queues. The chunk will be added to the chunk history. More...
 
bool deliverToQueue (cxx::not_null< ChunkQueueData_t *const > queue, mepoo::SharedChunk chunk) noexcept
 Deliver the provided shared chunk to the provided chunk queue. The chunk will NOT be added to the chunk history. More...
 
void addToHistoryWithoutDelivery (mepoo::SharedChunk chunk) noexcept
 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. More...
 
uint64_t getHistorySize () noexcept
 Get the current size of the chunk history. More...
 
uint64_t getHistoryCapacity () const noexcept
 Get the capacity of the chunk history. More...
 
void clearHistory () noexcept
 Clears the chunk history.
 
void cleanup () noexcept
 cleanup the used shrared memory chunks More...
 

Additional Inherited Members

- Protected Member Functions inherited from iox::popo::ChunkDistributor< ChunkSenderDataType::ChunkDistributorData_t >
const MemberType_t * getMembers () const noexcept
 
MemberType_t * getMembers () noexcept
 

Detailed Description

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

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.

Member Function Documentation

◆ pushToHistory()

template<typename ChunkSenderDataType >
void iox::popo::ChunkSender< ChunkSenderDataType >::pushToHistory ( mepoo::ChunkHeader *const  chunkHeader)
inlinenoexcept

Push an allocated chunk to the history without sending it.

Parameters
[in]chunkHeader,pointerto the ChunkHeader to push to the history

◆ release()

template<typename ChunkSenderDataType >
void iox::popo::ChunkSender< ChunkSenderDataType >::release ( const mepoo::ChunkHeader *const  chunkHeader)
inlinenoexcept

Release an allocated chunk without sending it.

Parameters
[in]chunkHeader,pointerto the ChunkHeader to release

◆ send()

template<typename ChunkSenderDataType >
void iox::popo::ChunkSender< ChunkSenderDataType >::send ( mepoo::ChunkHeader *const  chunkHeader)
inlinenoexcept

Send an allocated chunk to all connected ChunkQueuePopper.

Parameters
[in]chunkHeader,pointerto the ChunkHeader to send

◆ tryAllocate()

template<typename ChunkSenderDataType >
cxx::expected< mepoo::ChunkHeader *, AllocationError > iox::popo::ChunkSender< ChunkSenderDataType >::tryAllocate ( const UniquePortId  originId,
const uint32_t  userPayloadSize,
const uint32_t  userPayloadAlignment,
const uint32_t  userHeaderSize,
const uint32_t  userHeaderAlignment 
)
inlinenoexcept

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

Parameters
[in]originId,theunique id of the entity which requested this allocate
[in]userPayloadSize,sizeof the user-payload without additional headers
[in]userPayloadAlignment,alignmentof the user-payload
[in]userHeaderSize,sizeof the user-header; use iox::CHUNK_NO_USER_HEADER_SIZE to omit a user-header
[in]userHeaderAlignment,alignmentof the user-header; use iox::CHUNK_NO_USER_HEADER_ALIGNMENT to omit a user-header
Returns
on success pointer to a ChunkHeader which can be used to access the chunk-header, user-header and user-payload fields, error if not

◆ tryGetPreviousChunk()

template<typename ChunkSenderDataType >
cxx::optional< const mepoo::ChunkHeader * > iox::popo::ChunkSender< ChunkSenderDataType >::tryGetPreviousChunk
inlinenoexcept

Returns the last sent chunk if there is one.

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

The documentation for this class was generated from the following files: