40 lines
1.8 KiB
Plaintext
40 lines
1.8 KiB
Plaintext
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||
|
*
|
||
|
* This library is open source and may be redistributed and/or modified under
|
||
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||
|
* (at your option) any later version. The full license is in LICENSE file
|
||
|
* included with this distribution, and on the openscenegraph.org website.
|
||
|
*
|
||
|
* This library is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* OpenSceneGraph Public License for more details.
|
||
|
*/
|
||
|
|
||
|
#ifndef OSG_OCCLUDER
|
||
|
#define OSG_OCCLUDER 1
|
||
|
|
||
|
namespace osg {
|
||
|
|
||
|
/** Observer base class for tracking when objects are unreferenced (there reference count goes to 0) and are being deleted.*/
|
||
|
class Observer
|
||
|
{
|
||
|
public:
|
||
|
virtual ~Observer() {}
|
||
|
|
||
|
/** objectUnreferenced(void*) is called when the observed object's referenced count goes to zero, indicating that
|
||
|
* the object will be deleted unless a new reference is made to it. If you wish to prevent deletion of the object
|
||
|
* then it's reference count should be incremented such as via taking a ref_ptr<> to it, if no refernce is taken
|
||
|
* by any of the observers of the object then the object will be deleted, and objectDeleted will in turn be called.
|
||
|
* return true if the Observer wishes to removed from the oberseved objects observer set.*/
|
||
|
virtual bool objectUnreferenced(void*) { return false; }
|
||
|
|
||
|
/** objectDeleted is called when the observed object is about to be deleted. The observer will be automatically
|
||
|
* removed from the observerd objects observer set so there is no need for the objectDeleted implementation
|
||
|
* to call removeObserver() on the observed object. */
|
||
|
virtual void objectDeleted(void*) {}
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif
|