iceoryx_posh 2.0.5
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
iox::popo::WaitSet< Capacity > Class Template Reference

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

#include <iceoryx_posh/popo/wait_set.hpp>

Public Types

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

Public Member Functions

 WaitSet (const WaitSet &rhs)=delete
 all the Trigger have a pointer pointing to this waitset for cleanup calls, therefore the WaitSet cannot be moved
 
 WaitSet (WaitSet &&rhs)=delete
 
WaitSetoperator= (const WaitSet &rhs)=delete
 
WaitSetoperator= (WaitSet &&rhs)=delete
 
void markForDestruction () noexcept
 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<std::is_enum<EventType>::value>>
cxx::expected< WaitSetError > attachEvent (T &eventOrigin, const EventType eventType, const uint64_t notificationId=0U, const NotificationCallback< T, ContextDataType > &eventCallback={}) noexcept
 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<std::is_enum<EventType>::value, void>>
cxx::expected< WaitSetError > attachEvent (T &eventOrigin, const EventType eventType, const NotificationCallback< T, ContextDataType > &eventCallback) noexcept
 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={}) noexcept
 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) noexcept
 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<std::is_enum<StateType>::value>>
cxx::expected< WaitSetError > attachState (T &stateOrigin, const StateType stateType, const uint64_t id=0U, const NotificationCallback< T, ContextDataType > &stateCallback={}) noexcept
 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<std::is_enum<StateType>::value, void>>
cxx::expected< WaitSetError > attachState (T &stateOrigin, const StateType stateType, const NotificationCallback< T, ContextDataType > &stateCallback) noexcept
 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={}) noexcept
 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) noexcept
 attaches a state of a given class to the WaitSet.
 
template<typename T , typename... Targs>
void detachEvent (T &eventOrigin, const Targs &... args) noexcept
 detaches an event from the WaitSet
 
template<typename T , typename... Targs>
void detachState (T &stateOrigin, const Targs &... args) noexcept
 detaches a state based trigger from the WaitSet
 
NotificationInfoVector timedWait (const units::Duration timeout) noexcept
 Blocking wait with time limit till one or more of the triggers are triggered.
 
NotificationInfoVector wait () noexcept
 Blocking wait till one or more of the triggers are triggered.
 
uint64_t size () const noexcept
 Returns the amount of stored Trigger inside of the WaitSet.
 

Static Public Member Functions

static constexpr uint64_t capacity () noexcept
 returns the maximum amount of triggers which can be acquired from a waitset
 

Static Public Attributes

static constexpr uint64_t CAPACITY = Capacity
 

Protected Member Functions

 WaitSet (ConditionVariableData &condVarData) noexcept
 

Detailed Description

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

Logical disjunction of a certain number of Triggers.

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.

Parameters
[in]Capacitythe amount of events/states which can be attached to the waitset

Member Function Documentation

◆ attachEvent() [1/4]

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

attaches an event of a given class to the WaitSet.

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.
Parameters
[in]eventOriginthe class from which the event originates.
[in]eventTypethe event specified by the class
[in]eventCallbacka callback which should be assigned to the event

◆ attachEvent() [2/4]

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

attaches an event of a given class to the WaitSet.

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.
Parameters
[in]eventOriginthe class from which the event originates.
[in]eventTypethe event specified by the class
[in]notificationIdan arbitrary user defined id for the event
[in]eventCallbacka callback which should be assigned to the event

◆ attachEvent() [3/4]

template<uint64_t Capacity = MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET>
template<typename T , typename ContextDataType = internal::NoType_t>
cxx::expected< WaitSetError > iox::popo::WaitSet< Capacity >::attachEvent ( T eventOrigin,
const NotificationCallback< T, ContextDataType > &  eventCallback 
)
noexcept

attaches an event of a given class to the WaitSet.

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.
Parameters
[in]eventOriginthe class from which the event originates.
[in]eventCallbacka callback which should be assigned to the event

◆ attachEvent() [4/4]

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

attaches an event of a given class to the WaitSet.

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.
Parameters
[in]eventOriginthe class from which the event originates.
[in]notificationIdan arbitrary user defined id for the event
[in]eventCallbacka callback which should be assigned to the event

◆ attachState() [1/4]

template<uint64_t Capacity = MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET>
template<typename T , typename ContextDataType = internal::NoType_t>
cxx::expected< WaitSetError > iox::popo::WaitSet< Capacity >::attachState ( T stateOrigin,
const NotificationCallback< T, ContextDataType > &  stateCallback 
)
noexcept

attaches a state of a given class to the WaitSet.

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.
Parameters
[in]stateOriginthe class from which the state originates.
[in]stateCallbacka callback which should be assigned to the state

◆ attachState() [2/4]

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

attaches a state of a given class to the WaitSet.

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.
Parameters
[in]stateOriginthe class from which the state originates.
[in]stateTypethe state specified by the class
[in]stateCallbacka callback which should be assigned to the state

◆ attachState() [3/4]

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

attaches a state of a given class to the WaitSet.

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.
Parameters
[in]stateOriginthe class from which the state originates.
[in]stateTypethe state specified by the class
[in]idan arbitrary user defined id for the state
[in]stateCallbacka callback which should be assigned to the state

◆ attachState() [4/4]

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

attaches a state of a given class to the WaitSet.

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.
Parameters
[in]stateOriginthe class from which the state originates.
[in]idan arbitrary user defined id for the state
[in]stateCallbacka callback which should be assigned to the state

◆ detachEvent()

template<uint64_t Capacity = MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET>
template<typename T , typename... Targs>
void iox::popo::WaitSet< Capacity >::detachEvent ( T eventOrigin,
const Targs &...  args 
)
noexcept

detaches an event from the WaitSet

Parameters
[in]eventOriginthe origin of the event that should be detached
[in]args...additional event identifying arguments

◆ detachState()

template<uint64_t Capacity = MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET>
template<typename T , typename... Targs>
void iox::popo::WaitSet< Capacity >::detachState ( T stateOrigin,
const Targs &...  args 
)
noexcept

detaches a state based trigger from the WaitSet

Parameters
[in]stateOriginthe origin of the state that should be detached
[in]args...additional state identifying arguments

◆ timedWait()

template<uint64_t Capacity = MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET>
NotificationInfoVector iox::popo::WaitSet< Capacity >::timedWait ( const units::Duration  timeout)
noexcept

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

Parameters
[in]timeoutHow long shall we waite for a trigger
Returns
NotificationInfoVector of NotificationInfos that have been triggered

◆ wait()

template<uint64_t Capacity = MAX_NUMBER_OF_ATTACHMENTS_PER_WAITSET>
NotificationInfoVector iox::popo::WaitSet< Capacity >::wait ( )
noexcept

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

Returns
NotificationInfoVector of NotificationInfos that have been triggered

The documentation for this class was generated from the following file: