iceoryx_doc  1.0.1
chunk_queue_pusher.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_PUSHER_HPP
18 #define IOX_POSH_POPO_BUILDING_BLOCKS_CHUNK_QUEUE_PUSHER_HPP
19 
20 #include "iceoryx_posh/internal/mepoo/shared_chunk.hpp"
21 #include "iceoryx_posh/internal/popo/building_blocks/chunk_queue_data.hpp"
22 #include "iceoryx_posh/internal/popo/building_blocks/condition_notifier.hpp"
23 #include "iceoryx_utils/cxx/expected.hpp"
24 #include "iceoryx_utils/cxx/helplets.hpp"
25 
26 namespace iox
27 {
28 namespace popo
29 {
34 template <typename ChunkQueueDataType>
36 {
37  public:
38  using MemberType_t = ChunkQueueDataType;
39 
40  explicit ChunkQueuePusher(cxx::not_null<MemberType_t* const> chunkQueueDataPtr) noexcept;
41 
42  ChunkQueuePusher(const ChunkQueuePusher& other) = delete;
43  ChunkQueuePusher& operator=(const ChunkQueuePusher&) = delete;
44  ChunkQueuePusher(ChunkQueuePusher&& rhs) = default;
45  ChunkQueuePusher& operator=(ChunkQueuePusher&& rhs) = default;
46  ~ChunkQueuePusher() = default;
47 
51  bool push(mepoo::SharedChunk chunk) noexcept;
52 
54  void lostAChunk() noexcept;
55 
56  protected:
57  const MemberType_t* getMembers() const noexcept;
58  MemberType_t* getMembers() noexcept;
59 
60  private:
61  MemberType_t* m_chunkQueueDataPtr{nullptr};
62 };
63 
64 } // namespace popo
65 } // namespace iox
66 
67 #include "iceoryx_posh/internal/popo/building_blocks/chunk_queue_pusher.inl"
68 
69 #endif // IOX_POSH_POPO_BUILDING_BLOCKS_CHUNK_QUEUE_PUSHER_HPP
WARNING: SharedChunk is not thread safe! Don't share SharedChunk objects between threads!...
Definition: shared_chunk.hpp:35
The ChunkQueuePusher is the low layer building block to push SharedChunks in a chunk queue....
Definition: chunk_queue_pusher.hpp:36
bool push(mepoo::SharedChunk chunk) noexcept
push a new chunk to the chunk queue
Definition: chunk_queue_pusher.inl:47
void lostAChunk() noexcept
tell the queue that it lost a chunk (e.g. because push failed and there will be no retry)
Definition: chunk_queue_pusher.inl:74
Definition: service_description.hpp:29