From 747654fb6dffc41fa14ed844d18b5ab1d43558ef Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 4 Nov 2011 12:44:01 +0000 Subject: [PATCH] Added removeFromObjectCache method. --- include/osgDB/Registry | 5 +++++ src/osgDB/Registry.cpp | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/include/osgDB/Registry b/include/osgDB/Registry index 641f1e08f..b84d61954 100644 --- a/include/osgDB/Registry +++ b/include/osgDB/Registry @@ -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 from the object cache*/ osg::ref_ptr 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); diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index f68adb855..b94c20396 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -1653,6 +1653,13 @@ void Registry::removeExpiredObjectsInCache(const osg::FrameStamp& frameStamp) } +void Registry::removeFromObjectCache(const std::string& fileName) +{ + OpenThreads::ScopedLock lock(_objectCacheMutex); + ObjectCache::iterator itr = _objectCache.find(fileName); + if (itr!=_objectCache.end()) _objectCache.erase(itr); +} + void Registry::clearObjectCache() { OpenThreads::ScopedLock lock(_objectCacheMutex);