| Fast DDS Version 3.3.0 Fast DDS

Loading...
Searching...
No Matches
Subscriber Class Reference
eProsima Fast DDS API Reference » DDS Public API

Class Subscriber, contains the public API that allows the user to control the reception of messages. More...

`#include <Subscriber.hpp>`

Inheritance diagram for Subscriber:
[legend]

## Public Member Functions

virtual | ~Subscriber ()
| Destructor.
FASTDDS_EXPORTED_API ReturnCode_t | enable () override
| This operation enables the Subscriber.
FASTDDS_EXPORTED_API const SubscriberQos & | get_qos () const
| Allows accessing the Subscriber Qos.
FASTDDS_EXPORTED_API ReturnCode_t | get_qos (SubscriberQos &qos) const
| Retrieves the Subscriber Qos.
FASTDDS_EXPORTED_API ReturnCode_t | set_qos (const SubscriberQos &qos)
| Allows modifying the Subscriber Qos.
FASTDDS_EXPORTED_API const SubscriberListener * | get_listener () const
| Retrieves the attached SubscriberListener.
FASTDDS_EXPORTED_API ReturnCode_t | set_listener (SubscriberListener *listener)
| Modifies the SubscriberListener, sets the mask to StatusMask::all().
FASTDDS_EXPORTED_API ReturnCode_t | set_listener (SubscriberListener *listener, const StatusMask &mask)
| Modifies the SubscriberListener.
FASTDDS_EXPORTED_API DataReader * | create_datareader (TopicDescription *topic, const DataReaderQos &reader_qos, DataReaderListener *listener=nullptr, const StatusMask &mask=StatusMask::all(), std::shared_ptr< fastdds::rtps::IPayloadPool > payload_pool=nullptr)
| This operation creates a DataReader.
FASTDDS_EXPORTED_API DataReader * | create_datareader_with_profile (TopicDescription *topic, const std::string &profile_name, DataReaderListener *listener=nullptr, const StatusMask &mask=StatusMask::all(), std::shared_ptr< fastdds::rtps::IPayloadPool > payload_pool=nullptr)
| This operation creates a DataReader.
FASTDDS_EXPORTED_API ReturnCode_t | delete_datareader (const DataReader *reader)
| This operation deletes a DataReader that belongs to the Subscriber.
FASTDDS_EXPORTED_API DataReader * | lookup_datareader (const std::string &topic_name) const
| This operation retrieves a previously-created DataReader belonging to the Subscriber that is attached to a Topic with a matching topic_name.
FASTDDS_EXPORTED_API ReturnCode_t | get_datareaders (std::vector< DataReader * > &readers) const
| This operation allows the application to access the DataReader objects.
FASTDDS_EXPORTED_API ReturnCode_t | get_datareaders (std::vector< DataReader * > &readers, const std::vector< SampleStateKind > &sample_states, const std::vector< ViewStateKind > &view_states, const std::vector< InstanceStateKind > &instance_states) const
| This operation allows the application to access the DataReader objects that contain samples with the specified sample_states, view_states, and instance_states.
FASTDDS_EXPORTED_API bool | has_datareaders () const
| This operation checks if the subscriber has DataReaders.
FASTDDS_EXPORTED_API ReturnCode_t | begin_access ()
| Indicates that the application is about to access the data samples in any of the DataReader objects attached to the Subscriber.
FASTDDS_EXPORTED_API ReturnCode_t | end_access ()
| Indicates that the application has finished accessing the data samples in DataReader objects managed by the Subscriber.
FASTDDS_EXPORTED_API ReturnCode_t | notify_datareaders () const
| This operation invokes the operation on_data_available on the DataReaderListener objects attached to contained DataReader entities.
FASTDDS_EXPORTED_API ReturnCode_t | delete_contained_entities ()
| Deletes all contained DataReaders.
FASTDDS_EXPORTED_API ReturnCode_t | set_default_datareader_qos (const DataReaderQos &qos)
| This operation sets a default value of the DataReader QoS policies which will be used for newly created DataReader entities in the case where the QoS policies are defaulted in the create_datareader operation.
FASTDDS_EXPORTED_API const DataReaderQos & | get_default_datareader_qos () const
| This operation returns the default value of the DataReader QoS, that is, the QoS policies which will be used for newly created DataReader entities in the case where the QoS policies are defaulted in the create_datareader operation.
FASTDDS_EXPORTED_API DataReaderQos & | get_default_datareader_qos ()
| This operation returns the default value of the DataReader QoS, that is, the QoS policies which will be used for newly created DataReader entities in the case where the QoS policies are defaulted in the create_datareader operation.
FASTDDS_EXPORTED_API ReturnCode_t | get_default_datareader_qos (DataReaderQos &qos) const
| This operation retrieves the default value of the DataReader QoS, that is, the QoS policies which will be used for newly created DataReader entities in the case where the QoS policies are defaulted in the create_datareader operation.
FASTDDS_EXPORTED_API ReturnCode_t | get_datareader_qos_from_profile (const std::string &profile_name, DataReaderQos &qos) const
| Fills the DataReaderQos with the values of the XML profile.
FASTDDS_EXPORTED_API ReturnCode_t | get_datareader_qos_from_profile (const std::string &profile_name, DataReaderQos &qos, std::string &topic_name) const
| Fills the DataReaderQos with the values of the XML profile, and also its corresponding topic name (if specified).
FASTDDS_EXPORTED_API ReturnCode_t | get_datareader_qos_from_xml (const std::string &xml, DataReaderQos &qos) const
| Fills the DataReaderQos with the first DataReader profile found in the provided XML.
FASTDDS_EXPORTED_API ReturnCode_t | get_datareader_qos_from_xml (const std::string &xml, DataReaderQos &qos, std::string &topic_name) const
| Fills the DataReaderQos with the first DataReader profile found in the provided XML, and also its corresponding topic name (if specified).
FASTDDS_EXPORTED_API ReturnCode_t | get_datareader_qos_from_xml (const std::string &xml, DataReaderQos &qos, const std::string &profile_name) const
| Fills the DataReaderQos with the DataReader profile with `profile_name` to be found in the provided XML.
FASTDDS_EXPORTED_API ReturnCode_t | get_datareader_qos_from_xml (const std::string &xml, DataReaderQos &qos, std::string &topic_name, const std::string &profile_name) const
| Fills the DataReaderQos with the DataReader profile with `profile_name` to be found in the provided XML, and also its corresponding topic name (if specified).
FASTDDS_EXPORTED_API ReturnCode_t | get_default_datareader_qos_from_xml (const std::string &xml, DataReaderQos &qos) const
| Fills the DataReaderQos with the default DataReader profile found in the provided XML (if there is).
FASTDDS_EXPORTED_API ReturnCode_t | get_default_datareader_qos_from_xml (const std::string &xml, DataReaderQos &qos, std::string &topic_name) const
| Fills the DataReaderQos with the default DataReader profile found in the provided XML (if there is), and also its corresponding topic name (if specified).
FASTDDS_EXPORTED_API const DomainParticipant * | get_participant () const
| This operation returns the DomainParticipant to which the Subscriber belongs.
FASTDDS_EXPORTED_API const InstanceHandle_t & | get_instance_handle () const
| Returns the Subscriber's handle.
Public Member Functions inherited from DomainEntity
| DomainEntity (const StatusMask &mask=StatusMask::all())
| Constructor.
Public Member Functions inherited from Entity
FASTDDS_EXPORTED_API | Entity (const StatusMask &mask=StatusMask::all())
| Constructor.
void | close ()
| This operation disables the Entity before closing it.
FASTDDS_EXPORTED_API const StatusMask & | get_status_mask () const
| Retrieves the set of relevant statuses for the Entity.
FASTDDS_EXPORTED_API const StatusMask & | get_status_changes () const
| Retrieves the set of triggered statuses in the Entity.
const InstanceHandle_t & | get_instance_handle () const
| Retrieves the instance handler that represents the Entity.
FASTDDS_EXPORTED_API bool | is_enabled () const
| Checks if the Entity is enabled.
FASTDDS_EXPORTED_API bool | operator== (const Entity &other) const
FASTDDS_EXPORTED_API StatusCondition & | get_statuscondition ()
| Allows access to the StatusCondition associated with the Entity.
FASTDDS_EXPORTED_API const StatusCondition & | get_statuscondition () const
| Allows access to the StatusCondition associated with the Entity.

