OpenSceneGraph  3.4.0
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
osgDB::ObjectCache Class Reference
Inheritance diagram for osgDB::ObjectCache:
Inheritance graph
[legend]

List of all members.

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.
void removeExpiredObjectsInCache (double expiryTime)
 Removed object in the cache which have a time stamp at or before the specified expiry time.
void clear ()
 Remove all objects in the cache regardless of having external references or expiry times.
void addObjectCache (ObjectCache *object)
 Add contents of specified ObjectCache to this object cache.
void addEntryToObjectCache (const std::string &filename, osg::Object *object, double timestamp=0.0)
 Add a filename,object,timestamp triple to the Registry::ObjectCache.
void removeFromObjectCache (const std::string &fileName)
 Remove Object from cache.
osg::ObjectgetFromObjectCache (const std::string &fileName)
 Get an Object from the object cache.
osg::ref_ptr< osg::ObjectgetRefFromObjectCache (const std::string &fileName)
 Get an ref_ptr<Object> from the object cache.
void releaseGLObjects (osg::State *state)
 call rleaseGLObjects on all objects attached to the object cache.

Protected Types

typedef std::pair
< osg::ref_ptr< osg::Object >
, double > 
ObjectTimeStampPair
typedef std::map< std::string,
ObjectTimeStampPair
ObjectCacheMap

Protected Member Functions

virtual ~ObjectCache ()

Protected Attributes

ObjectCacheMap _objectCache
OpenThreads::Mutex _objectCacheMutex

Member Typedef Documentation

typedef std::map<std::string, ObjectTimeStampPair > osgDB::ObjectCache::ObjectCacheMap [protected]
typedef std::pair<osg::ref_ptr<osg::Object>, double > osgDB::ObjectCache::ObjectTimeStampPair [protected]

Constructor & Destructor Documentation

virtual osgDB::ObjectCache::~ObjectCache ( ) [protected, virtual]

Member Function Documentation

void osgDB::ObjectCache::addEntryToObjectCache ( const std::string &  filename,
osg::Object object,
double  timestamp = 0.0 
)

Add a filename,object,timestamp triple to the Registry::ObjectCache.

Add contents of specified ObjectCache to this object cache.

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

osg::Object* osgDB::ObjectCache::getFromObjectCache ( const std::string &  fileName)

Get an Object from the object cache.

Get an ref_ptr<Object> from the object cache.

call rleaseGLObjects on all objects attached to the object cache.

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)

Remove Object from cache.

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

OpenThreads::Mutex osgDB::ObjectCache::_objectCacheMutex [protected]

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

osg logo
Generated at Tue Dec 8 2015 00:16:46 for the OpenSceneGraph by doxygen 1.7.6.1.