Skip to content

iox::popo::WaitSet🔗

Logical disjunction of a certain number of Triggers. More...

#include <iceoryx_posh/popo/wait_set.hpp>

Public Types🔗

Name
using cxx::optional< Trigger >[Capacity] TriggerArray
using cxx::vector< const NotificationInfo *, CAPACITY > NotificationInfoVector

Public Functions🔗

Name
WaitSet()
~WaitSet()
WaitSet(const WaitSet & rhs)
all the Trigger have a pointer pointing to this waitset for cleanup calls, therefore the WaitSet cannot be moved
WaitSet(WaitSet && rhs)
WaitSet & operator=(const WaitSet & rhs)
WaitSet & operator=(WaitSet && rhs)
void markForDestruction()
Non-reversible call. After this call wait() and timedWait() do not block any longer and never return triggered events/states. This method can be used to manually initialize destruction and to wakeup any thread which is waiting in wait() or timedWait().
template <typename T ,typename EventType ,typename ContextDataType =internal::NoType_t,typename =std::enable_if_t::value>>
cxx::expected< WaitSetError >
attachEvent(T & eventOrigin, const EventType eventType, const uint64_t notificationId =0U, const NotificationCallback< T, ContextDataType > & eventCallback ={})
attaches an event of a given class to the WaitSet.
template <typename T ,typename EventType ,typename ContextDataType =internal::NoType_t,typename =std::enable_if_t::value, void>>
cxx::expected< WaitSetError >
attachEvent(T & eventOrigin, const EventType eventType, const NotificationCallback< T, ContextDataType > & eventCallback)
attaches an event of a given class to the WaitSet.
template <typename T ,typename ContextDataType =internal::NoType_t>
cxx::expected< WaitSetError >
attachEvent(T & eventOrigin, const uint64_t notificationId =0U, const NotificationCallback< T, ContextDataType > & eventCallback ={})
attaches an event of a given class to the WaitSet.
template <typename T ,typename ContextDataType =internal::NoType_t>
cxx::expected< WaitSetError >
attachEvent(T & eventOrigin, const NotificationCallback< T, ContextDataType > & eventCallback)
attaches an event of a given class to the WaitSet.
template <typename T ,typename StateType ,typename ContextDataType =internal::NoType_t,typename =std::enable_if_t::value>>
cxx::expected< WaitSetError >
attachState(T & stateOrigin, const StateType stateType, const uint64_t id =0U, const NotificationCallback< T, ContextDataType > & stateCallback ={})
attaches a state of a given class to the WaitSet.
template <typename T ,typename StateType ,typename ContextDataType =internal::NoType_t,typename =std::enable_if_t::value, void>>
cxx::expected< WaitSetError >
attachState(T & stateOrigin, const StateType stateType, const NotificationCallback< T, ContextDataType > & stateCallback)
attaches a state of a given class to the WaitSet.
template <typename T ,typename ContextDataType =internal::NoType_t>
cxx::expected< WaitSetError >
attachState(T & stateOrigin, const uint64_t id =0U, const NotificationCallback< T, ContextDataType > & stateCallback ={})
attaches a state of a given class to the WaitSet.
template <typename T ,typename ContextDataType =internal::NoType_t>
cxx::expected< WaitSetError >
attachState(T & stateOrigin, const NotificationCallback< T, ContextDataType > & stateCallback)
attaches a state of a given class to the WaitSet.
template <typename T ,typename... Targs>
void
detachEvent(T & eventOrigin, const Targs &... args)
detaches an event from the WaitSet
template <typename T ,typename... Targs>
void
detachState(T & stateOrigin, const Targs &... args)
detaches a state based trigger from the WaitSet
NotificationInfoVector timedWait(const units::Duration timeout)
Blocking wait with time limit till one or more of the triggers are triggered.
NotificationInfoVector wait()
Blocking wait till one or more of the triggers are triggered.
uint64_t size() const
Returns the amount of stored Trigger inside of the WaitSet.
constexpr uint64_t capacity()
returns the maximum amount of triggers which can be acquired from a waitset

Protected Functions🔗

Name
WaitSet(ConditionVariableData & condVarData)

Public Attributes🔗

Name
constexpr uint64_t CAPACITY

