Template Class TGuardCondition
Defined in File GuardCondition.hpp
Inheritance Relationships
Base Type
public dds::core::cond::TCondition< DELEGATE >
(Template Class TCondition)
Class Documentation
-
template<typename DELEGATE>
class TGuardCondition : public dds::core::cond::TCondition<DELEGATE> A GuardCondition object is a specific Condition whose trigger_value is completely under the control of the application.
When a GuardCondition is initially created, the trigger_value is FALSE.
The purpose of the GuardCondition is to provide the means for the application to manually triggering a WaitSet to stop waiting. This is accomplished by attaching the GuardCondition to the WaitSet and then setting the trigger_value by means of the set trigger_value operation.
See the WaitSet examplesdds::core::cond::GuardCondition guard; dds::core::cond::WaitSet waitset; waitset.attach_condition(guard); waitset.wait(); ... // To wakeup waitset, do in another thread: guard.trigger_value(true);
for more examples.
Although the WaitSet examples use the StatusCondition, the basic usage of this Condition with a WaitSet is the same.
See also
dds::core::cond::Condition
See also
WaitSet concept
See also
Public Functions
- OMG_DDS_REF_TYPE_NO_DC (TGuardCondition, TCondition, DELEGATE) OMG_DDS_EXPLICIT_REF_BASE(TGuardCondition
-
dds::core::cond::Condition TGuardCondition()
Create a dds::core::cond::GuardCondition.
The GuardCondition can then be added to a dds::core::cond::WaitSet so that the application can manually wake up a thread that is blocked on that WaitSet.
- Throws:
dds::core::Exception –
-
template<typename FUN>
TGuardCondition(FUN &functor) Create a dds::core::cond::GuardCondition.
The GuardCondition can then be added to a dds::core::cond::WaitSet so that the application can manually wake up a thread that is blocked on that WaitSet.
The supplied functor will be called when this GuardCondition is triggered and either the inherited dds::core::cond::Condition::dispatch() is called or the dds::core::cond::WaitSet::dispatch() on the WaitSet to which this GuardCondition is attached to.
- Template Parameters:
functor – The functor to be called when the GuardCondition triggers.
- Throws:
dds::core::Exception –
-
template<typename FUN>
TGuardCondition(const FUN &functor) Create a dds::core::cond::GuardCondition.
The GuardCondition can then be added to a dds::core::cond::WaitSet so that the application can manually wake up a thread that is blocked on that WaitSet.
The supplied functor will be called when this GuardCondition is triggered and either the inherited dds::core::cond::Condition::dispatch() is called or the dds::core::cond::WaitSet::dispatch() on the WaitSet to which this GuardCondition is attached to.
- Template Parameters:
functor – The functor to be called when the GuardCondition triggers.
- Throws:
dds::core::Exception –
-
void trigger_value(bool value)
This operation sets the trigger_value of the GuardCondition.
A GuardCondition object is a specific Condition which trigger_value is completely under the control of the application. This operation must be used by the application to manually wake-up a WaitSet. This operation sets the trigger_value of the GuardCondition to the parameter value. The GuardCondition is directly created using the GuardCondition constructor. When a GuardCondition is initially created, the trigger_value is FALSE.
- Parameters:
value – The boolean value to which the GuardCondition is set.
- Throws:
dds::core::Exception –
-
bool trigger_value()
This operation retrieves the trigger_value of the Condition.
A Condition has a trigger_value that can be TRUE or FALSE and is set by the Data Distribution Service (except a GuardCondition). This operation returns the trigger_value of the Condition.
- Throws:
dds::core::Exception –
- Returns:
bool The boolean value to which the Condition is set.