30.3 Deleting Publishers
(Note: in the Modern C++ API, Entities are automatically destroyed, see 15.1 Creating and Deleting DDS Entities)
This section applies to both implicitly and explicitly created Publishers.
- 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 (30.3.1 Deleting Contained DataWriters) to delete them all at the same time.
DDS_ReturnCode_t delete_datawriter (DDSDataWriter *a_datawriter)
- Delete the Publisher by using the DomainParticipant’s delete_publisher() operation.
DDS_ReturnCode_t delete_publisher (DDSPublisher *p)
Note: A Publisher cannot be deleted within a Listener callback, see 15.8.8.1 Restricted Operations in Listener Callbacks.
30.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 30.3 Deleting Publishers).