Added addEntryToObjectCache method to osgDB::Registry

This commit is contained in:
Robert Osfield
2003-10-01 13:12:25 +00:00
parent 2f4d02278c
commit facbdcf43b
2 changed files with 10 additions and 3 deletions

View File

@@ -191,6 +191,8 @@ class OSGDB_EXPORT Registry : public osg::Referenced
/** Remove all objects in the cache regardless of having external references or expiry times.*/ /** Remove all objects in the cache regardless of having external references or expiry times.*/
void clearObjectCache(); void clearObjectCache();
void addEntryToObjectCache(const std::string& filename, osg::Object* object, double timestamp = 0.0);
/** get the attached library with specified name.*/ /** get the attached library with specified name.*/
DynamicLibrary* getLibrary(const std::string& fileName); DynamicLibrary* getLibrary(const std::string& fileName);

View File

@@ -1165,7 +1165,7 @@ ReaderWriter::ReadResult Registry::readObject(const std::string& fileName,bool u
{ {
// update cache with new entry. // update cache with new entry.
notify(INFO)<<"Adding to cache object "<<file<<std::endl; notify(INFO)<<"Adding to cache object "<<file<<std::endl;
_objectCache[file]=ObjectTimeStampPair(rr.getObject(),0.0f); addEntryToObjectCache(file,rr.getObject());
} }
return rr; return rr;
@@ -1303,7 +1303,7 @@ ReaderWriter::ReadResult Registry::readImage(const std::string& fileName,bool us
{ {
// update cache with new entry. // update cache with new entry.
notify(INFO)<<"Adding to cache image "<<file<<std::endl; notify(INFO)<<"Adding to cache image "<<file<<std::endl;
_objectCache[file]=ObjectTimeStampPair(rr.getObject(),0.0f); addEntryToObjectCache(file,rr.getObject());
} }
return rr; return rr;
@@ -1456,7 +1456,7 @@ ReaderWriter::ReadResult Registry::readNode(const std::string& fileName,bool use
{ {
// update cache with new entry. // update cache with new entry.
notify(INFO)<<"Adding to cache node "<<file<<std::endl; notify(INFO)<<"Adding to cache node "<<file<<std::endl;
_objectCache[file]=ObjectTimeStampPair(rr.getObject(),0.0f); addEntryToObjectCache(file,rr.getObject());
} }
return rr; return rr;
@@ -1547,6 +1547,11 @@ void Registry::convertStringPathIntoFilePathList(const std::string& paths,FilePa
} }
void Registry::addEntryToObjectCache(const std::string& filename, osg::Object* object, double timestamp)
{
_objectCache[filename]=ObjectTimeStampPair(object,timestamp);
}
void Registry::updateTimeStampOfObjectsInCacheWithExtenalReferences(double currentTime) void Registry::updateTimeStampOfObjectsInCacheWithExtenalReferences(double currentTime)
{ {