mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-10 06:44:29 +00:00
Add support for Functors to ObjectCache
This commit is contained in:
parent
9d72d9f0c9
commit
4cd4457d21
@ -73,6 +73,15 @@ class ObjectCache : public osg::Referenced
|
|||||||
/** call node->accept(nv); for all nodes in the objectCache. */
|
/** call node->accept(nv); for all nodes in the objectCache. */
|
||||||
void accept(osg::NodeVisitor& nv);
|
void accept(osg::NodeVisitor& nv);
|
||||||
|
|
||||||
|
/** call operator()(osg::Object*) for each object in the cache. */
|
||||||
|
template <class Functor>
|
||||||
|
void call(Functor& f)
|
||||||
|
{
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_objectCacheMutex);
|
||||||
|
for (ObjectCacheMap::iterator it = _objectCache.begin(); it != _objectCache.end(); ++it)
|
||||||
|
f(it->second.first.get());
|
||||||
|
}
|
||||||
|
|
||||||
/** Get the number of objects in the cache. */
|
/** Get the number of objects in the cache. */
|
||||||
unsigned int getCacheSize() const;
|
unsigned int getCacheSize() const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user