Detailed Description🔗

template <uint64_t Capacity =MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET>
class iox::popo::WaitSet;

Logical disjunction of a certain number of Triggers.

Parameters:

  • Capacity the amount of events/states which can be attached to the waitset

The WaitSet stores Triggers and allows the user to wait till one or more of those Triggers are triggered. It works over process borders. With the creation of a WaitSet it requests a condition variable from RouDi and destroys it with the destructor. Hence the lifetime of the condition variable is bound to the lifetime of the WaitSet.

Public Types Documentation🔗

using TriggerArray🔗

using iox::popo::WaitSet< Capacity >::TriggerArray =  cxx::optional<Trigger>[Capacity];

using NotificationInfoVector🔗

using iox::popo::WaitSet< Capacity >::NotificationInfoVector =  cxx::vector<const NotificationInfo*, CAPACITY>;

Public Functions Documentation🔗

function WaitSet🔗

WaitSet()

function ~WaitSet🔗

~WaitSet()

function WaitSet🔗

WaitSet(
    const WaitSet & rhs
)

all the Trigger have a pointer pointing to this waitset for cleanup calls, therefore the WaitSet cannot be moved

function WaitSet🔗

WaitSet(
    WaitSet && rhs
)

function operator=🔗

WaitSet & operator=(
    const WaitSet & rhs
)

function operator=🔗

WaitSet & operator=(
    WaitSet && rhs
)

function markForDestruction🔗

void markForDestruction()

Non-reversible call. After this call wait() and timedWait() do not block any longer and never return triggered events/states. This method can be used to manually initialize destruction and to wakeup any thread which is waiting in wait() or timedWait().

function attachEvent🔗

template <typename T ,
typename EventType ,
typename ContextDataType  =internal::NoType_t,
typename  =std::enable_if_t<std::is_enum<EventType>::value>>
cxx::expected< WaitSetError > attachEvent(
    T & eventOrigin,
    const EventType eventType,
    const uint64_t notificationId =0U,
    const NotificationCallback< T, ContextDataType > & eventCallback ={}
)

attaches an event of a given class to the WaitSet.

Parameters:

  • eventOrigin the class from which the event originates.
  • eventType the event specified by the class
  • notificationId an arbitrary user defined id for the event
  • eventCallback a callback which should be assigned to the event

Note: attachEvent does not take ownership of callback in the underlying eventCallback or the optional contextData. The user has to ensure that both will live as long as the event is attached.

function attachEvent🔗

template <typename T ,
typename EventType ,
typename ContextDataType  =internal::NoType_t,
typename  =std::enable_if_t<std::is_enum<EventType>::value, void>>
cxx::expected< WaitSetError > attachEvent(
    T & eventOrigin,
    const EventType eventType,
    const NotificationCallback< T, ContextDataType > & eventCallback
)

attaches an event of a given class to the WaitSet.

Parameters:

  • eventOrigin the class from which the event originates.
  • eventType the event specified by the class
  • eventCallback a callback which should be assigned to the event

Note: attachEvent does not take ownership of callback in the underlying eventCallback or the optional contextData. The user has to ensure that both will live as long as the event is attached.

function attachEvent🔗

template <typename T ,
typename ContextDataType  =internal::NoType_t>
cxx::expected< WaitSetError > attachEvent(
    T & eventOrigin,
    const uint64_t notificationId =0U,
    const NotificationCallback< T, ContextDataType > & eventCallback ={}
)

attaches an event of a given class to the WaitSet.

Parameters:

  • eventOrigin the class from which the event originates.
  • notificationId an arbitrary user defined id for the event
  • eventCallback a callback which should be assigned to the event

Note: attachEvent does not take ownership of callback in the underlying eventCallback or the optional contextData. The user has to ensure that both will live as long as the event is attached.

function attachEvent🔗

template <typename T ,
typename ContextDataType  =internal::NoType_t>
cxx::expected< WaitSetError > attachEvent(
    T & eventOrigin,
    const NotificationCallback< T, ContextDataType > & eventCallback
)

attaches an event of a given class to the WaitSet.

Parameters:

  • eventOrigin the class from which the event originates.
  • eventCallback a callback which should be assigned to the event

