25개 이상의 토픽을 선택하실 수 없습니다.
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- #pragma once
-
- #include "alarm_model.h"
- #include "control_logic_model.h"
- #include "hmi_model.h"
-
- #include <string>
- #include <vector>
-
- // 工程级 M/D 注释,只描述地址含义,不保存实时值
- struct RegisterComment
- {
- RegisterAddress address{RegisterArea::M, 0};
- std::string text;
-
- // 校验地址有效性和 UTF-8 文本长度
- bool validate(std::string *error = nullptr) const;
- };
-
- // 描述工程的基本身份和文件格式信息
- struct ProjectMetadata
- {
- // 工程唯一标识
- std::string id;
- // 工程显示名称
- std::string name;
- // 工程文件格式版本
- std::string formatVersion = "1.0";
- };
-
- // 聚合工程中的 HMI 页面、报警、寄存器注释和控制逻辑
- struct Project
- {
- // 工程基本信息
- ProjectMetadata metadata;
- // 工程包含的 HMI 页面集合
- std::vector<HmiPage> hmiPages;
- // 进入运行态时显示的初始 HMI 页面
- std::string initialHmiPageId;
- // 工程统一管理的报警定义
- std::vector<AlarmDefinition> alarmDefinitions;
- // 工程级 M/D 地址注释,不包含当前值和引用位置
- std::vector<RegisterComment> registerComments;
- // 工程包含的控制逻辑集合
- std::vector<ControlLogic> controlLogics;
-
- // 按地址查找工程注释,找不到时返回 nullptr
- const RegisterComment *findRegisterComment(const RegisterAddress &address) const;
- // 编辑态校验:允许尚未绑定完成的草稿
- bool validate(std::string *error = nullptr) const;
- // 运行态校验:额外要求所有运行所需对象都已配置
- bool validateForRunning(std::string *error = nullptr) const;
- };
|