Class TriggerHandle
Defined in File trigger_handle.hpp
Class Documentation
-
class TriggerHandle
TriggerHandle is threadsafe without restrictions in a single process. Not qualified for inter process usage. The TriggerHandle is generated by a Notifyable like the WaitSet and handed out to the user when they acquire a trigger. The TriggerHandle corresponds with an internal Trigger and is used to signal an event via the trigger method. When it goes out of scope it cleans up the corresponding trigger in the Notifyable.
Public Functions
-
TriggerHandle() noexcept
Note
explicitly implemented for MSVC and QNX
-
TriggerHandle(ConditionVariableData &conditionVariableData, const cxx::MethodCallback<void, uint64_t> resetCallback, const uint64_t uniqueTriggerId) noexcept
Creates a TriggerHandle.
- Parameters:
conditionVariableDataRef – [in] reference to a condition variable data struct
resetCallback – [in] callback which will be called it goes out of scope or reset is called
uniqueTriggerId – [in] the unique trigger id of the Trigger which corresponds to the TriggerHandle. Usually stored in a Notifyable. It is required for the resetCallback
-
TriggerHandle(const TriggerHandle&) = delete
-
TriggerHandle &operator=(const TriggerHandle&) = delete
-
TriggerHandle(TriggerHandle &&rhs) noexcept
-
TriggerHandle &operator=(TriggerHandle &&rhs) noexcept
-
~TriggerHandle() noexcept
-
explicit operator bool() const noexcept
returns true if the TriggerHandle is valid otherwise false. A TriggerHandle is valid if m_conditionVariableDataPtr != nullptr.
-
bool isValid() const noexcept
returns true if the TriggerHandle is valid otherwise false. A TriggerHandle is valid if m_conditionVariableDataPtr != nullptr.
-
bool wasTriggered() const noexcept
Returns true when the TriggerHandle was triggered.
Note
The TriggerHandle wasTriggered state is set to false again after the underlying ConditionListener gathered all events.
-
void trigger() noexcept
triggers the Trigger and informs the Notifyable which verifies that the Trigger was triggered by calling the hasTriggeredCallback
-
void reset() noexcept
calls the resetCallback and invalidates the TriggerHandle
-
void invalidate() noexcept
invalidates the TriggerHandle without calling the reset callback
-
uint64_t getUniqueId() const noexcept
returns the uniqueTriggerId
-
ConditionVariableData *getConditionVariableData() noexcept
returns the pointer to the ConditionVariableData
-
TriggerHandle() noexcept