feat(Core/Config): Improve config (#3453)

This commit is contained in:
Kargatum
2020-11-12 03:18:35 +07:00
committed by GitHub
parent 01c830ed46
commit 4734ae81dc
2 changed files with 55 additions and 58 deletions

View File

@@ -7,18 +7,14 @@
#ifndef CONFIG_H
#define CONFIG_H
#include <string>
#include <list>
#include <vector>
#include <ace/Configuration_Import_Export.h>
#include <ace/Thread_Mutex.h>
#include <AutoPtr.h>
typedef acore::AutoPtr<ACE_Configuration_Heap, ACE_Null_Mutex> Config;
#include "Common.h"
class ConfigMgr
{
friend class ConfigLoader;
ConfigMgr() = default;
ConfigMgr(ConfigMgr const&) = delete;
ConfigMgr& operator=(ConfigMgr const&) = delete;
~ConfigMgr() = default;
public:
static ConfigMgr* instance();
@@ -53,22 +49,8 @@ public:
private:
bool dryRun = false;
bool GetValueHelper(const char* name, ACE_TString& result);
bool LoadData(std::string const& file);
typedef ACE_Thread_Mutex LockType;
typedef ACE_Guard<LockType> GuardType;
std::vector<std::string> _modulesConfigFiles;
std::string _initConfigFile;
Config _config;
LockType _configLock;
ConfigMgr() = default;
ConfigMgr(ConfigMgr const&) = delete;
ConfigMgr& operator=(ConfigMgr const&) = delete;
~ConfigMgr() = default;
};
#define sConfigMgr ConfigMgr::instance()