Mercurial > fife-parpg
comparison engine/core/util/resource/pool.h @ 149:823544621b5b
Removed the pool listener interface as purpose
was unclear and it was unused and not exposed either.
Minor cleanups and documentation.
author | phoku@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sat, 11 Oct 2008 06:23:45 +0000 |
parents | 72c25cc27d8b |
children | 679ed3e15513 |
comparison
equal
deleted
inserted
replaced
148:72c25cc27d8b | 149:823544621b5b |
---|---|
39 #include "resource_location.h" | 39 #include "resource_location.h" |
40 | 40 |
41 namespace FIFE { | 41 namespace FIFE { |
42 | 42 |
43 class IResource; | 43 class IResource; |
44 | |
45 /** Clients of pool get notifications about pool events through this interface | |
46 */ | |
47 class IPoolListener { | |
48 public: | |
49 virtual void poolCleared() = 0; | |
50 virtual ~IPoolListener() {}; | |
51 }; | |
52 | 44 |
53 enum { RES_LOADED = 0x01, RES_NON_LOADED = 0x02}; | 45 enum { RES_LOADED = 0x01, RES_NON_LOADED = 0x02}; |
54 | 46 |
55 /** Pool is used to optimize memory usage for resources | 47 /** Pool is used to optimize memory usage for resources |
56 * | 48 * |
119 | 111 |
120 /** Gets amount of resources in the pool with given status | 112 /** Gets amount of resources in the pool with given status |
121 */ | 113 */ |
122 virtual int getResourceCount(int status); | 114 virtual int getResourceCount(int status); |
123 | 115 |
124 /** Adds pool listener. | |
125 * Pool listeners get indications e.g. when ownerships of pooled | |
126 * resources change. | |
127 */ | |
128 virtual void addPoolListener(IPoolListener* listener); | |
129 | |
130 /** Removes pool listener | |
131 */ | |
132 virtual void removePoolListener(IPoolListener* listener); | |
133 | |
134 /** Prints the cache statistics to the log | 116 /** Prints the cache statistics to the log |
135 */ | 117 */ |
136 virtual void printStatistics(); | 118 virtual void printStatistics(); |
137 | 119 |
138 /** Performs a sanity check for the location map. | 120 /** Performs a sanity check for the location map. |
167 void findAndSetProvider(PoolEntry& entry); | 149 void findAndSetProvider(PoolEntry& entry); |
168 | 150 |
169 std::vector<PoolEntry*> m_entries; | 151 std::vector<PoolEntry*> m_entries; |
170 typedef std::map<ResourceLocation, int> ResourceLocationToEntry; | 152 typedef std::map<ResourceLocation, int> ResourceLocationToEntry; |
171 ResourceLocationToEntry m_location_to_entry; | 153 ResourceLocationToEntry m_location_to_entry; |
172 std::vector<IPoolListener*> m_listeners; | |
173 std::vector<ResourceLoader*> m_loaders; | 154 std::vector<ResourceLoader*> m_loaders; |
174 int m_curind; | |
175 std::string m_name; | 155 std::string m_name; |
176 | |
177 /** Clears pool from ALL resources. Frees associated memory | |
178 */ | |
179 void cleanUp(); | |
180 }; | 156 }; |
181 | 157 |
182 } // FIFE | 158 } // FIFE |
183 | 159 |
184 #endif | 160 #endif |