## Static Public Member Functions

static FASTDDS_EXPORTED_API ReturnCode_t | copy_from_topic_qos (DataReaderQos &reader_qos, const TopicQos &topic_qos)
| Copies TopicQos into the corresponding DataReaderQos.

## Protected Member Functions

| Subscriber (SubscriberImpl *pimpl, const StatusMask &mask=StatusMask::all())
| Create a subscriber, assigning its pointer to the associated implementation.
| Subscriber (DomainParticipant *dp, const SubscriberQos &qos=SUBSCRIBER_QOS_DEFAULT, SubscriberListener *listener=nullptr, const StatusMask &mask=StatusMask::all())
Protected Member Functions inherited from Entity
FASTDDS_EXPORTED_API void | set_instance_handle (const InstanceHandle_t &handle)
| Setter for the Instance Handle.

## Protected Attributes

SubscriberImpl * | impl_
Protected Attributes inherited from Entity
StatusMask | status_mask_
| StatusMask with relevant statuses set to 1.
StatusCondition | status_condition_
| Condition associated to the Entity.
InstanceHandle_t | instance_handle_
| InstanceHandle associated to the Entity.
bool | enable_
| Boolean that states if the Entity is enabled or disabled.

## Friends

class | SubscriberImpl
class | DomainParticipantImpl
class | ::dds::sub::Subscriber

