Class Subscriber

Inheritance Relationships

Base Type

Class Documentation

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

The Subscriber acts on the behalf of one or several DataReader objects that belong to it.

See also

Subscriber

Public Types

typedef SubscriberListener Listener

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

Public Functions

OMG_DDS_REF_TYPE_PROTECTED_DC(Subscriber, dds::core::TEntity, detail::Subscriber) OMG_DDS_IMPLICIT_REF_BASE(Subscriber) OMG_DDS_API Subscriber(const dds OMG_DDS_API Subscriber (const dds::domain::DomainParticipant &dp, const qos::SubscriberQos &qos, SubscriberListener *listener=NULL, const dds::core::status::StatusMask &mask=dds::core::status::StatusMask::none())

Create a new Subscriber.

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

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

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

Parameters:
  • dp – the domain participant

  • dp – the domain participant to create the Subscriber with.

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

  • listener – the subscriber 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 Subscriber.

  • 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::SubscriberQos & qos () const

Gets the SubscriberQos 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::SubscriberQos &qos)

Sets the SubscriberQos 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 Subscriber & operator<< (const qos::SubscriberQos &qos)
OMG_DDS_API Subscriber & operator>> (qos::SubscriberQos &qos)
OMG_DDS_API Subscriber & default_datareader_qos (const qos::DataReaderQos &qos)

Sets the default DataWriterQos of the Subscriber.

This operation sets the default SubscriberQos of the Subscriber which is used for newly created Subscriber objects, when no QoS is provided.

This operation checks if the DataReaderQos is self consistent. If it is not, the operation has no effect and throws dds::core::InconsistentPolicyError.

The values set by this operation are returned by dds::pub::Subscriber::default_datareader_qos().

Parameters:

qos – the default DataReaderQos

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 – One or more of the selected QosPolicy values are currently not supported.

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

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

OMG_DDS_API qos::DataReaderQos default_datareader_qos () const

Gets the default DataReaderQos of the Subscriber.

This operation gets an object with the default DataReader QosPolicy settings of the Subscriber (that is the DataReaderQos) which is used for newly created DataReader objects, in case no QoS was provided during the creation.

The values retrieved by this operation match the set of values specified on the last successful call to dds::pub::Subscriber::default_datareader_qos(const dds::pub::qos::DataReaderQos& qos), or, if the call was never made, the default values.

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 default DataReaderQos

OMG_DDS_API void listener (Listener *plistener, const dds::core::status::StatusMask &mask)

Register a listener with the Subscriber.

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 Subscriber.

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::domain::DomainParticipant & participant () const

Return the DomainParticipant that owns this Subscriber.

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 DomainParticipant

Public Members

const dds::domain::DomainParticipant *participant_