OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
multiobjectcache.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_COMPONENTS_MULTIOBJECTCACHE_H
2 #define OPENMW_COMPONENTS_MULTIOBJECTCACHE_H
3 
4 #include <map>
5 #include <string>
6 
7 #include <osg/ref_ptr>
8 #include <osg/Referenced>
9 
10 namespace osg
11 {
12  class Object;
13  class State;
14 }
15 
16 namespace Resource
17 {
18 
20  class MultiObjectCache : public osg::Referenced
21  {
22  public:
25 
27 
28  void addEntryToObjectCache(const std::string& filename, osg::Object* object);
29 
31  osg::ref_ptr<osg::Object> takeFromObjectCache(const std::string& fileName);
32 
34  void releaseGLObjects(osg::State* state);
35 
36  protected:
37 
38  typedef std::multimap<std::string, osg::ref_ptr<osg::Object> > ObjectCacheMap;
39 
41  OpenThreads::Mutex _objectCacheMutex;
42 
43  };
44 
45 }
46 
47 #endif
ObjectCacheMap _objectCache
Definition: multiobjectcache.hpp:40
void addEntryToObjectCache(const std::string &filename, osg::Object *object)
Definition: multiobjectcache.cpp:46
~MultiObjectCache()
Definition: multiobjectcache.cpp:15
OpenThreads::Mutex _objectCacheMutex
Definition: multiobjectcache.hpp:41
Cache for "non reusable" objects.
Definition: multiobjectcache.hpp:20
osg::ref_ptr< osg::Object > takeFromObjectCache(const std::string &fileName)
Definition: multiobjectcache.cpp:52
State
Definition: state.hpp:6
void releaseGLObjects(osg::State *state)
Definition: multiobjectcache.cpp:66
void removeUnreferencedObjectsInCache()
Definition: multiobjectcache.cpp:20
MultiObjectCache()
Definition: multiobjectcache.cpp:10
std::multimap< std::string, osg::ref_ptr< osg::Object > > ObjectCacheMap
Definition: multiobjectcache.hpp:38