CoreDX DDS Modern C++ API
Public Member Functions | List of all members
dds::sub::cond::ReadCondition Class Reference

ReadCondition objects are conditions specifically dedicated to read operations and attached to one DataReader. More...

Inheritance diagram for dds::sub::cond::ReadCondition:
Inheritance graph
[legend]
Collaboration diagram for dds::sub::cond::ReadCondition:
Collaboration graph
[legend]

Public Member Functions

 ReadCondition (const dds::sub::AnyDataReader &dr, const dds::sub::status::DataState &status)
 Create a dds::sub::cond::ReadCondition associated with a DataReader. More...
 
template<typename FUN >
 ReadCondition (const dds::sub::AnyDataReader &dr, const dds::sub::status::DataState &status, FUN &functor)
 Create a dds::sub::cond::ReadCondition associated with a DataReader. More...
 
template<typename FUN >
 ReadCondition (const dds::sub::AnyDataReader &dr, const dds::sub::status::DataState &status, const FUN &functor)
 Create a dds::sub::cond::ReadCondition associated with a DataReader. More...
 
const dds::sub::status::DataState state_filter () const
 This operation returns the set of data-states that are taken into account to determine the trigger_value of the ReadCondition. More...
 
const dds::sub::AnyDataReaderdata_reader () const
 This operation returns the DataReader associated with the ReadCondition. More...
 
- Public Member Functions inherited from dds::core::cond::Condition
template<typename Functor >
void handler (Functor &func)
 Registers a functor as custom handler with this Condition. More...
 
template<typename Functor >
void handler (const Functor &func)
 Registers a functor as custom handler with this Condition. More...
 
void reset_handler ()
 Resets the handler for this Condition. More...
 
void dispatch ()
 Dispatches the functors that have been registered with the condition, if the condition is in the 'triggered' state. More...
 
bool trigger_value () const
 This operation retrieves the trigger_value of the Condition.
 
- Public Member Functions inherited from dds::core::Reference< DELEGATE >
 Reference (dds::core::null_type &)
 Creates a "null" reference.
 
 Reference (const Reference &ref)
 Creates a reference from another. More...
 
template<typename D >
 Reference (const Reference< D > &ref)
 Enables safe assignment from other reference types. More...
 
 Reference (DELEGATE_T *p)
 The following two constructors create a dds Reference from a vendor specific delegate. More...
 
 ~Reference ()
 Destroys a reference.
 
template<typename R >
bool operator== (const R &ref) const
 Compares two reference objects and returns true if they are equal. More...
 
template<typename R >
bool operator!= (const R &ref) const
 Compares two reference objects and returns true if they are not-equal. More...
 
Referenceoperator= (const null_type)
 Special assignment operators that takes care of assigning null to this reference. More...
 
bool is_nil () const
 Returns true if this reference object is nil, meaning pointing to null.
 
bool operator== (const null_type) const
 Special operator== used to check if this reference object equals the null reference. More...
 
bool operator!= (const null_type nil) const
 Special operator!= used to check if this reference object does not equals the null reference. More...
 
const DELEGATE_REF_T & delegate () const
 Returns a reference to the underlying delegate. More...
 
DELEGATE_REF_T & delegate ()
 Returns a reference to the underlying delegate. More...
 
DELEGATE * operator-> ()
 The operator->() is provided to be able to directly invoke methods on the delegate. More...
 
const DELEGATE * operator-> () const
 The operator->() is provided to be able to directly invoke methods on the delegate. More...
 

Detailed Description

ReadCondition objects are conditions specifically dedicated to read operations and attached to one DataReader.


ReadCondition objects allow an application to specify the data samples it is interested in (by specifying the desired sample states, view states, and instance states). See the parameter definitions for DataReader's read/take operations.) This allows the middleware to enable the condition only when suitable information is available. They are to be used in conjunction with a WaitSet as normal conditions. More than one ReadCondition may be attached to the same DataReader.

Constructor & Destructor Documentation

◆ ReadCondition() [1/3]

dds::sub::cond::ReadCondition::ReadCondition ( const dds::sub::AnyDataReader dr,
const dds::sub::status::DataState status 
)

Create a dds::sub::cond::ReadCondition associated with a DataReader.

The ReadCondition can then be added to a dds::core::cond::WaitSet so that the application can wait for specific status changes that affect the Entity.

State Masks.
The result of the ReadCondition depends on the selection of samples determined by three masks:

  • DataState::sample_state() is the mask, which selects only those samples with the desired sample states SampleState::read(), SampleState::not_read() or SampleState::any().
  • DataState::view_state() is the mask, which selects only those samples with the desired view states ViewState::new_view(), ViewState::not_new_view() or ViewState::any().
  • DataState::instance_state() is the mask, which selects only those samples with the desired view states InstanceState::alive(), InstanceState::not_alive_disposed(), InstanceState::not_alive_no_writers(), InstanceState::not_alive_mask() or InstanceState::any().
Parameters
drThe DataReader to associate with the ReadCondition.
statusA mask, which selects only those samples with the desired sample/view/instance states.
Exceptions
dds::core::Exception

◆ ReadCondition() [2/3]

template<typename FUN >
dds::sub::cond::ReadCondition::ReadCondition ( const dds::sub::AnyDataReader dr,
const dds::sub::status::DataState status,
FUN &  functor 
)

Create a dds::sub::cond::ReadCondition associated with a DataReader.

The ReadCondition can then be added to a dds::core::cond::WaitSet so that the application can wait for specific status changes that affect the Entity.

The supplied functor will be called when this ReadCondition 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 ReadCondition is attached to.

Parameters
drThe DataReader to associate with the ReadCondition.
statusA mask, which selects only those samples with the desired sample/view/instance states.
functorThe functor to be called when the ReadCondition triggers.
Exceptions
dds::core::Exception

◆ ReadCondition() [3/3]

template<typename FUN >
dds::sub::cond::ReadCondition::ReadCondition ( const dds::sub::AnyDataReader dr,
const dds::sub::status::DataState status,
const FUN &  functor 
)

Create a dds::sub::cond::ReadCondition associated with a DataReader.

The ReadCondition can then be added to a dds::core::cond::WaitSet so that the application can wait for specific status changes that affect the Entity.

The supplied functor will be called when this ReadCondition 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 ReadCondition is attached to.

Parameters
drThe DataReader to associate with the ReadCondition.
statusA mask, which selects only those samples with the desired sample/view/instance states.
functorThe const functor to be called when the ReadCondition triggers.
Exceptions
dds::core::Exception

Member Function Documentation

◆ data_reader()

const dds::sub::AnyDataReader& dds::sub::cond::ReadCondition::data_reader ( ) const

This operation returns the DataReader associated with the ReadCondition.

Note that there is exactly one DataReader associated with each ReadCondition.

Returns
dds::sub::AnyDataReader The associated DataReader
Exceptions
dds::core::Exception

◆ state_filter()

const dds::sub::status::DataState dds::sub::cond::ReadCondition::state_filter ( ) const

This operation returns the set of data-states that are taken into account to determine the trigger_value of the ReadCondition.

These are data-states specified when the ReadCondition was created.

Returns
dds::sub::status::DataState The data state.
Exceptions
dds::core::Exception

© 2009-2020 Twin Oaks Computing, Inc
Castle Rock, CO 80104
All rights reserved.