iceoryx_doc  1.0.1
untyped_subscriber.hpp
1 // Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
2 // Copyright (c) 2020 - 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 
18 #ifndef IOX_POSH_POPO_UNTYPED_SUBSCRIBER_HPP
19 #define IOX_POSH_POPO_UNTYPED_SUBSCRIBER_HPP
20 
21 #include "iceoryx_posh/capro/service_description.hpp"
22 #include "iceoryx_posh/iceoryx_posh_types.hpp"
23 #include "iceoryx_posh/popo/base_subscriber.hpp"
24 #include "iceoryx_utils/cxx/expected.hpp"
25 #include "iceoryx_utils/cxx/unique_ptr.hpp"
26 
27 namespace iox
28 {
29 namespace popo
30 {
31 class Void
32 {
33 };
34 
35 template <typename BaseSubscriber_t = BaseSubscriber<>>
36 class UntypedSubscriberImpl : public BaseSubscriber_t
37 {
38  public:
39  using BaseSubscriber = BaseSubscriber_t;
41 
43  const SubscriberOptions& subscriberOptions = SubscriberOptions());
44  UntypedSubscriberImpl(const UntypedSubscriberImpl& other) = delete;
45  UntypedSubscriberImpl& operator=(const UntypedSubscriberImpl&) = delete;
47  UntypedSubscriberImpl& operator=(UntypedSubscriberImpl&& rhs) = delete;
48  virtual ~UntypedSubscriberImpl() noexcept;
49 
56  cxx::expected<const void*, ChunkReceiveResult> take() noexcept;
57 
66  void release(const void* const userPayload) noexcept;
67 
68  protected:
70 };
71 
73 
74 } // namespace popo
75 } // namespace iox
76 
77 #include "iceoryx_posh/internal/popo/untyped_subscriber.inl"
78 
79 #endif // IOX_POSH_POPO_UNTYPED_SUBSCRIBER_HPP
class for the identification of a communication event including information on the service,...
Definition: service_description.hpp:86
base class for all types of subscriber
Definition: base_subscriber.hpp:51
const port_t & port() const noexcept
const accessor of the underlying port
Definition: base_subscriber.inl:199
Definition: untyped_subscriber.hpp:37
cxx::expected< const void *, ChunkReceiveResult > take() noexcept
Take the chunk from the top of the receive queue.
Definition: untyped_subscriber.inl:33
void release(const void *const userPayload) noexcept
Releases the ownership of the chunk provided by the user-payload pointer.
Definition: untyped_subscriber.inl:44
Definition: untyped_subscriber.hpp:32
Definition: service_description.hpp:29
This struct is used to configure the subscriber.
Definition: subscriber_options.hpp:31