Class DataReader

Inheritance Relationships

Base Type

Class Documentation

class DataReader : public dds::core::TEntity<detail::DataReader>

A DataReader allows the application to declare the data it wishes to receive.

See also

Datareader

Public Types

typedef DataReaderListener Listener

Local convenience typedef for dds::pub::DataReaderListener.

Public Functions

OMG_DDS_REF_TYPE_PROTECTED_DC(DataReader, dds::core::TEntity, detail::DataReader) OMG_DDS_IMPLICIT_REF_BASE(DataReader) OMG_DDS_API DataReader(const dds OMG_DDS_API DataReader (const dds::sub::Subscriber &sub, const dds::topic::Topic &topic, const qos::DataReaderQos &qos, DataReaderListener *listener=NULL, const dds::core::status::StatusMask &mask=dds::core::status::StatusMask::none())

Create a new DataReader.

The DataReader will be created with the QoS values specified on the last successful call to sub.default_DataReader_qos(qos) or, if the call was never made, the default values.

The DataReader will be created with the given QosPolicy settings and if applicable, attaches the optionally specified DataReaderListener to it.

See listener for more information about listeners and possible status propagation to other entities.

Parameters:
  • sub – the subscriber

  • topic – the topic the DataReader will be listening.

  • sub – the subscriber to create the DataReader with.

  • topic – the topic the DataReader will be listening.

  • qos – a collection of QosPolicy settings for the new DataReader. In case these settings are not self consistent, no DataReader is created.

  • listener – the DataReader listener

  • mask – the mask of events notified to the listener

Throws:
  • dds::core::Error – An internal error has occurred.

  • dds::core::OutOfResourcesError – The Data Distribution Service ran out of resources to complete this operation. Create a new DataReader.

  • dds::core::Error – An internal error has occurred.

  • dds::core::OutOfResourcesError – The Data Distribution Service ran out of resources to complete this operation.

  • dds::core::InconsistentPolicyError – The parameter qos contains conflicting QosPolicy settings.

OMG_DDS_API const qos::DataReaderQos & qos () const

Gets the DataReaderQos setting for this instance.

Throws:
  • 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.

Returns:

the qos

OMG_DDS_API void qos (const qos::DataReaderQos &qos)

Sets the DataReaderQos setting for this instance.

Parameters:

qos – the qos

Throws:
  • 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.

OMG_DDS_API DataReader & operator<< (const qos::DataReaderQos &qos)
OMG_DDS_API DataReader & operator>> (qos::DataReaderQos &qos)
OMG_DDS_API void listener (Listener *plistener, const dds::core::status::StatusMask &mask)

Register a listener with the DataReader.

The notifications received by the listener depend on the status mask with which it was registered.

Listener un-registration is performed by setting the listener to NULL.

See also listener information.

Parameters:
  • plistener – the listener

  • mask – the mask defining the events for which the listener will be notified.

Throws:
  • 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::UnsupportedError – A status was selected that cannot be supported because the infrastructure does not maintain the required connectivity information.

  • dds::core::OutOfResourcesError – The Data Distribution Service ran out of resources to complete this operation.

OMG_DDS_API Listener * listener () const

Get the listener of this DataReader.

See also listener information.

Throws:

dds::core::NullReferenceError – The entity was not properly created and references to dds::core::null.

Returns:

the listener

OMG_DDS_API const dds::sub::Subscriber & subscriber () const

Return the Subscriber that owns this DataReader.

Throws:
  • 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.

Returns:

the Subscriber

Public Members

dds::sub::Subscriber *subscriber_