#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. | |
Protected Member Functions | |
PxDeletionListener () | |
virtual | ~PxDeletionListener () |
PxDeletionListener::PxDeletionListener | ( | ) | [inline, protected] |
virtual PxDeletionListener::~PxDeletionListener | ( | ) | [inline, protected, virtual] |
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.
[in] | observed | The object for which the deletion event gets fired. |
[in] | userData | The 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] | deletionEvent | The type of deletion event. Do not dereference the object pointer argument if the event is eMEMORY_RELEASE. |