Fix finding object cache entries.

This commit is contained in:
Ralf Habacker 2016-06-17 17:48:31 +02:00 committed by Robert Osfield
parent 5f38374b7a
commit 69929f596f
2 changed files with 13 additions and 2 deletions

View File

@ -68,9 +68,15 @@ class OSGDB_EXPORT ObjectCache : public osg::Referenced
virtual ~ObjectCache(); virtual ~ObjectCache();
typedef std::pair<osg::ref_ptr<osg::Object>, double > ObjectTimeStampPair;
typedef std::pair<std::string, osg::ref_ptr<const osgDB::Options> > FileNameOptionsPair; typedef std::pair<std::string, osg::ref_ptr<const osgDB::Options> > FileNameOptionsPair;
typedef std::map<FileNameOptionsPair, ObjectTimeStampPair > ObjectCacheMap;
class ClassComp {
public:
bool operator() (const ObjectCache::FileNameOptionsPair& lhs, const ObjectCache::FileNameOptionsPair& rhs);
};
typedef std::pair<osg::ref_ptr<osg::Object>, double > ObjectTimeStampPair;
typedef std::map<FileNameOptionsPair, ObjectTimeStampPair, ClassComp> ObjectCacheMap;
ObjectCacheMap _objectCache; ObjectCacheMap _objectCache;
OpenThreads::Mutex _objectCacheMutex; OpenThreads::Mutex _objectCacheMutex;

View File

@ -16,6 +16,11 @@
using namespace osgDB; using namespace osgDB;
bool ObjectCache::ClassComp::operator() (const ObjectCache::FileNameOptionsPair& lhs, const ObjectCache::FileNameOptionsPair& rhs)
{
return lhs.first < rhs.first || *lhs.second < *rhs.second;
}
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
// //
// ObjectCache // ObjectCache