2.4. Publisher

class eprosima::is::sh::fastdds::Publisher : public virtual eprosima::is::TopicPublisher, private DataWriterListener

This class represents a Fast DDS Publisher 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 Writer Listener for reacting to datawriter events, such as matching with subscribers.

Public Functions

Publisher(Participant *participant, const std::string &topic_name, const xtypes::DynamicType &message_type, const YAML::Node &config)

Construct a new Publisher object.

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

  • [in] topic_name: The topic that this DDS publisher will send data to.

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

  • [in] config: Specific configuration regarding this publisher, in YAML format. Allowed fields are:

    • service_instance_name: Specify the DDS RPC service instance name property.

Exceptions

~Publisher() override

Destroy the Publisher object.

Publisher(const Publisher&) = delete

Publisher shall not be copy constructible.

Publisher &operator=(const Publisher&) = delete

Publisher shall not be copy assignable.

Publisher(Publisher&&) = delete

Publisher shall not be move constructible.

Publisher &operator=(Publisher&&) = delete

Publisher shall not be move assignable.

bool publish(const xtypes::DynamicData &message) override

Inherited from TopicPublisher.

const std::string &topic_name() const

Get the topic name where this publisher sends data to.

Return

The topic name.

const fastrtps::rtps::InstanceHandle_t get_dds_instance_handle() const

Get the DDS instance handle object for the associated datawriter.

Return

The datawriter instance handle.