PxDeletionListener Class Referenceabstract

interface to get notification on object deletion More...

#include <PxDeletionListener.h>

Public Member Functions

virtual void onRelease (const PxBase *observed, void *userData, PxDeletionEventFlag::Enum deletionEvent)=0
 Notification if an object or its memory gets released. More...
 

Protected Member Functions

 PxDeletionListener ()
 
virtual ~PxDeletionListener ()
 

Detailed Description

interface to get notification on object deletion

Constructor & Destructor Documentation

◆ PxDeletionListener()

PxDeletionListener::PxDeletionListener ( )
inlineprotected

◆ ~PxDeletionListener()

virtual PxDeletionListener::~PxDeletionListener ( )
inlineprotectedvirtual

Member Function Documentation

◆ onRelease()

virtual void PxDeletionListener::onRelease ( const PxBase observed,
void *  userData,
PxDeletionEventFlag::Enum  deletionEvent 
)
pure virtual

Notification if an object or its memory gets released.

If release() gets called on a PxBase object, an eUSER_RELEASE event will get fired immediately. The object state can be queried in the callback but it is not allowed to change the state. Furthermore, when reading from the object it is the user's responsibility to make sure that no other thread is writing at the same time to the object (this includes the simulation itself, i.e., PxScene::fetchResults() must not get called at the same time).

Calling release() on a PxBase object does not necessarily trigger its destructor immediately. For example, the object can be shared and might still be referenced by other objects or the simulation might still be running and accessing the object state. In such cases the destructor will be called as soon as it is safe to do so. After the destruction of the object and its memory, an eMEMORY_RELEASE event will get fired. In this case it is not allowed to dereference the object pointer in the callback.

Parameters
[in]observedThe object for which the deletion event gets fired.
[in]userDataThe user data pointer of the object for which the deletion event gets fired. Not available for all object types in which case it will be set to 0.
[in]deletionEventThe type of deletion event. Do not dereference the object pointer argument if the event is eMEMORY_RELEASE.

The documentation for this class was generated from the following file: