task_plan/include/app.hpp

70 lines
1.7 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 ETMS_APP_HPP
#define ETMS_APP_HPP
#include <string>
#include <memory>
#include "event_manager.hpp"
#include "task_template_manager.hpp"
/**
* @brief ETMS 应用主类
*
* 负责初始化各核心管理器,提供应用生命周期控制。
* 封装事件管理与任务模板管理的顶层协调逻辑。
*/
class App {
public:
/**
* @brief 构造 App 实例
* @param appName 应用名称标识
*/
explicit App(const std::string& appName);
/// @brief 析构函数,释放内部资源
~App();
// 禁止拷贝
App(const App&) = delete;
App& operator=(const App&) = delete;
/// @brief 允许移动
App(App&&) noexcept;
App& operator=(App&&) noexcept;
/**
* @brief 初始化应用,创建事件管理器与任务模板管理器
* @return true 初始化成功false 初始化失败
*/
bool initialize();
/**
* @brief 运行应用主循环(此处为示例演示)
*/
void run();
/**
* @brief 获取事件管理器引用
* @return EventManager&
*/
EventManager& getEventManager();
/**
* @brief 获取任务模板管理器引用
* @return TaskTemplateManager&
*/
TaskTemplateManager& getTaskTemplateManager();
/**
* @brief 打印应用状态摘要
*/
void printSummary() const;
private:
std::string m_appName; ///< 应用名称
std::unique_ptr<EventManager> m_eventManager; ///< 事件管理器
std::unique_ptr<TaskTemplateManager> m_templateManager; ///< 任务模板管理器
bool m_initialized = false; ///< 初始化标志
};
#endif // ETMS_APP_HPP