OpenSceneGraph
|
Classes | |
struct | ClassComp |
Public Member Functions | |
ObjectCache () | |
void | updateTimeStampOfObjectsInCacheWithExternalReferences (double referenceTime) |
For each object in the cache which has an reference count greater than 1 (and therefore referenced by elsewhere in the application) set the time stamp for that object in the cache to specified time. More... | |
void | removeExpiredObjectsInCache (double expiryTime) |
Removed object in the cache which have a time stamp at or before the specified expiry time. More... | |
void | clear () |
Remove all objects in the cache regardless of having external references or expiry times. More... | |
void | addObjectCache (ObjectCache *object) |
Add contents of specified ObjectCache to this object cache. More... | |
void | addEntryToObjectCache (const std::string &filename, osg::Object *object, double timestamp=0.0, const Options *options=NULL) |
Add a filename,object,timestamp triple to the Registry::ObjectCache. More... | |
void | removeFromObjectCache (const std::string &fileName, const Options *options=NULL) |
Remove Object from cache. More... | |
osg::Object * | getFromObjectCache (const std::string &fileName, const Options *options=NULL) |
Deprecated, the getFromObjectCache() returns a C pointer that is not thread safe when using database paging, please use the thread safe getRefFromObjectCache() method instead. More... | |
osg::ref_ptr< osg::Object > | getRefFromObjectCache (const std::string &fileName, const Options *options=NULL) |
Get a thread safe ref_ptr<Object> from the object cache. More... | |
void | releaseGLObjects (osg::State *state) |
call rleaseGLObjects on all objects attached to the object cache. More... | |
Public Member Functions inherited from osg::Referenced | |
Referenced () | |
Referenced (bool threadSafeRefUnref) | |
Deprecated, Referenced is now always uses thread safe ref/unref, use default Referenced() constructor instead. More... | |
Referenced (const Referenced &) | |
Referenced & | operator= (const Referenced &) |
virtual void | setThreadSafeRefUnref (bool) |
Deprecated, Referenced is always theadsafe so there method now has no effect and does not need to be called. More... | |
bool | getThreadSafeRefUnref () const |
Get whether a mutex is used to ensure ref() and unref() are thread safe. More... | |
OpenThreads::Mutex * | getRefMutex () const |
Get the mutex used to ensure thread safety of ref()/unref(). More... | |
int | ref () const |
Increment the reference count by one, indicating that this object has another pointer which is referencing it. More... | |
int | unref () const |
Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More... | |
int | unref_nodelete () const |
Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More... | |
int | referenceCount () const |
Return the number of pointers currently referencing this object. More... | |
ObserverSet * | getObserverSet () const |
Get the ObserverSet if one is attached, otherwise return NULL. More... | |
ObserverSet * | getOrCreateObserverSet () const |
Get the ObserverSet if one is attached, otherwise create an ObserverSet, attach it, then return this newly created ObserverSet. More... | |
void | addObserver (Observer *observer) const |
Add a Observer that is observing this object, notify the Observer when this object gets deleted. More... | |
void | removeObserver (Observer *observer) const |
Remove Observer that is observing this object. More... | |
Protected Types | |
typedef std::pair< std::string, osg::ref_ptr< const osgDB::Options > > | FileNameOptionsPair |
typedef std::pair< osg::ref_ptr< osg::Object >, double > | ObjectTimeStampPair |
typedef std::map< FileNameOptionsPair, ObjectTimeStampPair, ClassComp > | ObjectCacheMap |
Protected Member Functions | |
virtual | ~ObjectCache () |
ObjectCacheMap::iterator | find (const std::string &fileName, const osgDB::Options *options) |
Protected Member Functions inherited from osg::Referenced | |
virtual | ~Referenced () |
void | signalObserversAndDelete (bool signalDelete, bool doDelete) const |
void | deleteUsingDeleteHandler () const |
Protected Attributes | |
ObjectCacheMap | _objectCache |
OpenThreads::Mutex | _objectCacheMutex |
Protected Attributes inherited from osg::Referenced | |
OpenThreads::AtomicPtr | _observerSet |
OpenThreads::Atomic | _refCount |
Additional Inherited Members | |
Static Public Member Functions inherited from osg::Referenced | |
static OpenThreads::Mutex * | getGlobalReferencedMutex () |
Get the optional global Referenced mutex, this can be shared between all osg::Referenced. More... | |
static void | setDeleteHandler (DeleteHandler *handler) |
Set a DeleteHandler to which deletion of all referenced counted objects will be delegated. More... | |
static DeleteHandler * | getDeleteHandler () |
Get a DeleteHandler. More... | |
|
protected |
|
protected |
|
protected |
osgDB::ObjectCache::ObjectCache | ( | ) |
|
protectedvirtual |
void osgDB::ObjectCache::addEntryToObjectCache | ( | const std::string & | filename, |
osg::Object * | object, | ||
double | timestamp = 0.0 , |
||
const Options * | options = NULL |
||
) |
Add a filename,object,timestamp triple to the Registry::ObjectCache.
void osgDB::ObjectCache::addObjectCache | ( | ObjectCache * | object | ) |
Add contents of specified ObjectCache to this object cache.
void osgDB::ObjectCache::clear | ( | ) |
Remove all objects in the cache regardless of having external references or expiry times.
|
protected |
osg::Object* osgDB::ObjectCache::getFromObjectCache | ( | const std::string & | fileName, |
const Options * | options = NULL |
||
) |
Deprecated, the getFromObjectCache() returns a C pointer that is not thread safe when using database paging, please use the thread safe getRefFromObjectCache() method instead.
osg::ref_ptr<osg::Object> osgDB::ObjectCache::getRefFromObjectCache | ( | const std::string & | fileName, |
const Options * | options = NULL |
||
) |
Get a thread safe ref_ptr<Object> from the object cache.
void osgDB::ObjectCache::releaseGLObjects | ( | osg::State * | state | ) |
call rleaseGLObjects on all objects attached to the object cache.
void osgDB::ObjectCache::removeExpiredObjectsInCache | ( | double | expiryTime | ) |
Removed object in the cache which have a time stamp at or before the specified expiry time.
This would typically be called once per frame by applications which are doing database paging, and need to prune objects that are no longer required, and called after the a called after the call to updateTimeStampOfObjectsInCacheWithExternalReferences(expirtyTime).
void osgDB::ObjectCache::removeFromObjectCache | ( | const std::string & | fileName, |
const Options * | options = NULL |
||
) |
Remove Object from cache.
void osgDB::ObjectCache::updateTimeStampOfObjectsInCacheWithExternalReferences | ( | double | referenceTime | ) |
For each object in the cache which has an reference count greater than 1 (and therefore referenced by elsewhere in the application) set the time stamp for that object in the cache to specified time.
This would typically be called once per frame by applications which are doing database paging, and need to prune objects that are no longer required. The time used should be taken from the FrameStamp::getReferenceTime().
|
protected |
|
protected |