Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Topics give a context for a data exchange within a domain. A domain can contain multiple topics. They are used to define the name and the type of a 'conversation' between publisher and subcriberssubscribers.

There are a different constructors available to create a topic. If no special type names, QoS settings or listeners are required, topics can be set using the following constructor:

...

Samples are processed as shown before.

...


Publisher / Data Writer

#include <dds/pub/ddspub.hpp>
...
dds::pub::Publisher some_publisher(some_participant);
dds::pub::DataWriter<TestType> some_writer(some_publisher, some_topic);

The creation of a publisher / data writer is thus similar to the creation of a subscriber / data reader. Publisher can be created with listeners and non-default QoS settings as well. To send data, data writer are used.

Sending Data

TestType some_message(...);
some_writer.write(some_message);

Data is sent using the write(...) function of a data writer. All participants within the same domain are able to receive that message (depending on the QoS settings).



Best Practice

See https://community.rti.com/best-practices/create-few-publishers-and-subscribers-possible and https://community.rti.com/best-practices/create-few-domainparticipants-possible. Also take a look at the other best practices.

...