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