Note: attachEvent does not take ownership of callback in the underlying eventCallback or the optional contextData. The user has to ensure that both will live as long as the event is attached.

function attachState🔗

template <typename T ,
typename StateType ,
typename ContextDataType  =internal::NoType_t,
typename  =std::enable_if_t<std::is_enum<StateType>::value>>
cxx::expected< WaitSetError > attachState(
    T & stateOrigin,
    const StateType stateType,
    const uint64_t id =0U,
    const NotificationCallback< T, ContextDataType > & stateCallback ={}
)

attaches a state of a given class to the WaitSet.

Parameters:

  • stateOrigin the class from which the state originates.
  • stateType the state specified by the class
  • id an arbitrary user defined id for the state
  • stateCallback a callback which should be assigned to the state

Note: attachState does not take ownership of callback in the underlying stateCallback or the optional contextData. The user has to ensure that both will live as long as the state is attached.

function attachState🔗

template <typename T ,
typename StateType ,
typename ContextDataType  =internal::NoType_t,
typename  =std::enable_if_t<std::is_enum<StateType>::value, void>>
cxx::expected< WaitSetError > attachState(
    T & stateOrigin,
    const StateType stateType,
    const NotificationCallback< T, ContextDataType > & stateCallback
)

attaches a state of a given class to the WaitSet.

Parameters:

  • stateOrigin the class from which the state originates.
  • stateType the state specified by the class
  • stateCallback a callback which should be assigned to the state

Note: attachState does not take ownership of callback in the underlying stateCallback or the optional contextData. The user has to ensure that both will live as long as the state is attached.

function attachState🔗

template <typename T ,
typename ContextDataType  =internal::NoType_t>
cxx::expected< WaitSetError > attachState(
    T & stateOrigin,
    const uint64_t id =0U,
    const NotificationCallback< T, ContextDataType > & stateCallback ={}
)

attaches a state of a given class to the WaitSet.

Parameters:

  • stateOrigin the class from which the state originates.
  • id an arbitrary user defined id for the state
  • stateCallback a callback which should be assigned to the state

Note: attachState does not take ownership of callback in the underlying stateCallback or the optional contextData. The user has to ensure that both will live as long as the state is attached.

function attachState🔗

template <typename T ,
typename ContextDataType  =internal::NoType_t>
cxx::expected< WaitSetError > attachState(
    T & stateOrigin,
    const NotificationCallback< T, ContextDataType > & stateCallback
)

attaches a state of a given class to the WaitSet.

Parameters:

  • stateOrigin the class from which the state originates.
  • stateCallback a callback which should be assigned to the state

Note: attachState does not take ownership of callback in the underlying stateCallback or the optional contextData. The user has to ensure that both will live as long as the state is attached.

function detachEvent🔗

template <typename T ,
typename... Targs>
void detachEvent(
    T & eventOrigin,
    const Targs &... args
)

detaches an event from the WaitSet

Parameters:

  • eventOrigin the origin of the event that should be detached
  • args... additional event identifying arguments

function detachState🔗

template <typename T ,
typename... Targs>
void detachState(
    T & stateOrigin,
    const Targs &... args
)

detaches a state based trigger from the WaitSet

Parameters:

  • stateOrigin the origin of the state that should be detached
  • args... additional state identifying arguments

function timedWait🔗

NotificationInfoVector timedWait(
    const units::Duration timeout
)

Blocking wait with time limit till one or more of the triggers are triggered.

Parameters:

  • timeout How long shall we waite for a trigger

Return: NotificationInfoVector of NotificationInfos that have been triggered

function wait🔗

NotificationInfoVector wait()

Blocking wait till one or more of the triggers are triggered.

Return: NotificationInfoVector of NotificationInfos that have been triggered

function size🔗

uint64_t size() const

Returns the amount of stored Trigger inside of the WaitSet.

function capacity🔗

static constexpr uint64_t capacity()

returns the maximum amount of triggers which can be acquired from a waitset

Protected Functions Documentation🔗

function WaitSet🔗

explicit WaitSet(
    ConditionVariableData & condVarData
)

Public Attributes Documentation🔗

variable CAPACITY🔗

static constexpr uint64_t CAPACITY = Capacity;

Updated on 2 April 2022 at 16:37:47 CEST