You are here: Part 2: Core Concepts > Working with DDS Domains > DomainParticipants > Getting the Implicit Publisher or Subscriber

Getting the Implicit Publisher or Subscriber

The get_implicit_publisher() operation allows you to access the DomainParticipant’s implicit Publisher. If one does not already exist, this operation creates an implicit Publisher.

There is a similar operation for implicit Subscribers:

DDSPublisher  * get_implicit_publisher ()
DDSSubscriber * get_implicit_subscriber()

There can only be one implicit Publisher and one implicit Subscriber per DomainParticipant. They are created with default QoS values (DDS_PUBLISHER_QOS_DEFAULT) and no Listener. For more information, see Creating Publishers Explicitly vs. Implicitly. You can use an implicit Publisher or implicit Subscriber just like an explicitly created one.

An implicit Publisher/Subscriber is deleted automatically when delete_contained_entities() is called. It can also be deleted by calling delete_publisher/subscriber() with the implicit Publisher/Subscriber as a parameter.

When a DomainParticipant is deleted, if there are no attached DataReaders that belong to the implicit Subscriber or no attached DataWriters that belong to the implicit Publisher, any implicit Publisher/Subscriber will be deleted by the middleware implicitly.

Note: It is not safe to create an implicit Publisher/Subscriber while another thread may be simultaneously calling set_default_[publisher/subscriber]_qos().

© 2015 RTI