iceoryx_doc  1.0.1
chunk_distributor_data.hpp
1 // Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
2 // Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 // SPDX-License-Identifier: Apache-2.0
17 #ifndef IOX_POSH_POPO_BUILDING_BLOCKS_CHUNK_DISTRIBUTOR_DATA_HPP
18 #define IOX_POSH_POPO_BUILDING_BLOCKS_CHUNK_DISTRIBUTOR_DATA_HPP
19 
20 #include "iceoryx_posh/iceoryx_posh_types.hpp"
21 #include "iceoryx_posh/internal/log/posh_logging.hpp"
22 #include "iceoryx_posh/internal/mepoo/shm_safe_unmanaged_chunk.hpp"
23 #include "iceoryx_posh/internal/popo/building_blocks/chunk_queue_pusher.hpp"
24 #include "iceoryx_posh/popo/port_queue_policies.hpp"
25 #include "iceoryx_utils/cxx/algorithm.hpp"
26 #include "iceoryx_utils/cxx/vector.hpp"
27 #include "iceoryx_utils/error_handling/error_handling.hpp"
28 #include "iceoryx_utils/internal/posix_wrapper/mutex.hpp"
29 #include "iceoryx_utils/internal/relocatable_pointer/relative_pointer.hpp"
30 
31 #include <cstdint>
32 #include <mutex>
33 
34 namespace iox
35 {
36 namespace popo
37 {
38 template <typename ChunkDistributorDataProperties, typename LockingPolicy, typename ChunkQueuePusherType>
39 struct ChunkDistributorData : public LockingPolicy
40 {
42  using LockGuard_t = std::lock_guard<const ThisType_t>;
43  using ChunkQueuePusher_t = ChunkQueuePusherType;
44  using ChunkQueueData_t = typename ChunkQueuePusherType::MemberType_t;
45  using ChunkDistributorDataProperties_t = ChunkDistributorDataProperties;
46 
47  ChunkDistributorData(const SubscriberTooSlowPolicy policy, const uint64_t historyCapacity = 0u) noexcept;
48 
49  const uint64_t m_historyCapacity;
50 
51  using QueueContainer_t =
52  cxx::vector<rp::RelativePointer<ChunkQueueData_t>, ChunkDistributorDataProperties_t::MAX_QUEUES>;
53  QueueContainer_t m_queues;
54 
60  cxx::vector<mepoo::ShmSafeUnmanagedChunk, ChunkDistributorDataProperties_t::MAX_HISTORY_CAPACITY>;
61  HistoryContainer_t m_history;
62  const SubscriberTooSlowPolicy m_subscriberTooSlowPolicy;
63 };
64 
65 } // namespace popo
66 } // namespace iox
67 
68 #include "iceoryx_posh/internal/popo/building_blocks/chunk_distributor_data.inl"
69 
70 #endif // IOX_POSH_POPO_BUILDING_BLOCKS_CHUNK_DISTRIBUTOR_DATA_HPP
Definition: service_description.hpp:29
Definition: chunk_distributor_data.hpp:40
cxx::vector< mepoo::ShmSafeUnmanagedChunk, ChunkDistributorDataProperties_t::MAX_HISTORY_CAPACITY > HistoryContainer_t
Definition: chunk_distributor_data.hpp:60