## Detailed Description

Class Subscriber, contains the public API that allows the user to control the reception of messages.

This class should not be instantiated directly. DomainRTPSParticipant class should be used to correctly create this element.

## Constructor & Destructor Documentation

## ◆ Subscriber() [1/2]

Subscriber | ( | SubscriberImpl * | pimpl,
|  | const StatusMask & | mask = StatusMask::all() )

protected

Create a subscriber, assigning its pointer to the associated implementation.

Don't use directly, create Subscriber using create_subscriber from DomainParticipant.

## ◆ Subscriber() [2/2]

Subscriber | ( | DomainParticipant * | dp,
|  | const SubscriberQos & | qos = SUBSCRIBER_QOS_DEFAULT,
|  | SubscriberListener * | listener = nullptr,
|  | const StatusMask & | mask = StatusMask::all() )

protected

## ◆ ~Subscriber()

virtual ~Subscriber | ( |  | ) |

inline virtual

Destructor.

## Member Function Documentation

## ◆ begin_access()

FASTDDS_EXPORTED_API ReturnCode_t begin_access | ( |  | ) |

Indicates that the application is about to access the data samples in any of the DataReader objects attached to the Subscriber.

Returns
  RETCODE_OK

Warning
  Not supported yet. Currently returns RETCODE_UNSUPPORTED

## ◆ copy_from_topic_qos()

FASTDDS_EXPORTED_API ReturnCode_t copy_from_topic_qos | ( | DataReaderQos & | reader_qos,
|  | const TopicQos & | topic_qos )

static

Copies TopicQos into the corresponding DataReaderQos.

Parameters

  [in,out] | reader_qos |
  [in] | topic_qos |

Returns
  RETCODE_OK if successful, an error code otherwise

Warning
  Not supported yet. Currently returns RETCODE_UNSUPPORTED

## ◆ create_datareader()

FASTDDS_EXPORTED_API DataReader * create_datareader | ( | TopicDescription * | topic,
|  | const DataReaderQos & | reader_qos,
|  | DataReaderListener * | listener = nullptr,
|  | const StatusMask & | mask = StatusMask::all(),
|  | std::shared_ptr< fastdds::rtps::IPayloadPool > | payload_pool = nullptr )

