OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Resource::ObjectCache Class Reference

#include <objectcache.hpp>

Inheritance diagram for Resource::ObjectCache:
Collaboration diagram for Resource::ObjectCache:

Public Member Functions

 ObjectCache ()
 
void updateTimeStampOfObjectsInCacheWithExternalReferences (double referenceTime)
 
void removeExpiredObjectsInCache (double expiryTime)
 
void clear ()
 
void addEntryToObjectCache (const std::string &filename, osg::Object *object, double timestamp=0.0)
 
void removeFromObjectCache (const std::string &fileName)
 
osg::ref_ptr< osg::Object > getRefFromObjectCache (const std::string &fileName)
 
void releaseGLObjects (osg::State *state)
 
void accept (osg::NodeVisitor &nv)
 

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 > Resource::ObjectCache::ObjectCacheMap
protected
typedef std::pair<osg::ref_ptr<osg::Object>, double > Resource::ObjectCache::ObjectTimeStampPair
protected

Constructor & Destructor Documentation

Resource::ObjectCache::ObjectCache ( )
Resource::ObjectCache::~ObjectCache ( )
protectedvirtual

Member Function Documentation

void Resource::ObjectCache::accept ( osg::NodeVisitor &  nv)

call node->accept(nv); for all nodes in the objectCache.

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

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

void Resource::ObjectCache::clear ( )

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

osg::ref_ptr< osg::Object > Resource::ObjectCache::getRefFromObjectCache ( const std::string &  fileName)

Get an ref_ptr<Object> from the object cache

void Resource::ObjectCache::releaseGLObjects ( osg::State *  state)

call releaseGLObjects on all objects attached to the object cache.

void Resource::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 Resource::ObjectCache::removeFromObjectCache ( const std::string &  fileName)

Remove Object from cache.

void Resource::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

ObjectCacheMap Resource::ObjectCache::_objectCache
protected
OpenThreads::Mutex Resource::ObjectCache::_objectCacheMutex
protected

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