17#ifndef IOX_POSH_POPO_TRIGGER_HPP
18#define IOX_POSH_POPO_TRIGGER_HPP
20#include "iceoryx_hoofs/cxx/helplets.hpp"
21#include "iceoryx_hoofs/cxx/method_callback.hpp"
22#include "iceoryx_posh/internal/popo/building_blocks/condition_variable_data.hpp"
23#include "iceoryx_posh/popo/notification_callback.hpp"
24#include "iceoryx_posh/popo/notification_info.hpp"
58 static constexpr uint64_t INVALID_TRIGGER_ID = std::numeric_limits<uint64_t>::max();
77 template <
typename T,
typename UserType>
80 const cxx::ConstMethodCallback<bool>& hasTriggeredCallback,
81 const cxx::MethodCallback<void, uint64_t>& resetCallback,
82 const uint64_t notificationId,
84 const uint64_t uniqueId,
85 const uint64_t stateType,
86 const uint64_t stateTypeHash)
noexcept;
99 template <
typename T,
typename UserType>
101 T*
const notificationOrigin,
102 const cxx::MethodCallback<void, uint64_t>& resetCallback,
103 const uint64_t notificationId,
105 const uint64_t uniqueId,
106 const uint64_t notificationType,
107 const uint64_t notificationTypeHash)
noexcept;
119 explicit operator
bool() const noexcept;
143 const uint64_t originTriggerType,
144 const uint64_t originTriggerTypeHash) const noexcept;
148 template <typename T>
158 template <typename T, typename ContextDataType>
159 Trigger(T* const notificationOrigin,
160 const cxx::ConstMethodCallback<
bool>& hasTriggeredCallback,
161 const cxx::MethodCallback<
void, uint64_t>& resetCallback,
162 const uint64_t notificationId,
164 const uint64_t uniqueId,
165 const TriggerType triggerType,
166 const uint64_t originTriggerType,
167 const uint64_t originTriggerTypeHash) noexcept;
172 cxx::ConstMethodCallback<
bool> m_hasTriggeredCallback;
173 cxx::MethodCallback<
void, uint64_t> m_resetCallback;
174 uint64_t m_uniqueId = INVALID_TRIGGER_ID;
176 TriggerType m_triggerType = TriggerType::STATE_BASED;
177 uint64_t m_originTriggerType = INVALID_TRIGGER_ID;
178 uint64_t m_originTriggerTypeHash = INVALID_TRIGGER_ID;
185#include "iceoryx_posh/internal/popo/trigger.inl"
NotificationInfo holds the state of a trigger like the pointer to the triggerOrigin,...
Definition: notification_info.hpp:35
The Trigger class is usually managed by a factory class like a WaitSet and acquired by classes which ...
Definition: trigger.hpp:56
void invalidate() noexcept
invalidates the Trigger without calling the reset callback
void reset() noexcept
resets and invalidates the Trigger
bool isStateConditionSatisfied() const noexcept
returns the result of the provided hasTriggeredCallback
TriggerType getTriggerType() const noexcept
returns the type of trigger
bool isValid() const noexcept
returns true if the trigger is valid otherwise false
const NotificationInfo & getNotificationInfo() const noexcept
returns the NotificationInfo
~Trigger() noexcept
calls reset on destruction
Trigger(EventBasedTrigger_t, T *const notificationOrigin, const cxx::MethodCallback< void, uint64_t > &resetCallback, const uint64_t notificationId, const NotificationCallback< T, UserType > &callback, const uint64_t uniqueId, const uint64_t notificationType, const uint64_t notificationTypeHash) noexcept
Creates an event based Trigger.
bool isLogicalEqualTo(const void *const notificationOrigin, const uint64_t originTriggerType, const uint64_t originTriggerTypeHash) const noexcept
returns true if the Triggers are logical equal otherwise false. Two Triggers are logical equal when
uint64_t getUniqueId() const noexcept
returns the internal unique id of the trigger
Trigger(StateBasedTrigger_t, T *const stateOrigin, const cxx::ConstMethodCallback< bool > &hasTriggeredCallback, const cxx::MethodCallback< void, uint64_t > &resetCallback, const uint64_t notificationId, const NotificationCallback< T, UserType > &callback, const uint64_t uniqueId, const uint64_t stateType, const uint64_t stateTypeHash) noexcept
Creates a state based Trigger.
void updateOrigin(T &newOrigin) noexcept
sets a new origin of the trigger
Definition: trigger.hpp:39
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
Definition: trigger.hpp:34