OpenSceneGraph
3.5.1
|
Class for overriding the default delete behaviour so that users can implement their own object deletion schemes. More...
Public Types | |
typedef std::pair< unsigned int, const osg::Referenced * > | FrameNumberObjectPair |
typedef std::list< FrameNumberObjectPair > | ObjectsToDeleteList |
Public Member Functions | |
DeleteHandler (int numberOfFramesToRetainObjects=0) | |
virtual | ~DeleteHandler () |
void | setNumFramesToRetainObjects (unsigned int numberOfFramesToRetainObjects) |
Set the number of frames to retain objects that have been requested for deletion. More... | |
unsigned int | getNumFramesToRetainObjects () const |
void | setFrameNumber (unsigned int frameNumber) |
Set the current frame number so that subsequent deletes get tagged as associated with this frame. More... | |
unsigned int | getFrameNumber () const |
Get the current frame number. More... | |
void | doDelete (const Referenced *object) |
virtual void | flush () |
Flush objects that are ready to be fully deleted. More... | |
virtual void | flushAll () |
Flush all objects that the DeleteHandler holds. More... | |
virtual void | requestDelete (const osg::Referenced *object) |
Request the deletion of an object. More... | |
Protected Member Functions | |
DeleteHandler (const DeleteHandler &) | |
DeleteHandler | operator= (const DeleteHandler &) |
Protected Attributes | |
unsigned int | _numFramesToRetainObjects |
unsigned int | _currentFrameNumber |
OpenThreads::Mutex | _mutex |
ObjectsToDeleteList | _objectsToDelete |
Class for overriding the default delete behaviour so that users can implement their own object deletion schemes.
This might be used to implement a protection scheme that avoids multiple threads deleting objects unintentionally. Note, the DeleteHandler cannot itself be reference counted, otherwise it would be responsible for deleting itself! A static auto_ptr<> is used internally in Referenced.cpp to manage the DeleteHandler's memory.
typedef std::pair<unsigned int, const osg::Referenced*> osg::DeleteHandler::FrameNumberObjectPair |
typedef std::list<FrameNumberObjectPair> osg::DeleteHandler::ObjectsToDeleteList |
osg::DeleteHandler::DeleteHandler | ( | int | numberOfFramesToRetainObjects = 0 | ) |
|
virtual |
|
inlineprotected |
|
inline |
|
virtual |
Flush objects that are ready to be fully deleted.
|
virtual |
Flush all objects that the DeleteHandler holds.
Note, this should only be called if there are no threads running with non ref_ptr<> pointers, such as graphics threads.
|
inline |
Get the current frame number.
|
inline |
|
inlineprotected |
|
virtual |
Request the deletion of an object.
Depending on users implementation of DeleteHandler, the delete of the object may occur straight away or be delayed until doDelete is called. The default implementation does a delete straight away.
|
inline |
Set the current frame number so that subsequent deletes get tagged as associated with this frame.
|
inline |
Set the number of frames to retain objects that have been requested for deletion.
When set to zero objects are deleted immediately, by setting to 1 they are kept around for an extra frame etc. The ability to retain objects for several frames is useful to prevent premature deletion when objects are still being used by graphics threads that use double buffering of rendering data structures with non ref_ptr<> pointers to scene graph elements.
|
protected |
|
protected |
|
protected |
|
protected |
Generated at Wed Nov 11 2015 22:14:32 for the OpenSceneGraph by doxygen 1.8.10. |