(Note: in the Modern C++ API, Entities are automatically destroyed, see 4.1.1 Creating and Deleting DDS Entities)
To delete a DataReader:
Delete any ReadConditions and QueryConditions that were created with the DataReader. Use the DataReader’s delete_readcondition() operation to delete them one at a time, or use the delete_contained_entities() operation (8.3.3.1 Deleting Contained ReadConditions) to delete them all at the same time.
DDS_ReturnCode_t delete_readcondition (DDSReadCondition *condition)
Delete the DataReader by using the Subscriber’s delete_datareader() operation (8.2.3 Deleting Subscribers).
Note: A DataReader cannot be deleted within its own reader listener callback, see 4.5.1 Restricted Operations in Listener Callbacks.
To delete all of a Subscriber’s DataReaders, use the Subscriber’s delete_contained_entities() operation (see 8.2.3.1 Deleting Contained DataReaders).
The DataReader’s delete_contained_entities() operation deletes all the ReadConditions and QueryConditions (4.6.7 ReadConditions and QueryConditions) that were created by the DataReader.
DDS_ReturnCode_t delete_contained_entities ()
After this operation returns successfully, the application may delete the DataReader (see 8.3.3 Deleting DataReaders).
© 2020 RTI