This operation creates a DataReader.

The returned DataReader will be attached and belong to the Subscriber.

Parameters

  topic | Topic the DataReader will be listening.
  reader_qos | QoS of the DataReader.
  listener | Pointer to the listener (default: nullptr)
  mask | StatusMask that holds statuses the listener responds to (default: all).
  payload_pool | IPayloadPool shared pointer that defines reader payload (default: nullptr).

Returns
  Pointer to the created DataReader. nullptr if failed.

## ◆ create_datareader_with_profile()

FASTDDS_EXPORTED_API DataReader * create_datareader_with_profile | ( | TopicDescription * | topic,
|  | const std::string & | profile_name,
|  | DataReaderListener * | listener = nullptr,
|  | const StatusMask & | mask = StatusMask::all(),
|  | std::shared_ptr< fastdds::rtps::IPayloadPool > | payload_pool = nullptr )

This operation creates a DataReader.

The returned DataReader will be attached and belongs to the Subscriber.

Parameters

  topic | Topic the DataReader will be listening.
  profile_name | DataReader profile name.
  listener | Pointer to the listener (default: nullptr)
  mask | StatusMask that holds statuses the listener responds to (default: all).
  payload_pool | IPayloadPool shared pointer that defines reader payload (default: nullptr).

Returns
  Pointer to the created DataReader. nullptr if failed.

## ◆ delete_contained_entities()

FASTDDS_EXPORTED_API ReturnCode_t delete_contained_entities | ( |  | ) |

Deletes all contained DataReaders.

If the DataReaders have any QueryCondition or ReadCondition, they are deleted before the DataReader itself.

Returns
  RETCODE_OK if successful, an error code otherwise

## ◆ delete_datareader()

FASTDDS_EXPORTED_API ReturnCode_t delete_datareader | ( | const DataReader * | reader | ) |

This operation deletes a DataReader that belongs to the Subscriber.

The delete_datareader operation must be called on the same Subscriber object used to create the DataReader. If delete_datareader is called on a different Subscriber, the operation will have no effect and it will return an error.

Parameters

  reader | DataReader to delete

Returns
  RETCODE_PRECONDITION_NOT_MET if the datareader does not belong to this subscriber, RETCODE_OK if it is correctly deleted and RETCODE_ERROR otherwise.

## ◆ enable()

FASTDDS_EXPORTED_API ReturnCode_t enable | ( |  | ) |

override virtual

This operation enables the Subscriber.

Returns
  RETCODE_OK is successfully enabled. RETCODE_PRECONDITION_NOT_MET if the participant creating this Subscriber is not enabled.

Reimplemented from Entity.

## ◆ end_access()

FASTDDS_EXPORTED_API ReturnCode_t end_access | ( |  | ) |

Indicates that the application has finished accessing the data samples in DataReader objects managed by the Subscriber.

Returns
  RETCODE_OK

Warning
  Not supported yet. Currently returns RETCODE_UNSUPPORTED

## ◆ get_datareader_qos_from_profile() [1/2]

FASTDDS_EXPORTED_API ReturnCode_t get_datareader_qos_from_profile | ( | const std::string & | profile_name,
|  | DataReaderQos & | qos ) const

Fills the DataReaderQos with the values of the XML profile.

Parameters

  profile_name | DataReader profile name.
  qos | DataReaderQos object where the qos is returned.

Returns
  RETCODE_OK if the profile exists. RETCODE_BAD_PARAMETER otherwise.

## ◆ get_datareader_qos_from_profile() [2/2]

FASTDDS_EXPORTED_API ReturnCode_t get_datareader_qos_from_profile | ( | const std::string & | profile_name,
|  | DataReaderQos & | qos,
|  | std::string & | topic_name ) const

Fills the DataReaderQos with the values of the XML profile, and also its corresponding topic name (if specified).

Parameters

  profile_name | DataReader profile name.
  qos | DataReaderQos object where the qos is returned.
  topic_name | String where the name of the topic associated to this profile is returned (if specified).

