7/include/config_template.hpp

54 lines
2.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 ODF_MANAGEMENT_CONFIG_TEMPLATE_HPP
#define ODF_MANAGEMENT_CONFIG_TEMPLATE_HPP
#include <string>
#include <vector>
#include <cstdint>
/**
* @brief 典型场景配置模板
*
* 内置常见部署模板(如数据中心 LC 单模双回路预端接),
* 包含场景名称、组件清单、单柜端口密度及备用余量比例等参数,
* 支持根据机柜数量与端口密度自动生成物料清单摘要。
*/
struct ConfigTemplate {
std::string scenarioName; ///< 场景名称
std::vector<std::string> components; ///< 使用组件列表(适配器、跳线、收发器等)
std::string topologyRef; ///< 连接拓扑图引用
uint32_t portsPerCabinet; ///< 单柜端口密度
double spareRatio; ///< 备用余量比例(如 0.15 表示 15%
/**
* @brief 构造配置模板
* @param scenarioName 场景名称
* @param components 组件列表
* @param topologyRef 拓扑图引用
* @param portsPerCabinet 单柜端口密度
* @param spareRatio 备用余量比例
*/
ConfigTemplate(std::string scenarioName,
std::vector<std::string> components,
std::string topologyRef,
uint32_t portsPerCabinet,
double spareRatio);
/// @brief 默认构造函数
ConfigTemplate() = default;
/**
* @brief 根据机柜数量生成 BOM 摘要
* @param cabinetCount 机柜数量
* @return 包含总量与余量的物料描述字符串
*/
[[nodiscard]] std::string generateBomSummary(uint32_t cabinetCount) const;
/// @brief 返回模板基本信息
[[nodiscard]] std::string summary() const;
/// @brief 获取预定义的内置模板列表
[[nodiscard]] static std::vector<ConfigTemplate> builtInTemplates();
};
#endif // ODF_MANAGEMENT_CONFIG_TEMPLATE_HPP