You are here: Part 2: Core Concepts > Receiving Data > DataReaders > Deleting DataReaders

Deleting DataReaders

(Note: in the Modern C++ API, Entities are automatically destroyed, see 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 (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 (Deleting Subscribers).

Note: A DataReader cannot be deleted within its own reader listener callback, see Restricted Operations in Listener Callbacks.

To delete all of a Subscriber’s DataReaders, use the Subscriber’s delete_contained_entities() operation (see Deleting Contained DataReaders).

Deleting Contained ReadConditions

The DataReader’s delete_contained_entities() operation deletes all the ReadConditions and QueryConditions (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 Deleting DataReaders).

© 2016 RTI