task_plan_execute_2/include/template_manager.hpp

100 lines
3.6 KiB
C++
Raw Permalink Normal View History

2026-06-17 04:58:09 +00:00
#ifndef TPS_TEMPLATE_MANAGER_HPP
#define TPS_TEMPLATE_MANAGER_HPP
#include "app.hpp"
#include <string>
#include <vector>
#include <map>
// ============================================================
// 模板管理模块SU-05 模板管理单元)
// ============================================================
/**
*
*
*/
class TemplateManager {
public:
TemplateManager() = default;
~TemplateManager() = default;
/**
*
*
* @requirement(name="接收推送的任务模板集合数据", id="SRS-F-04-001")
*
*
*
* @param payload JSON/XML
* @param format "json" / "xml"
* @return true
*/
bool receiveTemplates(const std::string& payload, const std::string& format);
/**
*
*
* @return
*/
std::vector<TaskTemplate> getTemplateList() const;
/**
*
*
* @requirement(name="任务模板先验知识库版本选择", id="SRS-F-03-001")
*
*
* @param templateId ID
* @return
*/
std::vector<TemplateVersion> getConfig(const std::string& templateId) const;
/**
*
*
* @requirement(name="先验知识库配置调整", id="SRS-F-03-002")
*
*
*
* @param key
* @param value
* @return true
*/
bool updateConfig(const std::string& key, const std::string& value);
/**
*
*
* @requirement(name="自主执行模式下任务模板自动选择提示", id="SRS-F-04-006")
*
*
*
* @param scenario
* @return ID
*/
std::string autoSelectTemplate(const std::string& scenario);
/**
*
*
* @requirement(name="人环模式下用户选择任务模板", id="SRS-F-04-005")
* "选用此模板"
*
*
* @param templateId ID
* @param version
* @return true
*/
bool selectTemplate(const std::string& templateId, const std::string& version);
private:
std::vector<TaskTemplate> templates_; ///< 模板库
std::map<std::string, std::vector<TemplateVersion>> versionMap_; ///< 模板ID -> 版本列表
std::map<std::string, std::string> configStore_; ///< 配置参数存储
std::string selectedTemplateId_; ///< 当前选中模板ID
std::string lockedVersion_; ///< 锁定版本
};
#endif // TPS_TEMPLATE_MANAGER_HPP