19#ifndef FASTDDS_DDS_SUBSCRIBER__SUBSCRIBER_HPP
20#define FASTDDS_DDS_SUBSCRIBER__SUBSCRIBER_HPP
22#include <fastdds/dds/core/Entity.hpp>
23#include <fastdds/dds/core/ReturnCode.hpp>
24#include <fastdds/dds/subscriber/DataReaderListener.hpp>
25#include <fastdds/dds/subscriber/InstanceState.hpp>
26#include <fastdds/dds/subscriber/qos/DataReaderQos.hpp>
27#include <fastdds/dds/subscriber/qos/SubscriberQos.hpp>
28#include <fastdds/dds/subscriber/SampleState.hpp>
29#include <fastdds/dds/subscriber/ViewState.hpp>
30#include <fastdds/dds/topic/qos/TopicQos.hpp>
31#include <fastdds/dds/topic/TypeSupport.hpp>
51class DomainParticipant;
52class SubscriberListener;
55class DataReaderListener;
57class TopicDescription;
171 std::shared_ptr<fastdds::rtps::IPayloadPool> payload_pool =
nullptr);
185 const std::string& profile_name,
188 std::shared_ptr<fastdds::rtps::IPayloadPool> payload_pool =
nullptr);
215 const std::string& topic_name)
const;
224 std::vector<DataReader*>& readers)
const;
239 std::vector<DataReader*>& readers,
240 const std::vector<SampleStateKind>& sample_states,
241 const std::vector<ViewStateKind>& view_states,
242 const std::vector<InstanceStateKind>& instance_states)
const;
355 const std::string& profile_name,
389 friend class ::dds::sub::Subscriber;
Class DataReader, contains the actual implementation of the behaviour of the Subscriber.
Definition DataReader.hpp:82
Class DataReaderListener, it should be used by the end user to implement specific callbacks to certai...
Definition DataReaderListener.hpp:41
Class DataReaderQos, containing all the possible Qos that can be set for a determined DataReader.
Definition DataReaderQos.hpp:133
The DomainEntity class is a subclass of Entity created in order to differentiate between DomainPartic...
Definition Entity.hpp:166
Class DomainParticipant used to group Publishers and Subscribers into a single working unit.
Definition DomainParticipant.hpp:78
StatusMask is a bitmap or bitset field.
Definition StatusMask.hpp:48
static StatusMask all()
Get all StatusMasks.
Definition StatusMask.hpp:104
Class Subscriber, contains the public API that allows the user to control the reception of messages.
Definition Subscriber.hpp:66
Subscriber(SubscriberImpl *pimpl, const StatusMask &mask=StatusMask::all())
Create a subscriber, assigning its pointer to the associated implementation.
SubscriberImpl * impl_
Definition Subscriber.hpp:387
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 ...
Subscriber(DomainParticipant *dp, const SubscriberQos &qos=SUBSCRIBER_QOS_DEFAULT, SubscriberListener *listener=nullptr, const StatusMask &mask=StatusMask::all())
FASTDDS_EXPORTED_API const InstanceHandle_t & get_instance_handle() const
Returns the Subscriber's handle.
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 wil...
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 set_listener(SubscriberListener *listener, const StatusMask &mask)
Modifies the SubscriberListener.
static FASTDDS_EXPORTED_API ReturnCode_t copy_from_topic_qos(DataReaderQos &reader_qos, const TopicQos &topic_qos)
Copies TopicQos into the corresponding DataReaderQos.
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...
FASTDDS_EXPORTED_API ReturnCode_t begin_access()
Indicates that the application is about to access the data samples in any of the DataReader objects a...
FASTDDS_EXPORTED_API ReturnCode_t get_qos(SubscriberQos &qos) const
Retrieves the Subscriber Qos.
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 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 creat...
virtual ~Subscriber()
Destructor.
Definition Subscriber.hpp:91
FASTDDS_EXPORTED_API ReturnCode_t end_access()
Indicates that the application has finished accessing the data samples in DataReader objects managed ...
FASTDDS_EXPORTED_API ReturnCode_t notify_datareaders() const
This operation invokes the operation on_data_available on the DataReaderListener objects attached to ...
FASTDDS_EXPORTED_API ReturnCode_t set_qos(const SubscriberQos &qos)
Allows modifying the Subscriber Qos.
FASTDDS_EXPORTED_API ReturnCode_t set_listener(SubscriberListener *listener)
Modifies the SubscriberListener, sets the mask to StatusMask::all()
friend class SubscriberImpl
Definition Subscriber.hpp:69
FASTDDS_EXPORTED_API const DomainParticipant * get_participant() const
This operation returns the DomainParticipant to which the Subscriber belongs.
FASTDDS_EXPORTED_API ReturnCode_t delete_contained_entities()
Deletes all contained DataReaders.
FASTDDS_EXPORTED_API ReturnCode_t enable() override
This operation enables the Subscriber.
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 const SubscriberQos & get_qos() const
Allows accessing the Subscriber Qos.
friend class DomainParticipantImpl
Definition Subscriber.hpp:70
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 ...
FASTDDS_EXPORTED_API bool has_datareaders() const
This operation checks if the subscriber has DataReaders.
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 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 ...
FASTDDS_EXPORTED_API const SubscriberListener * get_listener() const
Retrieves the attached SubscriberListener.
Class SubscriberListener, it should be used by the end user to implement specific callbacks to certai...
Definition SubscriberListener.hpp:41
Class SubscriberQos, contains all the possible Qos that can be set for a determined Subscriber.
Definition SubscriberQos.hpp:38
Class TopicDescription, represents the fact that both publications and subscriptions are tied to a si...
Definition TopicDescription.hpp:38
Class TopicQos, containing all the possible Qos that can be set for a determined Topic.
Definition TopicQos.hpp:40
Definition DomainParticipant.hpp:45
FASTDDS_EXPORTED_API const SubscriberQos SUBSCRIBER_QOS_DEFAULT
int32_t ReturnCode_t
Definition DDSReturnCode.hpp:59
Struct InstanceHandle_t, used to contain the key for WITH_KEY topics.
Definition InstanceHandle.hpp:154