![]() |
OpenSplice ISO C++ 2 DCPS
v6.x
ISO C++ 2 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
|
#include "DataReader.hpp"
Public Member Functions | |
| ManipulatorSelector (DataReader &dr) | |
| ManipulatorSelector & | content (const dds::sub::Query &query) |
| ManipulatorSelector & | instance (const dds::core::InstanceHandle &handle) |
| ManipulatorSelector & | max_samples (uint32_t n) |
| ManipulatorSelector & | next_instance (const dds::core::InstanceHandle &handle) |
| ManipulatorSelector & | operator>> (dds::sub::LoanedSamples< T > &samples) |
| ManipulatorSelector & | operator>> (ManipulatorSelector &(manipulator)(ManipulatorSelector &)) |
| template<typename Functor > | |
| ManipulatorSelector | operator>> (Functor f) |
| bool | read_mode () |
| void | read_mode (bool readmode) |
| ManipulatorSelector & | state (const dds::sub::status::DataState &state) |
The ManipulatorSelector class is used by the DataReader to compose streaming read operations.
A ManipulatorSelector can perform complex data selections, such as per-instance selection, content and status filtering, etc, when reading or taking samples through the streaming operator.
Convenience functors
The following convenience functors use a ManipulatorSelector implicitly and can be used in the streaming operator:
However, this will create and destroy ManipulatorSelectors and Functors for every read, which is not very performance friendly.
The performance can be increase by creating a ManipulatorSelector up front and doing the reading on that ManipulatorSelector directly and re-using it.
Defaults
| Element | Default Value |
|---|---|
| read_mode | true (read) |
| state | dds::sub::status::DataState::any |
| content | Empty dds::sub::Query |
| max_samples | dds::core::LENGTH_UNLIMITED |
| instance | dds::core::InstanceHandle nil |
Definition at line 508 of file DataReader.hpp.
| dds::sub::DataReader< T >::ManipulatorSelector::ManipulatorSelector | ( | DataReader & | dr | ) |
Construct a ManipulatorSelector for a DataReader.
See also DataReader stream operator>>
| DataReader |
Definition at line 176 of file DataReaderImpl.hpp.
| DataReader< T >::ManipulatorSelector & dds::sub::DataReader< T >::ManipulatorSelector::content | ( | const dds::sub::Query & | query | ) |
Set Query to filter with during the read or take.
Convenience Functor: dds::sub::content
Example
Read only samples that will be filtered according to the given dds::sub::Query.
See also DataReader stream operator>>
| query | The Query to apply to a read/take |
Definition at line 261 of file DataReaderImpl.hpp.
| DataReader< T >::ManipulatorSelector & dds::sub::DataReader< T >::ManipulatorSelector::instance | ( | const dds::core::InstanceHandle & | handle | ) |
Set InstanceHandle to filter with during the read or take.
Convenience Functor: dds::sub::instance
Example
Read only samples of the given instance.
See also DataReader stream operator>>
| handle | the InstanceHandle for the read/take |
Definition at line 198 of file DataReaderImpl.hpp.
| DataReader< T >::ManipulatorSelector & dds::sub::DataReader< T >::ManipulatorSelector::max_samples | ( | uint32_t | n | ) |
Set max_samples to limit the number of sample to get during the read or take.
Convenience Functor: dds::sub::max_samples
Example
Read a maximum of three samples.
See also DataReader stream operator>>
| n | maximum number of samples |
Definition at line 271 of file DataReaderImpl.hpp.
| DataReader< T >::ManipulatorSelector & dds::sub::DataReader< T >::ManipulatorSelector::next_instance | ( | const dds::core::InstanceHandle & | handle | ) |
Set next InstanceHandle to filter with during the read or take.
Convenience Functor: dds::sub::next_instance
Example
Read all samples, instance by instance.
See also DataReader stream operator>>
| handle | the 'previous' InstanceHandle associated with new the read/take |
Definition at line 208 of file DataReaderImpl.hpp.
| DataReader< T >::ManipulatorSelector & dds::sub::DataReader< T >::ManipulatorSelector::operator>> | ( | dds::sub::LoanedSamples< T > & | samples | ) |
This operation works the same as the DataReader stream operator>> , except that it is performed on this ManipulatorSelector with possible filters set.
| dds::core::Error | An internal error has occurred. |
| dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
| dds::core::AlreadyClosedError | The entity has already been closed. |
| dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
| dds::core::NotEnabledError | The DataReader has not yet been enabled. |
Definition at line 218 of file DataReaderImpl.hpp.
| DataReader< T >::ManipulatorSelector & dds::sub::DataReader< T >::ManipulatorSelector::operator>> | ( | ManipulatorSelector & | manipulator)(ManipulatorSelector & | ) |
This operation works the same as the DataReader stream operator>> , except that it is performed on this ManipulatorSelector with possible filters set.
| dds::core::Error | An internal error has occurred. |
| dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
| dds::core::AlreadyClosedError | The entity has already been closed. |
| dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
| dds::core::NotEnabledError | The DataReader has not yet been enabled. |
Definition at line 228 of file DataReaderImpl.hpp.
| ManipulatorSelector dds::sub::DataReader< T >::ManipulatorSelector::operator>> | ( | Functor | f | ) |
This operation works the same as the DataReader stream operator>> , except that it is performed on this ManipulatorSelector with possible filters set.
| dds::core::Error | An internal error has occurred. |
| dds::core::NullReferenceError | The entity was not properly created and references to dds::core::null. |
| dds::core::AlreadyClosedError | The entity has already been closed. |
| dds::core::OutOfResourcesError | The Data Distribution Service ran out of resources to complete this operation. |
| dds::core::NotEnabledError | The DataReader has not yet been enabled. |
| bool dds::sub::DataReader< T >::ManipulatorSelector::read_mode | ( | ) |
Get the read_mode.
The read_mode specifies if a sample should be read or taken:
Definition at line 180 of file DataReaderImpl.hpp.
| void dds::sub::DataReader< T >::ManipulatorSelector::read_mode | ( | bool | readmode | ) |
Set the read_mode.
The read_mode specifies if a sample should be read or taken:
Convenience Functor: dds::sub::read
Convenience Functor: dds::sub::take
Example
Determine to read or take samples.
See also DataReader stream operator>>
| readmode | the read mode of the DataReader |
Definition at line 189 of file DataReaderImpl.hpp.
| DataReader< T >::ManipulatorSelector & dds::sub::DataReader< T >::ManipulatorSelector::state | ( | const dds::sub::status::DataState & | state | ) |
Set DataState to filter with during the read or take.
Convenience Functor: dds::sub::state
Example
Read only new data.
See also DataReader stream operator>>
| state | the required DataState of the samples |
Definition at line 251 of file DataReaderImpl.hpp.