diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-12-22 21:33:47 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-12-22 21:33:47 +0000 |
commit | 8d3e43a7510dd7367c3bb62aae6841836f727493 (patch) | |
tree | c644328d6ec98f37252efa063cb720bd71eec2f5 /src/resources/resourcemanager.h | |
parent | aed1ad6210fa1ed0a70da5d87082cedff0bd516a (diff) | |
download | mana-8d3e43a7510dd7367c3bb62aae6841836f727493.tar.gz mana-8d3e43a7510dd7367c3bb62aae6841836f727493.tar.bz2 mana-8d3e43a7510dd7367c3bb62aae6841836f727493.tar.xz mana-8d3e43a7510dd7367c3bb62aae6841836f727493.zip |
Merged revisions 3740 via svnmerge from
https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/trunk
........
r3740 | gmelquio | 2007-11-16 12:06:46 +0100 (vr, 16 nov 2007) | 1 line
Delayed resource deletion by 30 seconds.
........
Diffstat (limited to 'src/resources/resourcemanager.h')
-rw-r--r-- | src/resources/resourcemanager.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h index 1adb8446..abfd629a 100644 --- a/src/resources/resourcemanager.h +++ b/src/resources/resourcemanager.h @@ -24,6 +24,7 @@ #ifndef _TMW_RESOURCE_MANAGER_H #define _TMW_RESOURCE_MANAGER_H +#include <ctime> #include <map> #include <string> #include <vector> @@ -41,7 +42,11 @@ struct SDL_Surface; */ class ResourceManager { + + friend class Resource; + public: + typedef Resource *(*loader)(void *, unsigned); typedef Resource *(*generator)(void *); @@ -156,10 +161,9 @@ class ResourceManager SpriteDef *getSprite(std::string const &path, int variant = 0); /** - * Releases a resource, removing it from the set of loaded resources. + * Releases a resource, placing it in the set of orphaned resources. */ - void - release(const std::string &idPath); + void release(Resource *); /** * Allocates data into a buffer pointer for raw data loading. The @@ -207,10 +211,14 @@ class ResourceManager static void cleanUp(Resource *resource); + void cleanOrphans(); + static ResourceManager *instance; typedef std::map<std::string, Resource*> Resources; typedef Resources::iterator ResourceIterator; Resources mResources; + Resources mOrphanedResources; + time_t mOldestOrphan; }; #endif |