7.2.3 Deleting Publishers

(Note: in the Modern C++ API, Entities are automatically destroyed, see 4.1.1 Creating and Deleting DDS Entities)

This section applies to both implicitly and explicitly created Publishers.

To delete a Publisher:

  1. You must first delete all DataWriters that were created with the Publisher. Use the Publisher’s delete_datawriter() operation to delete them one at a time, or use the delete_contained_entities() operation (7.2.3.1 Deleting Contained DataWriters) to delete them all at the same time.
  2. DDS_ReturnCode_t delete_datawriter (DDSDataWriter *a_datawriter)
  1. Delete the Publisher by using the DomainParticipant’s delete_publisher() operation.
  2. DDS_ReturnCode_t delete_publisher (DDSPublisher *p)

Note: A Publisher cannot be deleted within a Listener callback, see 4.5.1 Restricted Operations in Listener Callbacks.

7.2.3.1 Deleting Contained DataWriters

The Publisher’s delete_contained_entities() operation deletes all the DataWriters that were created by the Publisher.

DDS_ReturnCode_t delete_contained_entities () 

After this operation returns successfully, the application may delete the Publisher (see 7.2.3 Deleting Publishers).

© 2020 RTI