Skip to content

iox::popo::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.

#include <trigger_handle.hpp>

Public Functions🔗

Name
TriggerHandle() =default
TriggerHandle(ConditionVariableData & conditionVariableData, const cxx::MethodCallback< void, uint64_t > resetCallback, const uint64_t uniqueTriggerId)
Creates a TriggerHandle.
TriggerHandle(const TriggerHandle & )
TriggerHandle & operator=(const TriggerHandle & )
TriggerHandle(TriggerHandle && rhs)
TriggerHandle & operator=(TriggerHandle && rhs)
~TriggerHandle()
operator bool() const
returns true if the TriggerHandle is valid otherwise false. A TriggerHandle is valid if m_conditionVariableDataPtr != nullptr.
bool isValid() const
returns true if the TriggerHandle is valid otherwise false. A TriggerHandle is valid if m_conditionVariableDataPtr != nullptr.
bool wasTriggered() const
Returns true when the TriggerHandle was triggered.
void trigger()
triggers the Trigger and informs the Notifyable which verifies that the Trigger was triggered by calling the hasTriggeredCallback
void reset()
calls the resetCallback and invalidates the TriggerHandle
void invalidate()
invalidates the TriggerHandle without calling the reset callback
uint64_t getUniqueId() const
returns the uniqueTriggerId
ConditionVariableData * getConditionVariableData()
returns the pointer to the ConditionVariableData

Public Functions Documentation🔗

function TriggerHandle🔗

TriggerHandle() =default

function TriggerHandle🔗

TriggerHandle(
    ConditionVariableData & conditionVariableData,
    const cxx::MethodCallback< void, uint64_t > resetCallback,
    const uint64_t uniqueTriggerId
)

Creates a TriggerHandle.

Parameters:

  • conditionVariableDataRef reference to a condition variable data struct
  • resetCallback callback which will be called it goes out of scope or reset is called
  • uniqueTriggerId the unique trigger id of the Trigger which corresponds to the TriggerHandle. Usually stored in a Notifyable. It is required for the resetCallback

function TriggerHandle🔗

TriggerHandle(
    const TriggerHandle & 
)

function operator=🔗

TriggerHandle & operator=(
    const TriggerHandle & 
)

function TriggerHandle🔗

TriggerHandle(
    TriggerHandle && rhs
)

function operator=🔗

TriggerHandle & operator=(
    TriggerHandle && rhs
)

function ~TriggerHandle🔗

~TriggerHandle()

function operator bool🔗

explicit operator bool() const

returns true if the TriggerHandle is valid otherwise false. A TriggerHandle is valid if m_conditionVariableDataPtr != nullptr.

function isValid🔗

bool isValid() const

returns true if the TriggerHandle is valid otherwise false. A TriggerHandle is valid if m_conditionVariableDataPtr != nullptr.

function wasTriggered🔗

bool wasTriggered() const

Returns true when the TriggerHandle was triggered.

Note: The TriggerHandle wasTriggered state is set to false again after the underlying ConditionListener gathered all events.

function trigger🔗

void trigger()

triggers the Trigger and informs the Notifyable which verifies that the Trigger was triggered by calling the hasTriggeredCallback

function reset🔗

void reset()

calls the resetCallback and invalidates the TriggerHandle

function invalidate🔗

void invalidate()

invalidates the TriggerHandle without calling the reset callback

function getUniqueId🔗

uint64_t getUniqueId() const

returns the uniqueTriggerId

function getConditionVariableData🔗

ConditionVariableData * getConditionVariableData()

returns the pointer to the ConditionVariableData


Updated on 17 June 2021 at 11:15:27 CEST