Moved the updating and expiry of the Registry object cache from DatabasePager into osgViewer::Viewer/CompositeViewer.

This commit is contained in:
Robert Osfield
2009-08-05 11:06:53 +00:00
parent 2f3dfc4349
commit df9385ac19
7 changed files with 76 additions and 69 deletions

View File

@@ -418,18 +418,21 @@ class OSGDB_EXPORT Registry : public osg::Referenced
* 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.
* Time value is time in seconds.*/
void updateTimeStampOfObjectsInCacheWithExternalReferences(double currentTime);
* The time used is taken from the FrameStamp::getReferenceTime().*/
void updateTimeStampOfObjectsInCacheWithExternalReferences(const osg::FrameStamp& frameStamp);
/** 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(currentTime).
* Note, the currentTime is not the expiryTime, one would typically set the expiry time
* to a fixed amount of time before currentTime, such as expiryTime = currentTime-10.0.
* Time value is time in seconds.*/
void removeExpiredObjectsInCache(double expiryTime);
* after the call to updateTimeStampOfObjectsInCacheWithExternalReferences(frameStamp).*/
void removeExpiredObjectsInCache(const osg::FrameStamp& frameStamp);
/** set hint to viewer code calling removeExpiredObjectsInCache to specify how long it should give before expiring objects in Registry cache,*/
void setExpiryDelay(double expiryDelay) { _expiryDelay = expiryDelay; }
double getExpiryDelay() const { return _expiryDelay; }
/** Remove all objects in the cache regardless of having external references or expiry times.*/
void clearObjectCache();
@@ -599,6 +602,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced
FilePathList _dataFilePath;
FilePathList _libraryFilePath;
double _expiryDelay;
ObjectCache _objectCache;
OpenThreads::Mutex _objectCacheMutex;

View File

@@ -39,11 +39,12 @@ class OSGVIEWER_EXPORT Scene : public osg::Referenced
osgDB::DatabasePager* getDatabasePager() { return _databasePager.get(); }
const osgDB::DatabasePager* getDatabasePager() const { return _databasePager.get(); }
void setImagePager(osgDB::ImagePager* ip);
osgDB::ImagePager* getImagePager() { return _imagePager.get(); }
const osgDB::ImagePager* getImagePager() const { return _imagePager.get(); }
void updateSceneGraph(osg::NodeVisitor& updateVisitor);
/** Get the Scene object that has the specified node assigned to it.
* return 0 if no Scene has yet been assigned the specified node.*/