15.1.4.9. Subscriber — Fast DDS 2.1.1 documentation Fast DDS v2.1.1 Introduction DDS API Fast DDS-Gen RTPS Wire Protocol Main Features Contacts and Commercial support Contributing to the documentation Structure of the documentation Installation Manual 1. Linux installation from binaries 2. Windows installation from binaries 3. Linux installation from sources 4. Windows installation from sources 5. Mac OS installation from sources 6. CMake options Fast DDS 1. Getting Started 2. Library Overview 3. DDS Layer 4. RTPS Layer 5. Discovery 6. Transport Layer 7. Persistence Service 8. Security 9. Logging 10. XML profiles 11. Environment variables 12. Dynamic Topic Types 13. Typical Use-Cases 14. ROS 2 using Fast DDS middleware 15. API Reference 15.1. DDS DCPS PIM 15.1.1. Core 15.1.2. Domain 15.1.3. Publisher 15.1.4. Subscriber 15.1.4.1. DataReader 15.1.4.2. DataReaderListener 15.1.4.3. DataReaderQos 15.1.4.4. InstanceStateKind 15.1.4.5. ReaderResourceLimitsQos 15.1.4.6. RTPSReliableReaderQos 15.1.4.7. SampleInfo 15.1.4.8. SampleStateKind 15.1.4.9. Subscriber 15.1.4.10. SubscriberListener 15.1.4.11. SubscriberQos 15.1.4.12. TypeConsistencyQos 15.1.4.13. ViewStateKind 15.1.5. Topic 15.2. RTPS 15.3. LOG Fast DDS-Gen 1. Introduction 2. Usage 3. Building a publish/subscribe application 4. Defining a data type via IDL Fast DDS CLI 1. CLI Release Notes Version 2.1.0 Previous versions Fast DDS Docs » 15. API Reference » 15.1. DDS DCPS PIM » 15.1.4. Subscriber » 15.1.4.9. Subscriber Edit on GitHub 15.1.4.9. Subscriber¶ class eprosima::fastdds::dds::Subscriber : public eprosima::fastdds::dds::DomainEntity¶ 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. Public Functions ~Subscriber()¶ Destructor. ReturnCode_t enable() override¶ This operation enables the Subscriber. Return RETCODE_OK is successfully enabled. RETCODE_PRECONDITION_NOT_MET if the participant creating this Subscriber is not enabled. const SubscriberQos &get_qos() const¶ Allows accessing the Subscriber Qos. Return SubscriberQos reference ReturnCode_t get_qos(SubscriberQos &qos) const¶ Retrieves the Subscriber Qos. Return RETCODE_OK Parameters qos: SubscriberQos where the qos is returned ReturnCode_t set_qos(const SubscriberQos &qos)¶ Allows modifying the Subscriber Qos. The given Qos must be supported by the SubscriberQos. Return 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. Parameters qos: new value for SubscriberQos const SubscriberListener *get_listener() const¶ Retrieves the attached SubscriberListener. Return Pointer to the SubscriberListener ReturnCode_t set_listener(SubscriberListener *listener)¶ Modifies the SubscriberListener, sets the mask to StatusMask::all() Return RETCODE_OK Parameters listener: new value for SubscriberListener ReturnCode_t set_listener(SubscriberListener *listener, const StatusMask &mask)¶ Modifies the SubscriberListener. Return RETCODE_OK Parameters listener: new value for the SubscriberListener mask: StatusMask that holds statuses the listener responds to. DataReader *create_datareader(TopicDescription *topic, const DataReaderQos &reader_qos, DataReaderListener *listener = nullptr, const StatusMask &mask = StatusMask::all())¶ This operation creates a DataReader. The returned DataReader will be attached and belong to the Subscriber. Return Pointer to the created DataReader. nullptr if failed. 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). DataReader *create_datareader_with_profile(TopicDescription *topic, const std::string &profile_name, DataReaderListener *listener = nullptr, const StatusMask &mask = StatusMask::all())¶ This operation creates a DataReader. The returned DataReader will be attached and belongs to the Subscriber. Return Pointer to the created DataReader. nullptr if failed. 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). 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. Return RETCODE_PRECONDITION_NOT_MET if the datareader does not belong to this subscriber, RETCODE_OK if it is correctly deleted and RETCODE_ERROR otherwise. Parameters reader: DataReader to delete 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. Return Pointer to a previously created DataReader created on a Topic with that topic_name Parameters topic_name: Name of the topic associated to the DataReader ReturnCode_t get_datareaders(std::vector<DataReader*> &readers) const¶ This operation allows the application to access the DataReader objects. Return RETCODE_OK Parameters readers: Vector of DataReader where the list of existing readers is returned 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. Return RETCODE_OK 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 bool has_datareaders() const¶ This operation checks if the subscriber has DataReaders Return true if the subscriber has one or several DataReaders, false in other case 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. Return RETCODE_OK ReturnCode_t end_access()¶ Indicates that the application has finished accessing the data samples in DataReader objects managed by the Subscriber. Return RETCODE_OK 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. Return RETCODE_OK ReturnCode_t delete_contained_entities()¶ Deletes all contained DataReaders. If the DataReaders have any QueryCondition or ReadCondition, they are deleted before the DataReader itself. Return RETCODE_OK if successful, an error code otherwise 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. Return RETCODE_INCONSISTENT_POLICY if the Qos is not self consistent and RETCODE_OK if the qos is changed correctly. Parameters qos: new value for DataReaderQos to set as default 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. Return Current default DataReaderQos. 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. Return Current default DataReaderQos. 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. Return RETCODE_OK Parameters qos: DataReaderQos where the default_qos is returned 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. Return RETCODE_OK if the profile exists. RETCODE_BAD_PARAMETER otherwise. Parameters profile_name: DataReader profile name. qos: DataReaderQos object where the qos is returned. const DomainParticipant *get_participant() const¶ This operation returns the DomainParticipant to which the Subscriber belongs. Return DomainParticipant Pointer const InstanceHandle_t &get_instance_handle() const¶ Returns the Subscriber’s handle. Return InstanceHandle of this Subscriber. Public Static Functions ReturnCode_t copy_from_topic_qos(DataReaderQos &reader_qos, const TopicQos &topic_qos)¶ Copies TopicQos into the corresponding DataReaderQos. Return RETCODE_OK if successful, an error code otherwise Parameters [inout] reader_qos: [in] topic_qos: Next Previous © Copyright 2019, eProsima Revision 09b42771. Built with Sphinx using a theme provided by Read the Docs. Read the Docs v: v2.1.1 Versions latest stable v2.6.0 v2.5.1 v2.5.0 v2.4.1 v2.4.0 v2.3.4 v2.3.3 v2.3.2 v2.3.1 v2.3.0 v2.2.0 v2.1.1 v2.1.0 v2.0.2 v2.0.1 v2.0.0 v1.10.0 v1.9.4 v1.9.3 v1.9.2 v1.9.1 v1.9.0 v1.8.3 v1.8.2 v1.8.1 v1.7.2 v1.7.1 v1.7.0 v1.6.0 1.5.0 fiware feature-disable-acks-static-xml feature-content-filter Downloads On Read the Docs Project Home Builds Free document hosting provided by Read the Docs.