OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
resourcemanager.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_COMPONENTS_RESOURCE_MANAGER_H
2 #define OPENMW_COMPONENTS_RESOURCE_MANAGER_H
3 
4 #include <osg/ref_ptr>
5 
6 namespace VFS
7 {
8  class Manager;
9 }
10 
11 namespace osg
12 {
13  class Stats;
14  class State;
15 }
16 
17 namespace Resource
18 {
19  class ObjectCache;
20 
24  {
25  public:
26  ResourceManager(const VFS::Manager* vfs);
27  virtual ~ResourceManager();
28 
30  virtual void updateCache(double referenceTime);
31 
33  virtual void clearCache();
34 
36  void setExpiryDelay (double expiryDelay);
37 
38  const VFS::Manager* getVFS() const;
39 
40  virtual void reportStats(unsigned int frameNumber, osg::Stats* stats) const {}
41 
42  virtual void releaseGLObjects(osg::State* state);
43 
44  protected:
46  osg::ref_ptr<Resource::ObjectCache> mCache;
47  double mExpiryDelay;
48  };
49 
50 }
51 
52 #endif
osg::ref_ptr< Resource::ObjectCache > mCache
Definition: resourcemanager.hpp:46
virtual ~ResourceManager()
Definition: resourcemanager.cpp:16
ResourceManager(const VFS::Manager *vfs)
Definition: resourcemanager.cpp:8
const VFS::Manager * getVFS() const
Definition: resourcemanager.cpp:36
virtual void updateCache(double referenceTime)
Clear cache entries that have not been referenced for longer than expiryDelay.
Definition: resourcemanager.cpp:20
virtual void reportStats(unsigned int frameNumber, osg::Stats *stats) const
Definition: resourcemanager.hpp:40
void setExpiryDelay(double expiryDelay)
How long to keep objects in cache after no longer being referenced.
Definition: resourcemanager.cpp:31
virtual void clearCache()
Clear all cache entries.
Definition: resourcemanager.cpp:26
virtual void releaseGLObjects(osg::State *state)
Definition: resourcemanager.cpp:41
double mExpiryDelay
Definition: resourcemanager.hpp:47
const VFS::Manager * mVFS
Definition: resourcemanager.hpp:45
State
Definition: state.hpp:6
The main class responsible for loading files from a virtual file system.
Definition: manager.hpp:20
Base class for managers that require a virtual file system and object cache.
Definition: resourcemanager.hpp:23