Returns
  RETCODE_OK if the profile exists. RETCODE_BAD_PARAMETER otherwise.

## ◆ get_datareader_qos_from_xml() [1/4]

FASTDDS_EXPORTED_API ReturnCode_t get_datareader_qos_from_xml | ( | const std::string & | xml,
|  | DataReaderQos & | qos ) const

Fills the DataReaderQos with the first DataReader profile found in the provided XML.

Parameters

  xml | Raw XML string containing the profile to be used to fill the `qos` structure.
  qos | DataReaderQos object where the qos is returned.

Returns
  RETCODE_OK on success. RETCODE_BAD_PARAMETER otherwise.

## ◆ get_datareader_qos_from_xml() [2/4]

FASTDDS_EXPORTED_API ReturnCode_t get_datareader_qos_from_xml | ( | const std::string & | xml,
|  | DataReaderQos & | qos,
|  | const std::string & | profile_name ) const

Fills the DataReaderQos with the DataReader profile with `profile_name` to be found in the provided XML.

Parameters

  xml | Raw XML string containing the profile to be used to fill the `qos` structure.
  qos | DataReaderQos object where the qos is returned.
  profile_name | DataReader profile name.

Returns
  RETCODE_OK on success. RETCODE_BAD_PARAMETER otherwise.

## ◆ get_datareader_qos_from_xml() [3/4]

FASTDDS_EXPORTED_API ReturnCode_t get_datareader_qos_from_xml | ( | const std::string & | xml,
|  | DataReaderQos & | qos,
|  | std::string & | topic_name ) const

Fills the DataReaderQos with the first DataReader profile found in the provided XML, and also its corresponding topic name (if specified).

Parameters

  xml | Raw XML string containing the profile to be used to fill the `qos` structure.
  qos | DataReaderQos object where the qos is returned.
  topic_name | String where the name of the topic associated to this profile is returned (if specified).

Returns
  RETCODE_OK on success. RETCODE_BAD_PARAMETER otherwise.

## ◆ get_datareader_qos_from_xml() [4/4]

FASTDDS_EXPORTED_API ReturnCode_t get_datareader_qos_from_xml | ( | const std::string & | xml,
|  | DataReaderQos & | qos,
|  | std::string & | topic_name,
|  | const std::string & | profile_name ) const

Fills the DataReaderQos with the DataReader profile with `profile_name` to be found in the provided XML, and also its corresponding topic name (if specified).

Parameters

  xml | Raw XML string containing the profile to be used to fill the `qos` structure.
  qos | DataReaderQos object where the qos is returned.
  topic_name | String where the name of the topic associated to this profile is returned (if specified).
  profile_name | DataReader profile name.

Returns
  RETCODE_OK on success. RETCODE_BAD_PARAMETER otherwise.

## ◆ get_datareaders() [1/2]

FASTDDS_EXPORTED_API ReturnCode_t get_datareaders | ( | std::vector< DataReader * > & | readers | ) | const

This operation allows the application to access the DataReader objects.

Parameters

  readers | Vector of DataReader where the list of existing readers is returned

Returns
  RETCODE_OK

## ◆ get_datareaders() [2/2]

FASTDDS_EXPORTED_API ReturnCode_t get_datareaders | ( | std::vector< DataReader * > & | readers,
|  | const std::vector< SampleStateKind > & | sample_states,
|  | const std::vector< ViewStateKind > & | view_states,
|  | const std::vector< InstanceStateKind > & | instance_states ) const

This operation allows the application to access the DataReader objects that contain samples with the specified sample_states, view_states, and instance_states.

Parameters

  [out] | readers | Vector of DataReader where the list of existing readers is returned
  | sample_states | Vector of SampleStateKind
  | view_states | Vector of ViewStateKind
  | instance_states | Vector of InstanceStateKind

Returns
  RETCODE_OK

Warning
  Not supported yet. Currently returns RETCODE_UNSUPPORTED

## ◆ get_default_datareader_qos() [1/3]

