Add 核心数据结构定义

main
phfb3vlou 2 weeks ago
parent cbddb95194
commit 85523a618a

@ -0,0 +1,128 @@
#ifndef DATA_STRUCTURES_H
#define DATA_STRUCTURES_H
#include <string>
#include <vector>
#include <map>
#include <chrono>
#include <memory>
namespace Battlefield {
// 数据源类型枚举
enum class DataSourceType {
UAV_SURVEILLANCE, // 无人机侦察
SATELLITE_IMAGERY, // 卫星影像
EM_SIGNAL, // 电磁信号
FRIENDLY_REPORT, // 友军单位报告
GROUND_SENSOR, // 地面传感器
HISTORICAL_DATA // 历史数据
};
// 目标类型枚举
enum class TargetType {
UNKNOWN,
MAIN_BATTLE_TANK, // 主战坦克
INFANTRY_FIGHTER, // 步兵战车
SELF_PROPELLED_ARTILLERY, // 自行火炮
ARMORED_PERSONNEL_CARRIER, // 装甲运兵车
MOBILE_AIR_DEFENSE, // 机动防空系统
DRONE_SWARM, // 无人机集群
COMMAND_VEHICLE, // 指挥车
SUPPLY_TRUCK, // 补给卡车
ANCIENT_FORTIFICATION // 古代防御工事(用于文化主题)
};
// 威胁等级
enum class ThreatLevel {
LOW,
MEDIUM,
HIGH,
CRITICAL
};
// 坐标结构
struct GeoCoordinate {
double longitude;
double latitude;
double altitude; // 海拔高度
GeoCoordinate(double lon = 0.0, double lat = 0.0, double alt = 0.0)
: longitude(lon), latitude(lat), altitude(alt) {}
double distanceTo(const GeoCoordinate& other) const;
};
// 目标识别结果
struct IdentifiedTarget {
int id;
TargetType type;
std::string typeName;
GeoCoordinate position;
double confidence; // 识别置信度 0.0-1.0
double speed; // 运动速度 m/s
double heading; // 运动方向 度
ThreatLevel threatLevel;
std::chrono::system_clock::time_point timestamp;
std::vector<GeoCoordinate> trajectory; // 历史轨迹
std::map<std::string, std::string> metadata;
// 生成唯一ID
static int generateID() {
static int counter = 0;
return ++counter;
}
// 预测未来位置
GeoCoordinate predictPosition(double timeAhead) const;
};
// 数据包结构
struct DataPacket {
DataSourceType source;
std::chrono::system_clock::time_point timestamp;
GeoCoordinate origin;
std::vector<uint8_t> payload; // 原始数据
std::map<std::string, std::string> metadata;
std::vector<IdentifiedTarget> detectedTargets;
// 序列化/反序列化
std::vector<uint8_t> serialize() const;
static DataPacket deserialize(const std::vector<uint8_t>& data);
};
// 战场态势
struct BattlefieldSituation {
std::vector<IdentifiedTarget> enemyTargets;
std::vector<IdentifiedTarget> friendlyUnits;
std::vector<GeoCoordinate> pointsOfInterest;
std::vector<std::string> detectedThreats;
std::chrono::system_clock::time_point updateTime;
double overallThreatLevel; // 综合威胁等级 0-1
// 获取指定区域的威胁密度
double getThreatDensity(const GeoCoordinate& center, double radius) const;
// 生成态势报告
std::string generateReport() const;
};
// 决策建议
struct DecisionSuggestion {
std::string id;
std::string description;
double feasibilityScore; // 可行性评分
double effectivenessScore; // 效能评分
double riskScore; // 风险评分
std::vector<std::string> requiredResources;
std::vector<std::string> potentialOutcomes;
std::map<std::string, double> costFactors;
double getOverallScore() const {
return feasibilityScore * 0.3 + effectivenessScore * 0.4 - riskScore * 0.3;
}
};
} // namespace Battlefield
#endif // DATA_STRUCTURES_H
Loading…
Cancel
Save