17 #ifndef IOX_POSH_POPO_BUILDING_BLOCKS_CHUNK_DISTRIBUTOR_HPP
18 #define IOX_POSH_POPO_BUILDING_BLOCKS_CHUNK_DISTRIBUTOR_HPP
20 #include "iceoryx_posh/internal/mepoo/shared_chunk.hpp"
21 #include "iceoryx_posh/internal/popo/building_blocks/chunk_distributor_data.hpp"
22 #include "iceoryx_posh/internal/popo/building_blocks/chunk_queue_pusher.hpp"
23 #include "iceoryx_utils/cxx/helplets.hpp"
31 enum class ChunkDistributorError
34 QUEUE_CONTAINER_OVERFLOW,
35 QUEUE_NOT_IN_CONTAINER
61 template <
typename ChunkDistributorDataType>
65 using MemberType_t = ChunkDistributorDataType;
66 using ChunkQueueData_t =
typename ChunkDistributorDataType::ChunkQueueData_t;
67 using ChunkQueuePusher_t =
typename ChunkDistributorDataType::ChunkQueuePusher_t;
69 explicit ChunkDistributor(cxx::not_null<MemberType_t* const> chunkDistrubutorDataPtr) noexcept;
83 cxx::expected<ChunkDistributorError>
tryAddQueue(cxx::not_null<ChunkQueueData_t* const> queueToAdd,
84 const uint64_t requestedHistory = 0u) noexcept;
89 cxx::expected<ChunkDistributorError>
tryRemoveQueue(cxx::not_null<ChunkQueueData_t* const> queueToRemove) noexcept;
130 const MemberType_t* getMembers()
const noexcept;
131 MemberType_t* getMembers() noexcept;
134 MemberType_t* m_chunkDistrubutorDataPtr{
nullptr};
140 #include "iceoryx_posh/internal/popo/building_blocks/chunk_distributor.inl"
WARNING: SharedChunk is not thread safe! Don't share SharedChunk objects between threads!...
Definition: shared_chunk.hpp:35
The ChunkDistributor is the low layer building block to send SharedChunks to a dynamic number of Chun...
Definition: chunk_distributor.hpp:63
cxx::expected< ChunkDistributorError > tryRemoveQueue(cxx::not_null< ChunkQueueData_t *const > queueToRemove) noexcept
Remove a queue from the internal list of chunk queues.
Definition: chunk_distributor.inl:98
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 deliverTo...
Definition: chunk_distributor.inl:47
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 chu...
Definition: chunk_distributor.inl:204
uint64_t getHistoryCapacity() const noexcept
Get the capacity of the chunk history.
Definition: chunk_distributor.inl:238
void cleanup() noexcept
cleanup the used shrared memory chunks
Definition: chunk_distributor.inl:257
void deliverToAllStoredQueues(mepoo::SharedChunk chunk) noexcept
Deliver the provided shared chunk to all the stored chunk queues. The chunk will be added to the chun...
Definition: chunk_distributor.inl:134
void removeAllQueues() noexcept
Delete all the stored chunk queues.
Definition: chunk_distributor.inl:118
uint64_t getHistorySize() noexcept
Get the current size of the chunk history.
Definition: chunk_distributor.inl:230
bool hasStoredQueues() const noexcept
Get the information whether there are any stored chunk queues.
Definition: chunk_distributor.inl:126
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 upda...
Definition: chunk_distributor.inl:211
void clearHistory() noexcept
Clears the chunk history.
Definition: chunk_distributor.inl:244
Definition: service_description.hpp:29