110 lines
3.1 KiB
C++
110 lines
3.1 KiB
C++
|
|
#ifndef ODF_MANAGEMENT_APP_HPP
|
|||
|
|
#define ODF_MANAGEMENT_APP_HPP
|
|||
|
|
|
|||
|
|
#include "odf_unit.hpp"
|
|||
|
|
#include "adapter_interface.hpp"
|
|||
|
|
#include "naming_helper.hpp"
|
|||
|
|
#include "config_template.hpp"
|
|||
|
|
#include "project_milestone.hpp"
|
|||
|
|
|
|||
|
|
#include <string>
|
|||
|
|
#include <vector>
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief ODF 管理应用入口
|
|||
|
|
*
|
|||
|
|
* 提供顶层功能调度:创建 ODF 单元、管理适配器接口、
|
|||
|
|
* 命名生成与校验、典型配置模板查询及项目里程碑跟踪。
|
|||
|
|
*/
|
|||
|
|
class App {
|
|||
|
|
public:
|
|||
|
|
/// @brief 构造函数
|
|||
|
|
App();
|
|||
|
|
|
|||
|
|
// ==================== ODF 单元管理 ====================
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 添加一个 ODF 单元
|
|||
|
|
* @param unit 单元信息
|
|||
|
|
*/
|
|||
|
|
void addOdfUnit(const OdfUnit& unit);
|
|||
|
|
|
|||
|
|
/// @brief 列出所有 ODF 单元摘要
|
|||
|
|
[[nodiscard]] std::string listOdfUnits() const;
|
|||
|
|
|
|||
|
|
// ==================== 适配器接口管理 ====================
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 添加适配器接口规格
|
|||
|
|
* @param iface 适配器接口信息
|
|||
|
|
*/
|
|||
|
|
void addAdapterInterface(const AdapterInterface& iface);
|
|||
|
|
|
|||
|
|
/// @brief 列出所有适配器接口
|
|||
|
|
[[nodiscard]] std::string listAdapterInterfaces() const;
|
|||
|
|
|
|||
|
|
// ==================== 命名工具 ====================
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 校验编号格式
|
|||
|
|
* @param code 编号字符串
|
|||
|
|
* @return 校验结果说明
|
|||
|
|
*/
|
|||
|
|
[[nodiscard]] static std::string validateNamingFormat(const std::string& code);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 生成示例编号
|
|||
|
|
* @return 示例编号字符串
|
|||
|
|
*/
|
|||
|
|
[[nodiscard]] static std::string generateSampleNaming();
|
|||
|
|
|
|||
|
|
// ==================== 端口密度计算 ====================
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 计算单位高度(1U)端口密度
|
|||
|
|
* @param rackHeightU 机柜高度(U 为单位)
|
|||
|
|
* @param totalPorts 总端口数
|
|||
|
|
* @return 每 U 端口密度(端口数/U,向下取整)
|
|||
|
|
*/
|
|||
|
|
[[nodiscard]] static uint32_t calculatePortDensity(uint32_t rackHeightU,
|
|||
|
|
uint32_t totalPorts);
|
|||
|
|
|
|||
|
|
// ==================== 配置模板 ====================
|
|||
|
|
|
|||
|
|
/// @brief 获取所有内置模板摘要
|
|||
|
|
[[nodiscard]] std::string listTemplates() const;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 根据机柜数量生成 BOM
|
|||
|
|
* @param templateIndex 模板索引
|
|||
|
|
* @param cabinetCount 机柜数量
|
|||
|
|
* @return BOM 摘要字符串
|
|||
|
|
*/
|
|||
|
|
[[nodiscard]] std::string generateBom(size_t templateIndex, uint32_t cabinetCount) const;
|
|||
|
|
|
|||
|
|
// ==================== 项目里程碑 ====================
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 添加项目里程碑
|
|||
|
|
* @param ms 里程碑信息
|
|||
|
|
*/
|
|||
|
|
void addMilestone(const ProjectMilestone& ms);
|
|||
|
|
|
|||
|
|
/// @brief 列出所有里程碑
|
|||
|
|
[[nodiscard]] std::string listMilestones() const;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 检查所有里程碑时间约束
|
|||
|
|
* @return 约束检查结果说明
|
|||
|
|
*/
|
|||
|
|
[[nodiscard]] std::string checkMilestonesConstraint() const;
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
std::vector<OdfUnit> units_;
|
|||
|
|
std::vector<AdapterInterface> adapters_;
|
|||
|
|
std::vector<ProjectMilestone> milestones_;
|
|||
|
|
std::vector<ConfigTemplate> templates_;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
#endif // ODF_MANAGEMENT_APP_HPP
|