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 
29  void clear();
30 
31  void addEntryToObjectCache(const std::string& filename, osg::Object* object);
32 
34  osg::ref_ptr<osg::Object> takeFromObjectCache(const std::string& fileName);
35 
37  void releaseGLObjects(osg::State* state);
38 
39  unsigned int getCacheSize() const;
40 
41  protected:
42 
43  typedef std::multimap<std::string, osg::ref_ptr<osg::Object> > ObjectCacheMap;
44 
46  mutable OpenThreads::Mutex _objectCacheMutex;
47 
48  };
49 
50 }
51 
52 #endif
void clear()
Definition: multiobjectcache.cpp:46
ObjectCacheMap _objectCache
Definition: multiobjectcache.hpp:45
void addEntryToObjectCache(const std::string &filename, osg::Object *object)
Definition: multiobjectcache.cpp:52
unsigned int getCacheSize() const
Definition: multiobjectcache.cpp:90
~MultiObjectCache()
Definition: multiobjectcache.cpp:15
OpenThreads::Mutex _objectCacheMutex
Definition: multiobjectcache.hpp:46
Cache for "non reusable" objects.
Definition: multiobjectcache.hpp:20
osg::ref_ptr< osg::Object > takeFromObjectCache(const std::string &fileName)
Definition: multiobjectcache.cpp:63
State
Definition: state.hpp:6
void releaseGLObjects(osg::State *state)
Definition: multiobjectcache.cpp:77
void removeUnreferencedObjectsInCache()
Definition: multiobjectcache.cpp:20
MultiObjectCache()
Definition: multiobjectcache.cpp:10
std::multimap< std::string, osg::ref_ptr< osg::Object > > ObjectCacheMap
Definition: multiobjectcache.hpp:43