FASTDDS_EXPORTED_API DataReaderQos & get_default_datareader_qos | ( |  | ) |

This operation returns the default value of the DataReader QoS, that is, the QoS policies which will be used for newly created DataReader entities in the case where the QoS policies are defaulted in the create_datareader operation.

The values retrieved get_default_datareader_qos will match the set of values specified on the last successful call to get_default_datareader_qos, or else, if the call was never made, the default values.

Returns
  Current default DataReaderQos.

## ◆ get_default_datareader_qos() [2/3]

FASTDDS_EXPORTED_API const DataReaderQos & get_default_datareader_qos | ( |  | ) | const

This operation returns the default value of the DataReader QoS, that is, the QoS policies which will be used for newly created DataReader entities in the case where the QoS policies are defaulted in the create_datareader operation.

The values retrieved get_default_datareader_qos will match the set of values specified on the last successful call to get_default_datareader_qos, or else, if the call was never made, the default values.

Returns
  Current default DataReaderQos.

## ◆ get_default_datareader_qos() [3/3]

FASTDDS_EXPORTED_API ReturnCode_t get_default_datareader_qos | ( | DataReaderQos & | qos | ) | const

This operation retrieves the default value of the DataReader QoS, that is, the QoS policies which will be used for newly created DataReader entities in the case where the QoS policies are defaulted in the create_datareader operation.

The values retrieved get_default_datareader_qos will match the set of values specified on the last successful call to get_default_datareader_qos, or else, if the call was never made, the default values.

Parameters

  qos | DataReaderQos where the default_qos is returned

Returns
  RETCODE_OK

## ◆ get_default_datareader_qos_from_xml() [1/2]

FASTDDS_EXPORTED_API ReturnCode_t get_default_datareader_qos_from_xml | ( | const std::string & | xml,
|  | DataReaderQos & | qos ) const

Fills the DataReaderQos with the default DataReader profile found in the provided XML (if there is).

Note
  This method does not update the default datareader qos (returned by `get_default_datareader_qos`).

Parameters

  xml | Raw XML string containing the profile to be used to fill the `qos` structure.
  qos | DataReaderQos object where the qos is returned.

Returns
  RETCODE_OK on success. RETCODE_BAD_PARAMETER otherwise.

## ◆ get_default_datareader_qos_from_xml() [2/2]

FASTDDS_EXPORTED_API ReturnCode_t get_default_datareader_qos_from_xml | ( | const std::string & | xml,
|  | DataReaderQos & | qos,
|  | std::string & | topic_name ) const

Fills the DataReaderQos with the default DataReader profile found in the provided XML (if there is), and also its corresponding topic name (if specified).

Note
  This method does not update the default datareader qos (returned by `get_default_datareader_qos`).

Parameters

  xml | Raw XML string containing the profile to be used to fill the `qos` structure.
  qos | DataReaderQos object where the qos is returned.
  topic_name | String where the name of the topic associated to this profile is returned (if specified).

Returns
  RETCODE_OK on success. RETCODE_BAD_PARAMETER otherwise.

## ◆ get_instance_handle()

FASTDDS_EXPORTED_API const InstanceHandle_t & get_instance_handle | ( |  | ) | const

Returns the Subscriber's handle.

Returns
  InstanceHandle of this Subscriber.

## ◆ get_listener()

FASTDDS_EXPORTED_API const SubscriberListener * get_listener | ( |  | ) | const

Retrieves the attached SubscriberListener.

Returns
  Pointer to the SubscriberListener

## ◆ get_participant()

FASTDDS_EXPORTED_API const DomainParticipant * get_participant | ( |  | ) | const

This operation returns the DomainParticipant to which the Subscriber belongs.

Returns
  DomainParticipant Pointer

## ◆ get_qos() [1/2]

FASTDDS_EXPORTED_API const SubscriberQos & get_qos | ( |  | ) | const

Allows accessing the Subscriber Qos.

Returns
  SubscriberQos reference

## ◆ get_qos() [2/2]

