blob: 0c15fbdaaf85e74015c7fe73c6fe037cece68278 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include <string>
#include <boost/unordered_map.hpp>
/*!
Caches FileModules based on their filenames
*/
class ModuleCache
{
public:
static ModuleCache *instance() { if (!inst) inst = new ModuleCache; return inst; }
bool evaluate(const std::string &filename, class FileModule *&module);
class FileModule *lookup(const std::string &filename);
bool isCached(const std::string &filename);
size_t size() { return this->entries.size(); }
void clear();
private:
ModuleCache() {}
~ModuleCache() {}
static ModuleCache *inst;
struct cache_entry {
class FileModule *module;
std::string cache_id;
};
boost::unordered_map<std::string, cache_entry> entries;
};
|