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/service_type.hpp"
24
25namespace iox2 {
27template <ServiceType S>
28class Notifier {
29 public:
30 Notifier(Notifier&&) noexcept;
31 auto operator=(Notifier&&) noexcept -> Notifier&;
33
34 Notifier(const Notifier&) = delete;
35 auto operator=(const Notifier&) -> Notifier& = delete;
36
38 auto id() const -> UniqueNotifierId;
39
44 auto notify() const -> bb::Expected<size_t, NotifierNotifyError>;
45
49 auto notify_with_custom_event_id(EventId event_id) const -> bb::Expected<size_t, NotifierNotifyError>;
50
52 auto deadline() const -> bb::Optional<iox2::bb::Duration>;
53
54 private:
55 template <ServiceType>
56 friend class PortFactoryNotifier;
57
58 explicit Notifier(iox2_notifier_h handle);
59 void drop();
60
61 iox2_notifier_h m_handle = nullptr;
62};
63} // namespace iox2
64
65#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:28
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 >
Notifier(Notifier &&) noexcept
auto notify() const -> bb::Expected< size_t, NotifierNotifyError >
The system-wide unique id of a [Notifier].
NotifierNotifyError
Defines the failures that can occur while a [Notifier::notify()] call.