39 lines
1.0 KiB
C++
39 lines
1.0 KiB
C++
#ifndef DRONESCREWCTRL_CONFIG_MANAGER_H
|
||
#define DRONESCREWCTRL_CONFIG_MANAGER_H
|
||
|
||
#include "IVrConfig.h"
|
||
#include <string>
|
||
#include <mutex>
|
||
|
||
/**
|
||
* @brief 控制端配置管理器
|
||
*
|
||
* 不再依赖 BasePresenter / AppConfig,因为板二是显示+控制端,
|
||
* 不参与相机/算法配置同步,只管自己 XML 文件的读写。
|
||
*/
|
||
class ConfigManager
|
||
{
|
||
public:
|
||
static ConfigManager& Instance();
|
||
|
||
bool Initialize(const std::string& configPath);
|
||
bool Reload();
|
||
bool Save();
|
||
|
||
DroneScrewCtrlConfigResult GetConfig() const;
|
||
void SetConfig(const DroneScrewCtrlConfigResult& cfg);
|
||
|
||
private:
|
||
ConfigManager();
|
||
~ConfigManager();
|
||
ConfigManager(const ConfigManager&) = delete;
|
||
ConfigManager& operator=(const ConfigManager&) = delete;
|
||
|
||
IDroneScrewCtrlConfig* m_pConfig{nullptr};
|
||
DroneScrewCtrlConfigResult m_cache;
|
||
std::string m_path;
|
||
mutable std::mutex m_mutex;
|
||
};
|
||
|
||
#endif // DRONESCREWCTRL_CONFIG_MANAGER_H
|