iceoryx2
C++ Language Bindings
Loading...
Searching...
No Matches
notifier.hpp
Go to the documentation of this file.
1// Copyright (c) 2024 Contributors to the Eclipse Foundation
2//
3// See the NOTICE file(s) distributed with this work for additional
4// information regarding copyright ownership.
5//
6// This program and the accompanying materials are made available under the
7// terms of the Apache Software License 2.0 which is available at
8// https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
9// which is available at https://opensource.org/licenses/MIT.
10//
11// SPDX-License-Identifier: Apache-2.0 OR MIT
12
13#ifndef IOX2_NOTIFIER_HPP
14#define IOX2_NOTIFIER_HPP
15
16#include "iox2/bb/duration.hpp"
17#include "iox2/bb/expected.hpp"
18#include "iox2/bb/optional.hpp"
19#include "iox2/event_id.hpp"
22#include "iox2/port_name.hpp"
23#include "iox2/service_type.hpp"
25
26namespace iox2 {
28template <ServiceType S>
29class Notifier {
30 public:
31 Notifier(Notifier&&) noexcept;
32 auto operator=(Notifier&&) noexcept -> Notifier&;
34
35 Notifier(const Notifier&) = delete;
36 auto operator=(const Notifier&) -> Notifier& = delete;
37
39 auto id() const -> UniqueNotifierId;
40
42 auto name() const -> PortNameView;
43
48 auto notify() const -> bb::Expected<size_t, NotifierNotifyError>;
49
53 auto notify_with_custom_event_id(EventId event_id) const -> bb::Expected<size_t, NotifierNotifyError>;
54
56 auto deadline() const -> bb::Optional<iox2::bb::Duration>;
57
58 private:
59 template <ServiceType>
60 friend class PortFactoryNotifier;
61
62 explicit Notifier(iox2_notifier_h handle);
63 void drop();
64
65 iox2_notifier_h m_handle = nullptr;
66};
67} // namespace iox2
68
69#endif
Type that allows to identify an event uniquely.
Definition event_id.hpp:22
Represents the sending endpoint of an event based communication.
Definition notifier.hpp:29
auto deadline() const -> bb::Optional< iox2::bb::Duration >
Returns the deadline of the corresponding [Service].
auto notify_with_custom_event_id(EventId event_id) const -> bb::Expected< size_t, NotifierNotifyError >
auto name() const -> PortNameView
Returns the [PortNameView] of the [Notifier].
Notifier(Notifier &&) noexcept
auto notify() const -> bb::Expected< size_t, NotifierNotifyError >
Non-owning view of a [PortName].
Definition port_name.hpp:25
The system-wide unique id of a [Notifier].
NotifierNotifyError
Defines the failures that can occur while a [Notifier::notify()] call.