openscenegraph
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
osgDB::ObjectCache Class Reference

#include <ObjectCache>

Inheritance diagram for osgDB::ObjectCache:
osg::Referenced

Classes

struct  ClassComp
 

Public Member Functions

 ObjectCache ()
 
void updateTimeStampOfObjectsInCacheWithExternalReferences (double referenceTime)
 
void removeExpiredObjectsInCache (double expiryTime)
 
void clear ()
 
void addObjectCache (ObjectCache *object)
 
void addEntryToObjectCache (const std::string &filename, osg::Object *object, double timestamp=0.0, const Options *options=NULL)
 
void removeFromObjectCache (const std::string &fileName, const Options *options=NULL)
 
osg::ObjectgetFromObjectCache (const std::string &fileName, const Options *options=NULL)
 
osg::ref_ptr< osg::ObjectgetRefFromObjectCache (const std::string &fileName, const Options *options=NULL)
 
void releaseGLObjects (osg::State *state)
 
- Public Member Functions inherited from osg::Referenced
 Referenced ()
 
 Referenced (bool threadSafeRefUnref)
 
 Referenced (const Referenced &)
 
Referencedoperator= (const Referenced &)
 
virtual void setThreadSafeRefUnref (bool)
 
bool getThreadSafeRefUnref () const
 
OpenThreads::MutexgetRefMutex () const
 
int ref () const
 
int unref () const
 
int unref_nodelete () const
 
int referenceCount () const
 
ObserverSetgetObserverSet () const
 
ObserverSetgetOrCreateObserverSet () const
 
void addObserver (Observer *observer) const
 
void removeObserver (Observer *observer) const
 

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, ClassCompObjectCacheMap
 

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::MutexgetGlobalReferencedMutex ()
 
static void setDeleteHandler (DeleteHandler *handler)
 
static DeleteHandlergetDeleteHandler ()
 

Member Typedef Documentation

◆ FileNameOptionsPair

typedef std::pair<std::string, osg::ref_ptr<const osgDB::Options> > osgDB::ObjectCache::FileNameOptionsPair
protected

◆ ObjectCacheMap

◆ ObjectTimeStampPair

typedef std::pair<osg::ref_ptr<osg::Object>, double > osgDB::ObjectCache::ObjectTimeStampPair
protected

Constructor & Destructor Documentation

◆ ObjectCache()

osgDB::ObjectCache::ObjectCache ( )

◆ ~ObjectCache()

virtual osgDB::ObjectCache::~ObjectCache ( )
protectedvirtual

Member Function Documentation

◆ addEntryToObjectCache()

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.

◆ addObjectCache()

void osgDB::ObjectCache::addObjectCache ( ObjectCache object)

Add contents of specified ObjectCache to this object cache.

◆ clear()

void osgDB::ObjectCache::clear ( )

Remove all objects in the cache regardless of having external references or expiry times.

◆ find()

ObjectCacheMap::iterator osgDB::ObjectCache::find ( const std::string &  fileName,
const osgDB::Options options 
)
protected

◆ getFromObjectCache()

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.

◆ getRefFromObjectCache()

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

◆ releaseGLObjects()

void osgDB::ObjectCache::releaseGLObjects ( osg::State state)

call rleaseGLObjects on all objects attached to the object cache.

◆ removeExpiredObjectsInCache()

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).

◆ removeFromObjectCache()

void osgDB::ObjectCache::removeFromObjectCache ( const std::string &  fileName,
const Options options = NULL 
)

Remove Object from cache.

◆ updateTimeStampOfObjectsInCacheWithExternalReferences()

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().

Member Data Documentation

◆ _objectCache

ObjectCacheMap osgDB::ObjectCache::_objectCache
protected

◆ _objectCacheMutex

OpenThreads::Mutex osgDB::ObjectCache::_objectCacheMutex
protected

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