Added removeFromObjectCache method.

This commit is contained in:
Robert Osfield 2011-11-04 12:44:01 +00:00
parent 3c461dd706
commit 747654fb6d
2 changed files with 12 additions and 0 deletions

View File

@ -438,12 +438,17 @@ class OSGDB_EXPORT Registry : public osg::Referenced
/** Add a filename,object,timestamp triple to the Registry::ObjectCache.*/
void addEntryToObjectCache(const std::string& filename, osg::Object* object, double timestamp = 0.0);
/** Remove Object from cache.*/
void removeFromObjectCache(const std::string& fileName);
/** Get an Object from the object cache*/
osg::Object* getFromObjectCache(const std::string& fileName);
/** Get an ref_ptr<Object> from the object cache*/
osg::ref_ptr<osg::Object> getRefFromObjectCache(const std::string& fileName);
/** Add archive to archive cache so that future calls reference this archive.*/
void addToArchiveCache(const std::string& fileName, osgDB::Archive* archive);

View File

@ -1653,6 +1653,13 @@ void Registry::removeExpiredObjectsInCache(const osg::FrameStamp& frameStamp)
}
void Registry::removeFromObjectCache(const std::string& fileName)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_objectCacheMutex);
ObjectCache::iterator itr = _objectCache.find(fileName);
if (itr!=_objectCache.end()) _objectCache.erase(itr);
}
void Registry::clearObjectCache()
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_objectCacheMutex);