task_plan_execute_2/include/plan_manager.hpp

110 lines
3.7 KiB
C++
Raw 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 TPS_PLAN_MANAGER_HPP
#define TPS_PLAN_MANAGER_HPP
#include "app.hpp"
#include <string>
#include <vector>
// ============================================================
// 计划管理模块SU-06 计划管理单元)
// ============================================================
/**
* 计划管理器。
* 负责计划列表管理、排序、详情展示、计划重配置、分布式聚合与一致性检查。
*/
class PlanManager {
public:
PlanManager() = default;
~PlanManager() = default;
/**
* 创建新任务计划草案。
*
* @requirement(name="生成作战任务并送交处理", id="SRS-F-02-004")
* 用户选择一个或多个事件后,点击"生成任务"按钮,
* 系统创建任务草案并提交至任务生成引擎处理。
*
* @param name 计划名称
* @param eventIds 关联的事件ID列表
* @param templateId 使用的模板ID
* @return 创建的计划ID失败返回空字符串
*/
std::string createPlan(const std::string& name,
const std::vector<std::string>& eventIds,
const std::string& templateId);
/**
* 根据用户设定的权重对计划列表进行排序。
*
* @requirement(name="集中式计划管理与偏好排序", id="SRS-F-05-001")
* 支持集中管理所有任务计划,并根据用户设定的权重进行排序。
*
* @param weightPriority 优先级权重
* @param weightTime 时间权重
* @return 排序后的计划列表
*/
std::vector<TaskPlan> sortPlans(double weightPriority, double weightTime);
/**
* 当遇到需人工干预节点时,推送通知。
*
* @requirement(name="计划详情可视化与HITL通知", id="SRS-F-05-002")
* 可视化展示计划图谱,当遇到需人工干预节点时,推送通知给指定用户。
*
* @param planId 计划ID
* @param nodeId 需要人工干预的节点ID
* @param user 目标用户标识
* @return true 表示通知发送成功
*/
bool notifyHITL(const std::string& planId,
const std::string& nodeId,
const std::string& user);
/**
* 执行计划重配置操作。
*
* @requirement(name="计划重配置操作与可视化", id="SRS-F-05-003")
* 支持对计划进行修改,执行重配置算法生成新计划,
* 并以差异对比方式高亮显示变更部分。
*
* @param planId 原计划ID
* @param newNodes 新的节点列表
* @return 新计划ID失败返回空字符串
*/
std::string reconfigurePlan(const std::string& planId,
const std::vector<PlanNode>& newNodes);
/**
* 聚合多个来源的计划并运行一致性检查。
*
* @requirement(name="分布式计划管理与算法处理", id="SRS-F-05-004")
* 支持聚合多个来源的计划,构建依赖关系图,并运行一致性检查算法。
*
* @param externalPlans 外部来源的计划列表
* @return true 表示一致性检查通过
*/
bool mergeAndCheckConsistency(const std::vector<TaskPlan>& externalPlans);
/**
* 获取所有本地计划。
*/
std::vector<TaskPlan> getAllPlans() const;
/**
* 获取指定计划的节点列表。
*/
std::vector<PlanNode> getPlanNodes(const std::string& planId) const;
private:
std::vector<TaskPlan> plans_; ///< 本地计划集合
std::map<std::string, std::vector<PlanNode>> planNodes_; ///< planId -> 节点列表
/**
* 生成唯一ID简易UUID模拟
*/
std::string generateId();
};
#endif // TPS_PLAN_MANAGER_HPP