iceoryx_doc  1.0.1
chunk_queue_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_QUEUE_DATA_HPP
18 #define IOX_POSH_POPO_BUILDING_BLOCKS_CHUNK_QUEUE_DATA_HPP
19 
20 #include "iceoryx_posh/iceoryx_posh_types.hpp"
21 #include "iceoryx_posh/internal/mepoo/shm_safe_unmanaged_chunk.hpp"
22 #include "iceoryx_posh/internal/popo/building_blocks/condition_notifier.hpp"
23 #include "iceoryx_posh/internal/popo/building_blocks/condition_variable_data.hpp"
24 #include "iceoryx_posh/popo/port_queue_policies.hpp"
25 #include "iceoryx_utils/cxx/variant_queue.hpp"
26 #include "iceoryx_utils/internal/relocatable_pointer/relative_pointer.hpp"
27 #include "iceoryx_utils/posix_wrapper/semaphore.hpp"
28 
29 namespace iox
30 {
31 namespace popo
32 {
33 template <typename ChunkQueueDataProperties, typename LockingPolicy>
34 struct ChunkQueueData : public LockingPolicy
35 {
37  using LockGuard_t = std::lock_guard<const ThisType_t>;
38  using ChunkQueueDataProperties_t = ChunkQueueDataProperties;
39 
40  ChunkQueueData(const QueueFullPolicy policy, const cxx::VariantQueueTypes queueType) noexcept;
41 
42  static constexpr uint64_t MAX_CAPACITY = ChunkQueueDataProperties_t::MAX_QUEUE_CAPACITY;
43  cxx::VariantQueue<mepoo::ShmSafeUnmanagedChunk, MAX_CAPACITY> m_queue;
44  std::atomic_bool m_queueHasLostChunks{false};
45 
46  rp::RelativePointer<ConditionVariableData> m_conditionVariableDataPtr;
47  cxx::optional<uint64_t> m_conditionVariableNotificationIndex;
48  const QueueFullPolicy m_queueFullPolicy;
49 };
50 
51 } // namespace popo
52 } // namespace iox
53 
54 #include "iceoryx_posh/internal/popo/building_blocks/chunk_queue_data.inl"
55 
56 #endif // IOX_POSH_POPO_BUILDING_BLOCKS_CHUNK_QUEUE_DATA_HPP
Definition: service_description.hpp:29
Definition: chunk_queue_data.hpp:35