47 lines
1.1 KiB
C
47 lines
1.1 KiB
C
|
|
#ifndef RESOURCE_MANAGER_H
|
||
|
|
#define RESOURCE_MANAGER_H
|
||
|
|
|
||
|
|
#include <vector>
|
||
|
|
#include <string>
|
||
|
|
#include <stdexcept>
|
||
|
|
#include <unordered_map>
|
||
|
|
|
||
|
|
#include "resourceManagerTypes.h"
|
||
|
|
#include "config.h"
|
||
|
|
#include "probe.h"
|
||
|
|
#include "quill/LogMacros.h"
|
||
|
|
|
||
|
|
class ResourceManager {
|
||
|
|
private:
|
||
|
|
ResourceManager();
|
||
|
|
ResourceManager(const ResourceManager&) = delete;
|
||
|
|
ResourceManager& operator=(const ResourceManager&) = delete;
|
||
|
|
Config& m_config = Config::getInstance();
|
||
|
|
Probe::LogManager& m_logManager = Probe::LogManager::getInstance();
|
||
|
|
quill::Logger* m_logger = m_logManager.getLogger("log");
|
||
|
|
|
||
|
|
Config m_resourceConfig;
|
||
|
|
std::string m_dataDir;
|
||
|
|
std::unordered_map<std::string, Resource> m_resources;
|
||
|
|
|
||
|
|
bool load(const std::string& name);
|
||
|
|
|
||
|
|
public:
|
||
|
|
static ResourceManager& getInstance() {
|
||
|
|
static ResourceManager instance;
|
||
|
|
return instance;
|
||
|
|
}
|
||
|
|
|
||
|
|
std::vector<std::string> getAvaliableResources();
|
||
|
|
|
||
|
|
const Resource& getResource(const std::string &name) const;
|
||
|
|
|
||
|
|
bool loadResource(std::string& name);
|
||
|
|
|
||
|
|
std::unordered_map<std::string, bool> loadAllResources();
|
||
|
|
|
||
|
|
|
||
|
|
};
|
||
|
|
|
||
|
|
|
||
|
|
#endif // RESOURCE_MANAGER_H
|