iceoryx_doc  1.0.1
notification_info.hpp
1 // Copyright (c) 2020, 2021 by Apex.AI Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // SPDX-License-Identifier: Apache-2.0
16 
17 #ifndef IOX_POSH_POPO_NOTIFICATION_INFO_HPP
18 #define IOX_POSH_POPO_NOTIFICATION_INFO_HPP
19 
20 #include "iceoryx_posh/internal/log/posh_logging.hpp"
21 #include "iceoryx_posh/popo/notification_callback.hpp"
22 #include "iceoryx_utils/cxx/function_ref.hpp"
23 #include "iceoryx_utils/error_handling/error_handling.hpp"
24 
25 #include <cstdint>
26 #include <limits>
27 
28 namespace iox
29 {
30 namespace popo
31 {
35 {
36  public:
37  static constexpr uint64_t INVALID_ID = std::numeric_limits<uint64_t>::max();
38 
40  NotificationInfo() = default;
41  virtual ~NotificationInfo() = default;
42 
47  template <typename T, typename ContextDataType>
48  NotificationInfo(T* const notificationOrigin,
49  const uint64_t notificationId,
50  const NotificationCallback<T, ContextDataType>& callback) noexcept;
51 
55  uint64_t getNotificationId() const noexcept;
56 
61  template <typename T>
62  bool doesOriginateFrom(T* const notificationOrigin) const noexcept;
63 
68  template <typename T>
69  T* getOrigin() const noexcept;
70 
73  bool operator()() const noexcept;
74 
75  friend class Trigger;
76 
77  protected:
78  void* m_notificationOrigin = nullptr;
79  void* m_userValue = nullptr;
80  uint64_t m_notificationOriginTypeHash = 0U;
81  uint64_t m_notificationId = INVALID_ID;
82 
83  internal::GenericCallbackPtr_t m_callbackPtr = nullptr;
84  internal::TranslationCallbackPtr_t m_callback = nullptr;
85 };
86 
87 } // namespace popo
88 } // namespace iox
89 
90 #include "iceoryx_posh/internal/popo/notification_info.inl"
91 
92 #endif
NotificationInfo holds the state of a trigger like the pointer to the triggerOrigin,...
Definition: notification_info.hpp:35
NotificationInfo()=default
constructs an empty NotificationInfo
T * getOrigin() const noexcept
returns the pointer to the notificationOrigin.
Definition: notification_info.inl:48
bool doesOriginateFrom(T *const notificationOrigin) const noexcept
confirms the notificationOrigin
Definition: notification_info.inl:38
uint64_t getNotificationId() const noexcept
returns the notification id
The Trigger class is usually managed by a factory class like a WaitSet and acquired by classes which ...
Definition: trigger.hpp:56
Definition: service_description.hpp:29
the struct describes a callback with a user defined type which can be attached to a WaitSet or a List...
Definition: notification_callback.hpp:58