FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
json_serializer.cpp File Reference

Implements JSON serialization and deserialization for FERS objects. More...

#include "serial/json_serializer.h"
#include <cmath>
#include <nlohmann/json.hpp>
#include <random>
#include "antenna/antenna_factory.h"
#include "core/parameters.h"
#include "core/world.h"
#include "math/coord.h"
#include "math/path.h"
#include "math/rotation_path.h"
#include "radar/platform.h"
#include "radar/receiver.h"
#include "radar/target.h"
#include "radar/transmitter.h"
#include "signal/radar_signal.h"
#include "timing/prototype_timing.h"
#include "timing/timing.h"
#include "waveform_factory.h"
+ Include dependency graph for json_serializer.cpp:

Go to the source code of this file.

Namespaces

namespace  math
 
namespace  timing
 
namespace  fers_signal
 
namespace  antenna
 
namespace  radar
 
namespace  params
 
namespace  serial
 

Functions

void math::to_json (nlohmann::json &j, const Vec3 &v)
 
void math::from_json (const nlohmann::json &j, Vec3 &v)
 
void math::to_json (nlohmann::json &j, const Coord &c)
 
void math::from_json (const nlohmann::json &j, Coord &c)
 
void math::to_json (nlohmann::json &j, const RotationCoord &rc)
 
void math::from_json (const nlohmann::json &j, RotationCoord &rc)
 
 math::NLOHMANN_JSON_SERIALIZE_ENUM (Path::InterpType, {{Path::InterpType::INTERP_STATIC, "static"}, {Path::InterpType::INTERP_LINEAR, "linear"}, {Path::InterpType::INTERP_CUBIC, "cubic"}}) void to_json(nlohmann
 
void math::from_json (const nlohmann::json &j, Path &p)
 
 math::NLOHMANN_JSON_SERIALIZE_ENUM (RotationPath::InterpType, {{RotationPath::InterpType::INTERP_STATIC, "static"}, {RotationPath::InterpType::INTERP_CONSTANT, "constant"}, {RotationPath::InterpType::INTERP_LINEAR, "linear"}, {RotationPath::InterpType::INTERP_CUBIC, "cubic"}}) void to_json(nlohmann
 
void math::from_json (const nlohmann::json &j, RotationPath &p)
 
void timing::to_json (nlohmann::json &j, const PrototypeTiming &pt)
 
void timing::from_json (const nlohmann::json &j, PrototypeTiming &pt)
 
void fers_signal::to_json (nlohmann::json &j, const RadarSignal &rs)
 
void fers_signal::from_json (const nlohmann::json &j, std::unique_ptr< RadarSignal > &rs)
 
void antenna::to_json (nlohmann::json &j, const Antenna &a)
 
void antenna::from_json (const nlohmann::json &j, std::unique_ptr< Antenna > &ant)
 
void radar::to_json (nlohmann::json &j, const SchedulePeriod &p)
 
void radar::from_json (const nlohmann::json &j, SchedulePeriod &p)
 
void radar::to_json (nlohmann::json &j, const Transmitter &t)
 
void radar::to_json (nlohmann::json &j, const Receiver &r)
 
void radar::to_json (nlohmann::json &j, const Target &t)
 
void radar::to_json (nlohmann::json &j, const Platform &p)
 
 params::NLOHMANN_JSON_SERIALIZE_ENUM (CoordinateFrame, {{CoordinateFrame::ENU, "ENU"}, {CoordinateFrame::UTM, "UTM"}, {CoordinateFrame::ECEF, "ECEF"}}) void to_json(nlohmann
 
void params::from_json (const nlohmann::json &j, Parameters &p)
 
nlohmann::json serial::world_to_json (const core::World &world)
 Serializes the entire simulation world into a nlohmann::json object.
 
void serial::json_to_world (const nlohmann::json &j, core::World &world, std::mt19937 &masterSeeder)
 Deserializes a nlohmann::json object and reconstructs the simulation world.
 

Detailed Description

Implements JSON serialization and deserialization for FERS objects.

This file leverages the nlohmann/json library's support for automatic serialization via to_json and from_json free functions. By placing these functions within the namespaces of the objects they serialize, we enable Argument-Dependent Lookup (ADL). This design choice allows the library to automatically find the correct conversion functions, keeping the serialization logic decoupled from the core object definitions and improving modularity.

Definition in file json_serializer.cpp.