FASTDDS_EXPORTED_API ReturnCode_t get_qos | ( | SubscriberQos & | qos | ) | const

Retrieves the Subscriber Qos.

Parameters

  qos | SubscriberQos where the qos is returned

Returns
  RETCODE_OK

## ◆ has_datareaders()

FASTDDS_EXPORTED_API bool has_datareaders | ( |  | ) | const

This operation checks if the subscriber has DataReaders.

Returns
  true if the subscriber has one or several DataReaders, false in other case

## ◆ lookup_datareader()

FASTDDS_EXPORTED_API DataReader * lookup_datareader | ( | const std::string & | topic_name | ) | const

This operation retrieves a previously-created DataReader belonging to the Subscriber that is attached to a Topic with a matching topic_name.

If no such DataReader exists, the operation will return nullptr.

If multiple DataReaders attached to the Subscriber satisfy this condition, then the operation will return one of them. It is not specified which one.

Parameters

  topic_name | Name of the topic associated to the DataReader

Returns
  Pointer to a previously created DataReader created on a Topic with that topic_name

## ◆ notify_datareaders()

FASTDDS_EXPORTED_API ReturnCode_t notify_datareaders | ( |  | ) | const

This operation invokes the operation on_data_available on the DataReaderListener objects attached to contained DataReader entities.

This operation is typically invoked from the on_data_on_readers operation in the SubscriberListener. That way the SubscriberListener can delegate to the DataReaderListener objects the handling of the data.

Returns
  RETCODE_OK

## ◆ set_default_datareader_qos()

FASTDDS_EXPORTED_API ReturnCode_t set_default_datareader_qos | ( | const DataReaderQos & | qos | ) |

This operation sets a default value of the DataReader QoS policies which will be used for newly created DataReader entities in the case where the QoS policies are defaulted in the create_datareader operation.

This operation will check that the resulting policies are self consistent; if they are not, the operation will have no effect and return false.

The special value DATAREADER_QOS_DEFAULT may be passed to this operation to indicate that the default QoS should be reset back to the initial values the factory would use, that is the values that would be used if the set_default_datareader_qos operation had never been called.

Parameters

  qos | new value for DataReaderQos to set as default

Returns
  RETCODE_INCONSISTENT_POLICY if the Qos is not self consistent and RETCODE_OK if the qos is changed correctly.

## ◆ set_listener() [1/2]

FASTDDS_EXPORTED_API ReturnCode_t set_listener | ( | SubscriberListener * | listener | ) |

Modifies the SubscriberListener, sets the mask to StatusMask::all().

Parameters

  listener | new value for SubscriberListener

Returns
  RETCODE_OK

## ◆ set_listener() [2/2]

FASTDDS_EXPORTED_API ReturnCode_t set_listener | ( | SubscriberListener * | listener,
|  | const StatusMask & | mask )

Modifies the SubscriberListener.

Parameters

  listener | new value for the SubscriberListener
  mask | StatusMask that holds statuses the listener responds to.

Returns
  RETCODE_OK

## ◆ set_qos()

FASTDDS_EXPORTED_API ReturnCode_t set_qos | ( | const SubscriberQos & | qos | ) |

Allows modifying the Subscriber Qos.

The given Qos must be supported by the SubscriberQos.

Parameters

  qos | new value for SubscriberQos

Returns
  RETCODE_IMMUTABLE_POLICY if any of the Qos cannot be changed, RETCODE_INCONSISTENT_POLICY if the Qos is not self consistent and RETCODE_OK if the qos is changed correctly.

## Friends And Related Symbol Documentation

## ◆ ::dds::sub::Subscriber

friend class ::dds::sub::Subscriber

friend

## ◆ DomainParticipantImpl

friend class DomainParticipantImpl

friend

## ◆ SubscriberImpl

friend class SubscriberImpl

friend

## Member Data Documentation

## ◆ impl_

SubscriberImpl* impl_

protected

The documentation for this class was generated from the following file:

- include/fastdds/dds/subscriber/Subscriber.hpp