2.6. Subscriber

class eprosima::is::sh::fastdds::Subscriber : private DataReaderListener

This class represents a Fast DDS Subscriber within the Integration Service framework.

Its topic type definition and data instances are represented by means of the Fast DDS Dynamic Types API, which allows to get rid of TypeSupport for each used type and eases users the task of defining and using their own custom types on the go, by means of a valid IDL definition.

This class inherits from Fast DDS Data Reader Listener for reacting to datareader events, such as matching with publishers or receiving new data from them.

Public Functions

Subscriber(Participant *participant, const std::string &topic_name, const xtypes::DynamicType &message_type, TopicSubscriberSystem::SubscriptionCallback *is_callback)

Construct a new Subscriber object.

Parameters
  • [in] participant: The associated Integration Service Participant, which holds this Subscriber.

  • [in] topic_name: The topic that this DDS subscriber will attach to.

  • [in] message_type: A dynamic type definition of the topic’s type.

  • [in] is_callback: Callback function signature defined by the Integration Service, triggered each time a new data arrives to the DDS Subscriber.

Exceptions

~Subscriber()

Destroy the Subscriber object.

Subscriber(const Subscriber&) = delete

Subscriber shall not be copy constructible.

Subscriber &operator=(const Subscriber&) = delete

Subscriber shall not be copy assignable.

Subscriber(Subscriber&&) = delete

Subscriber shall not be move constructible.

Subscriber &operator=(Subscriber&&) = delete

Subscriber shall not be move assignable.

void receive(const fastrtps::types::DynamicData *dds_message, fastdds::dds::SampleInfo sample_info)

Handle the receiving of a new message from the DDS dataspace.

Parameters
  • [in] dds_message: The incoming message.

  • [in] sample_info: Structure containing the relevant information regarding the incoming message.