CoreDX DDS Modern C++ API
|
The type specific DataReader. More...
Classes | |
class | ManipulatorSelector |
Selector class enabling the streaming API. More... | |
class | Selector |
The Selector class is used by the DataReader to compose read operations. More... | |
Public Member Functions | |
DataReader (const dds::sub::Subscriber &sub, const dds::topic::Topic< T > &topic) | |
Create a DataReader. More... | |
DataReader (const dds::sub::Subscriber &sub, const dds::topic::Topic< T > &topic, const dds::sub::qos::DataReaderQos &qos, dds::sub::DataReaderListener< T > *listener=NULL, const dds::core::status::StatusMask &mask=dds::core::status::StatusMask::none()) | |
Create a DataReader. More... | |
DataReader (const dds::sub::Subscriber &sub, const dds::topic::ContentFilteredTopic< T > &topic) | |
Create a DataReader for a ContentFilteredTopic. More... | |
DataReader (const dds::sub::Subscriber &sub, const dds::topic::ContentFilteredTopic< T > &topic, const dds::sub::qos::DataReaderQos &qos, dds::sub::DataReaderListener< T > *listener=NULL, const dds::core::status::StatusMask &mask=dds::core::status::StatusMask::none()) | |
Create a DataReader for a ContentFilteredTopic. More... | |
DataReader & | operator>> (dds::sub::qos::DataReaderQos &qos) |
Gets the DataReaderQos setting for this instance. More... | |
dds::sub::status::DataState | default_filter_state () |
Returns the default read-state (if not changed, it is set to ReaderState::any()). | |
DataReader & | default_filter_state (const dds::sub::status::DataState &state) |
Set the default state filter for read/take operations. More... | |
DataReader & | operator>> (dds::sub::LoanedSamples< T > &ls) |
This stream operator willl take samples and add them to the LoanedSamples container. More... | |
ManipulatorSelector | operator>> (ManipulatorSelector &(manipulator)(ManipulatorSelector &)) |
Manipulators are defined externally to make it possible to control whether the streaming operators reads or takes. More... | |
template<typename Functor > | |
ManipulatorSelector | operator>> (Functor f) |
Use this stream operator to control the behavior of the read or take streaming operation. More... | |
LoanedSamples< T > | read () |
Read all samples using the default filter state. More... | |
LoanedSamples< T > | take () |
Take all samples using the default filter state. More... | |
template<typename SamplesFWIterator > | |
uint32_t | read (SamplesFWIterator sfit, uint32_t max_samples) |
Read up to max_samples samples using the default filter state. More... | |
template<typename SamplesFWIterator > | |
uint32_t | take (SamplesFWIterator sfit, uint32_t max_samples) |
Take up to max_samples samples using the default filter state. More... | |
template<typename SamplesBIIterator > | |
uint32_t | read (SamplesBIIterator sbit) |
Read all samples available in the reader cache using the default filter state. More... | |
template<typename SamplesBIIterator > | |
uint32_t | take (SamplesBIIterator sbit) |
Take all samples available in the reader cache samples using the default filter state. More... | |
Selector | select () |
Get a Selector to perform complex data selections, such as per-instance selection, content and status filtering. More... | |
dds::topic::TopicInstance< T > | key_value (const dds::core::InstanceHandle &h) |
This operation can be used to retrieve the instance key that corresponds to an instance_handle. More... | |
T & | key_value (T &sample, const dds::core::InstanceHandle &h) |
This operation can be used to retrieve the instance key that corresponds to an instance_handle. More... | |
const dds::core::InstanceHandle | lookup_instance (const T &key) const |
This operation takes as a parameter an instance and returns a handle that can be used in subsequent operations that accept an instance handle as an argument. More... | |
void | listener (Listener *the_listener, const dds::core::status::StatusMask &event_mask) |
Set/Re-set the listener associated with this reader. More... | |
Listener * | listener () const |
Get the listener associated with this reader. | |
![]() | |
const dds::sub::Subscriber & | subscriber () const |
Get the Subscriber that owns this DataReader. More... | |
const dds::topic::TopicDescription & | topic_description () const |
Get the TopicDescription associated with this DataReader. More... | |
void | wait_for_historical_data (const dds::core::Duration &timeout) |
This operation will block the application thread until all “historical” data is received. More... | |
dds::sub::qos::DataReaderQos | qos () const |
Gets the DataReaderQos setting for this instance. More... | |
void | qos (const dds::sub::qos::DataReaderQos &qos) |
This operation replaces the existing set of QosPolicy settings for a DataReader. More... | |
AnyDataReader & | operator<< (const dds::sub::qos::DataReaderQos &qos) |
This operation replaces the existing set of QosPolicy settings for a DataReader. More... | |
const AnyDataReader & | operator>> (dds::sub::qos::DataReaderQos &qos) const |
Gets the DataReaderQos setting for this instance. More... | |
dds::core::status::LivelinessChangedStatus | liveliness_changed_status () |
This operation obtains the LivelinessChangedStatus object of the DataReader. More... | |
dds::core::status::SampleRejectedStatus | sample_rejected_status () |
This operation obtains the SampleRejectedStatus object of the DataReader. More... | |
dds::core::status::SampleLostStatus | sample_lost_status () |
This operation obtains the SampleLostStatus object of the DataReader. More... | |
dds::core::status::RequestedDeadlineMissedStatus | requested_deadline_missed_status () |
This operation obtains the RequestedDeadlineMissedStatus object of the DataReader. More... | |
dds::core::status::RequestedIncompatibleQosStatus | requested_incompatible_qos_status () |
This operation obtains the RequestedIncompatibleQosStatus object of the DataReader. More... | |
dds::core::status::SubscriptionMatchedStatus | subscription_matched_status () |
This operation obtains the SubscriptionMatchedStatus object of the DataReader. More... | |
![]() | |
void | enable () |
This operation enables the Entity. More... | |
const dds::core::status::StatusMask | status_changes () |
This operation retrieves the list of communication statuses in the Entity that are triggered.That is, the list of statuses whose value has changed since the last time the application read the status. More... | |
const dds::core::InstanceHandle | instance_handle () const |
This operation returns the InstanceHandle_t that represents the Entity. | |
void | close () |
This method closes the entity and releases all resources associated with DDS, such as threads, sockets, buffers, etc. More... | |
void | retain () |
Indicates that references to this object may go out of scope but that the application expects to look it up again later. More... | |
![]() | |
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... | |
Reference & | operator= (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... | |
The type specific DataReader.
dds::sub::DataReader< T, DELEGATE >::DataReader | ( | const dds::sub::Subscriber & | sub, |
const dds::topic::Topic< T > & | topic | ||
) |
Create a DataReader.
The QoS will be the same as "sub.default_datareader_qos()".
sub | the subscriber owning this DataReader. |
topic | the topic associated with this DataReader. |
dds::sub::DataReader< T, DELEGATE >::DataReader | ( | const dds::sub::Subscriber & | sub, |
const dds::topic::Topic< T > & | topic, | ||
const dds::sub::qos::DataReaderQos & | qos, | ||
dds::sub::DataReaderListener< T > * | listener = NULL , |
||
const dds::core::status::StatusMask & | mask = dds::core::status::StatusMask::none() |
||
) |
Create a DataReader.
sub | the subscriber owning this DataReader. |
topic | the topic associated with this DataReader. |
qos | the QoS settings for this DataReader. |
listener | the listener. |
mask | the event mask associated to the DataReader listener. |
dds::sub::DataReader< T, DELEGATE >::DataReader | ( | const dds::sub::Subscriber & | sub, |
const dds::topic::ContentFilteredTopic< T > & | topic | ||
) |
Create a DataReader for a ContentFilteredTopic.
This DataReader will only receive that data that mathes the Filter associated with the ContentFilteredTopic. The QoS will be set to sub.default_datareader_qos().
sub | the subscriber owning this DataReader. |
topic | the content filtered topic. |
dds::sub::DataReader< T, DELEGATE >::DataReader | ( | const dds::sub::Subscriber & | sub, |
const dds::topic::ContentFilteredTopic< T > & | topic, | ||
const dds::sub::qos::DataReaderQos & | qos, | ||
dds::sub::DataReaderListener< T > * | listener = NULL , |
||
const dds::core::status::StatusMask & | mask = dds::core::status::StatusMask::none() |
||
) |
Create a DataReader for a ContentFilteredTopic.
This DataReader will only receive that data that mathes the Filter associated with the ContentFilteredTopic.
sub | the subscriber owning this DataReader. |
topic | the content filtered topic. |
qos | the QoS settings for this DataReader. |
listener | the listener. |
mask | the event mask associated to the DataReader listener. |
DataReader< T, DELEGATE > & dds::sub::DataReader< T, DELEGATE >::default_filter_state | ( | const dds::sub::status::DataState & | state | ) |
Set the default state filter for read/take operations.
state | the state mask that will be used to read/take samples. |
dds::topic::TopicInstance< T > dds::sub::DataReader< T, DELEGATE >::key_value | ( | const dds::core::InstanceHandle & | h | ) |
This operation can be used to retrieve the instance key that corresponds to an instance_handle.
The operation will only fill the fields that form the key inside the key_holder instance. This operation may raise a BadParameter exception if the InstanceHandle does not correspond to an existing data-object known to the DataWriter. If the implementation is not able to check invalid handles, then the result in this situation is unspecified.
T & dds::sub::DataReader< T, DELEGATE >::key_value | ( | T & | sample, |
const dds::core::InstanceHandle & | h | ||
) |
This operation can be used to retrieve the instance key that corresponds to an instance_handle.
The operation will only fill the fields that form the key inside the key_holder instance. This operation may raise a BadParameter exception if the InstanceHandle does not correspond to an existing data-object known to the DataWriter. If the implementation is not able to check invalid handles, then the result in this situation is unspecified.
void dds::sub::DataReader< T, DELEGATE >::listener | ( | Listener * | the_listener, |
const dds::core::status::StatusMask & | event_mask | ||
) |
Set/Re-set the listener associated with this reader.
the_listener | the listener. |
event_mask | the event mask associated with the listener. |
const dds::core::InstanceHandle dds::sub::DataReader< T, DELEGATE >::lookup_instance | ( | const T & | key | ) | const |
This operation takes as a parameter an instance and returns a handle that can be used in subsequent operations that accept an instance handle as an argument.
The instance parameter is only used for the purpose of examining the fields that define the key. This operation does not register the instance in question. If the instance has not been previously registered, or if for any other reason the Service is unable to provide an instance handle, the Service will return a TopicInstance whose handle will be set to the HANDLE_NIL value.
DataReader< T, DELEGATE > & dds::sub::DataReader< T, DELEGATE >::operator>> | ( | dds::sub::qos::DataReaderQos & | qos | ) |
Gets the DataReaderQos setting for this instance.
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. |
DataReader< T, DELEGATE > & dds::sub::DataReader< T, DELEGATE >::operator>> | ( | dds::sub::LoanedSamples< T > & | ls | ) |
This stream operator willl take samples and add them to the LoanedSamples container.
For example:
In order to 'read' the samples instead of 'take', use the 'dds::sub::read' stream manipulator. For example:
DataReader< T, DELEGATE >::ManipulatorSelector dds::sub::DataReader< T, DELEGATE >::operator>> | ( | ManipulatorSelector & | manipulator)(ManipulatorSelector & | ) |
Manipulators are defined externally to make it possible to control whether the streaming operators reads or takes.
For example:
Without a 'dds::sub::read' or 'dds::sub::take' manipulator, the default operation is 'take'.
manipulator | Either 'read' or 'take' |
DataReader< T, DELEGATE >::ManipulatorSelector dds::sub::DataReader< T, DELEGATE >::operator>> | ( | Functor | f | ) |
Use this stream operator to control the behavior of the read or take streaming operation.
This supports the application of the following defined ManipulatorSelectors:
For example:
LoanedSamples< T > dds::sub::DataReader< T, DELEGATE >::read | ( | ) |
Read all samples using the default filter state.
The memory used for storing the sample may be loaned by the middleware thus allowing zero copy operations. Implementation should strive to make this read implementation exception safe.
uint32_t dds::sub::DataReader< T, DELEGATE >::read | ( | SamplesFWIterator | sfit, |
uint32_t | max_samples | ||
) |
Read up to max_samples samples using the default filter state.
The samples are copied into the application provided container using the forward iterator parameter.
sfit | samples forward iterator |
max_samples | the maximum number of samples to read |
uint32_t dds::sub::DataReader< T, DELEGATE >::read | ( | SamplesBIIterator | sbit | ) |
Read all samples available in the reader cache using the default filter state.
The samples are copied into the application provided container using a back-inserting iterator. Notice that as a consequence of using a back-inserting iterator, this operation may allocate memory to resize the underlying container.
sbit | samples back-inserting iterator. |
DataReader< T, DELEGATE >::Selector dds::sub::DataReader< T, DELEGATE >::select | ( | ) |
Get a Selector to perform complex data selections, such as per-instance selection, content and status filtering.
The selector can be used as follows:
dr.select() .instance(handle) .content(query) .state(state) .take(sbit);
This shows how samples can be taken by selecting a specific instance, then filtering by state and content.
LoanedSamples< T > dds::sub::DataReader< T, DELEGATE >::take | ( | ) |
Take all samples using the default filter state.
The memory used for storing the sample may be loaned by the middleware thus allowing zero copy operations. Implementation should strive to make this read implementation exception safe.
uint32_t dds::sub::DataReader< T, DELEGATE >::take | ( | SamplesFWIterator | sfit, |
uint32_t | max_samples | ||
) |
Take up to max_samples samples using the default filter state.
The samples are copied into the application provided container using the forward iterator parameter.
sfit | samples forward iterator. |
max_samples | the maximum number of samples to take. |
uint32_t dds::sub::DataReader< T, DELEGATE >::take | ( | SamplesBIIterator | sbit | ) |
Take all samples available in the reader cache samples using the default filter state.
The samples are copied into the application provided container using a back-inserting iterator. Notice that as a consequence of using a back-inserting iterator, this operation may allocate memory to resize the underlying container.
sbit | samples back-inserting iterator. |