2026-06-26 17:55:15 +08:00

39 lines
1.0 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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