forked from mirror/openmw-tes3mp
Remove unused ObjectCache functions
This commit is contained in:
parent
5efaa9817c
commit
778bce3ae9
2 changed files with 0 additions and 30 deletions
|
@ -31,42 +31,18 @@ ObjectCache::~ObjectCache()
|
||||||
// OSG_NOTICE<<"Destructed ObjectCache"<<std::endl;
|
// OSG_NOTICE<<"Destructed ObjectCache"<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectCache::addObjectCache(ObjectCache* objectCache)
|
|
||||||
{
|
|
||||||
// don't allow a cache to be added to itself.
|
|
||||||
if (objectCache==this) return;
|
|
||||||
|
|
||||||
// lock both ObjectCache to prevent their contents from being modified by other threads while we merge.
|
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock1(_objectCacheMutex);
|
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock2(objectCache->_objectCacheMutex);
|
|
||||||
|
|
||||||
// OSG_NOTICE<<"Inserting objects to main ObjectCache "<<objectCache->_objectCache.size()<<std::endl;
|
|
||||||
|
|
||||||
_objectCache.insert(objectCache->_objectCache.begin(), objectCache->_objectCache.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ObjectCache::addEntryToObjectCache(const std::string& filename, osg::Object* object, double timestamp)
|
void ObjectCache::addEntryToObjectCache(const std::string& filename, osg::Object* object, double timestamp)
|
||||||
{
|
{
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_objectCacheMutex);
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_objectCacheMutex);
|
||||||
_objectCache[filename]=ObjectTimeStampPair(object,timestamp);
|
_objectCache[filename]=ObjectTimeStampPair(object,timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Object* ObjectCache::getFromObjectCache(const std::string& fileName)
|
|
||||||
{
|
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_objectCacheMutex);
|
|
||||||
ObjectCacheMap::iterator itr = _objectCache.find(fileName);
|
|
||||||
if (itr!=_objectCache.end()) return itr->second.first.get();
|
|
||||||
else return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Object> ObjectCache::getRefFromObjectCache(const std::string& fileName)
|
osg::ref_ptr<osg::Object> ObjectCache::getRefFromObjectCache(const std::string& fileName)
|
||||||
{
|
{
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_objectCacheMutex);
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_objectCacheMutex);
|
||||||
ObjectCacheMap::iterator itr = _objectCache.find(fileName);
|
ObjectCacheMap::iterator itr = _objectCache.find(fileName);
|
||||||
if (itr!=_objectCache.end())
|
if (itr!=_objectCache.end())
|
||||||
{
|
{
|
||||||
// OSG_NOTICE<<"Found "<<fileName<<" in ObjectCache "<<this<<std::endl;
|
|
||||||
return itr->second.first;
|
return itr->second.first;
|
||||||
}
|
}
|
||||||
else return 0;
|
else return 0;
|
||||||
|
|
|
@ -49,18 +49,12 @@ class ObjectCache : 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 clear();
|
void clear();
|
||||||
|
|
||||||
/** Add contents of specified ObjectCache to this object cache.*/
|
|
||||||
void addObjectCache(ObjectCache* object);
|
|
||||||
|
|
||||||
/** Add a filename,object,timestamp triple to the Registry::ObjectCache.*/
|
/** Add a filename,object,timestamp triple to the Registry::ObjectCache.*/
|
||||||
void addEntryToObjectCache(const std::string& filename, osg::Object* object, double timestamp = 0.0);
|
void addEntryToObjectCache(const std::string& filename, osg::Object* object, double timestamp = 0.0);
|
||||||
|
|
||||||
/** Remove Object from cache.*/
|
/** Remove Object from cache.*/
|
||||||
void removeFromObjectCache(const std::string& fileName);
|
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*/
|
/** Get an ref_ptr<Object> from the object cache*/
|
||||||
osg::ref_ptr<osg::Object> getRefFromObjectCache(const std::string& fileName);
|
osg::ref_ptr<osg::Object> getRefFromObjectCache(const std::string& fileName);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue