修改命令空间
This commit is contained in:
parent
6676a48c4b
commit
a0afb0f2d6
@ -2,6 +2,8 @@
|
||||
#include "utils/Logger.h"
|
||||
#include <fstream>
|
||||
|
||||
namespace config {
|
||||
|
||||
void SystemConfig::load(const std::string& filename) {
|
||||
try {
|
||||
std::ifstream file(filename);
|
||||
@ -40,7 +42,7 @@ void SystemConfig::load(const std::string& filename) {
|
||||
// 加载碰撞检测配置
|
||||
collision_detection.update_interval_ms = j["collision_detection"]["update_interval_ms"];
|
||||
|
||||
// 加<EFBFBD><EFBFBD><EFBFBD>碰撞预测配置
|
||||
// 加载碰撞预测配置
|
||||
collision_detection.prediction.time_window = j["collision_detection"]["prediction"]["time_window"];
|
||||
collision_detection.prediction.vehicle_size = j["collision_detection"]["prediction"]["vehicle_size"];
|
||||
collision_detection.prediction.aircraft_size = j["collision_detection"]["prediction"]["aircraft_size"];
|
||||
@ -66,4 +68,6 @@ void SystemConfig::load(const std::string& filename) {
|
||||
Logger::error("Failed to load system config: ", e.what());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace config
|
||||
@ -5,7 +5,8 @@
|
||||
|
||||
class System; // 前向声明
|
||||
|
||||
// 前向声明所有需要序列化的结构体
|
||||
namespace config {
|
||||
|
||||
struct CoordinatePoint {
|
||||
std::string point;
|
||||
double latitude;
|
||||
@ -99,55 +100,18 @@ private:
|
||||
// JSON 序列化支持
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(CoordinatePoint, point, latitude, longitude);
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SystemConfig::Airport::ReferencePoint, latitude, longitude);
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SystemConfig::Airport, name, iata, icao, reference_point, coordinate_points);
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SystemConfig::DataSource, host, port, aircraft_path, vehicle_path, traffic_light_path, refresh_interval_ms, timeout_ms, read_timeout_ms);
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SystemConfig::WebSocket::PositionUpdate, aircraft_interval_ms, vehicle_interval_ms, traffic_light_interval_ms);
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SystemConfig::WebSocket, port, max_connections, ping_interval_ms, position_update);
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SystemConfig::CollisionDetection::Prediction, time_window, vehicle_size, aircraft_size, min_unmanned_speed);
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SystemConfig::CollisionDetection, update_interval_ms, prediction);
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SystemConfig::Logging, level, file, max_size_mb, max_files, console_output);
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SystemConfig::Debug, enable_mock_data, save_raw_data, profile_performance);
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SystemConfig::Warning, warning_interval_ms, log_interval_ms);
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SystemConfig, airport, data_source, websocket, collision_detection, logging, debug, warning);
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
|
||||
SystemConfig::Airport,
|
||||
name, iata, icao, reference_point, coordinate_points
|
||||
);
|
||||
} // namespace config
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
|
||||
SystemConfig::DataSource,
|
||||
host, port, aircraft_path, vehicle_path, traffic_light_path,
|
||||
refresh_interval_ms, timeout_ms, read_timeout_ms
|
||||
);
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
|
||||
SystemConfig::WebSocket::PositionUpdate,
|
||||
aircraft_interval_ms, vehicle_interval_ms, traffic_light_interval_ms
|
||||
);
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
|
||||
SystemConfig::WebSocket,
|
||||
port, max_connections, ping_interval_ms, position_update
|
||||
);
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
|
||||
SystemConfig::CollisionDetection::Prediction,
|
||||
time_window, vehicle_size, aircraft_size, min_unmanned_speed
|
||||
);
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
|
||||
SystemConfig::CollisionDetection,
|
||||
update_interval_ms, prediction
|
||||
);
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
|
||||
SystemConfig::Logging,
|
||||
level, file, max_size_mb, max_files, console_output
|
||||
);
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
|
||||
SystemConfig::Debug,
|
||||
enable_mock_data, save_raw_data, profile_performance
|
||||
);
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
|
||||
SystemConfig::Warning,
|
||||
warning_interval_ms, log_interval_ms
|
||||
);
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
|
||||
SystemConfig,
|
||||
airport, data_source, websocket, collision_detection,
|
||||
logging, debug, warning
|
||||
);
|
||||
using config::SystemConfig;
|
||||
using config::CoordinatePoint;
|
||||
Loading…
Reference in New Issue
Block a user