|
FERS 0.1.0
The Flexible Extensible Radar Simulator
|
Manages the lifetime and state of a single FERS simulation scenario. More...
#include "fers_context.h"
Inheritance diagram for FersContext:Public Member Functions | |
| FersContext () | |
| Constructs a new simulation context, initializing an empty world. | |
| core::World * | getWorld () const noexcept |
| Retrieves a pointer to the simulation world. | |
| std::mt19937 & | getMasterSeeder () noexcept |
| Retrieves a mutable reference to the master random number seeder. | |
| void | setOutputDir (std::string dir) |
| Sets the output directory for simulation results. | |
| const std::string & | getOutputDir () const noexcept |
| Gets the output directory for simulation results. | |
| void | setOutputConfig (core::OutputConfig config) |
| Sets the runtime output configuration. | |
| const core::OutputConfig & | getOutputConfig () const noexcept |
| Gets the runtime output configuration. | |
| void | setLastOutputMetadata (core::OutputMetadata metadata) |
| Stores metadata from the most recent simulation run. | |
| void | clearLastOutputMetadata () |
| Clears any stored simulation output metadata. | |
| std::string | getLastOutputMetadataJson () const |
| Serializes the last simulation output metadata as JSON. | |
Manages the lifetime and state of a single FERS simulation scenario.
This class serves as the C++ backend for the opaque fers_context_t handle exposed by the C-API. The primary reason for its existence is to apply the "Pimpl" (Pointer to Implementation) idiom at the ABI boundary. By hiding the C++ standard library types (std::unique_ptr, std::mt19937) and the full definition of core::World from the C header, we create a stable ABI that does not break when the internal C++ implementation changes. This encapsulation ensures that clients of the C-API (like Rust) do not need to be recompiled if only the library's internals are modified.
Its secondary role is to own the core::World object, which represents the entire scenario, and the master random number generator. This guarantees that the simulation state persists in memory between API calls and that randomness can be controlled deterministically from a single source.
Definition at line 34 of file fers_context.h.
| FersContext::FersContext | ( | ) |
Constructs a new simulation context, initializing an empty world.
The master random number generator is default-constructed. This is a deliberate choice to allow the seed to be configured later, typically after parsing a scenario file. This ensures that the scenario itself can define its own seed for reproducible simulations. If no seed is provided, a random one is generated at load time.
Definition at line 47 of file fers_context.h.
| void FersContext::clearLastOutputMetadata | ( | ) |
Clears any stored simulation output metadata.
Definition at line 98 of file fers_context.h.
| std::string FersContext::getLastOutputMetadataJson | ( | ) | const |
Serializes the last simulation output metadata as JSON.
Definition at line 104 of file fers_context.h.
References core::outputMetadataToJsonString().
Referenced by fers_get_last_output_metadata_json().
Here is the call graph for this function:
Here is the caller graph for this function:
|
noexcept |
Retrieves a mutable reference to the master random number seeder.
A single master generator is used to seed all other random number generators within the simulation (e.g., for noise models, RCS fluctuations). This design is crucial for ensuring that a simulation can be made fully deterministic and reproducible by controlling a single seed value at the top level.
std::mt19937 engine. Definition at line 67 of file fers_context.h.
|
noexcept |
Gets the runtime output configuration.
Definition at line 87 of file fers_context.h.
|
noexcept |
Gets the output directory for simulation results.
Definition at line 77 of file fers_context.h.
|
noexcept |
Retrieves a pointer to the simulation world.
This provides direct, mutable access to the in-memory representation of the scenario, allowing API functions to modify it.
core::World object. Definition at line 55 of file fers_context.h.
Referenced by fers_update_platform_from_json(), fers_update_receiver_from_json(), fers_update_target_from_json(), and fers_update_transmitter_from_json().
Here is the caller graph for this function:| void FersContext::setLastOutputMetadata | ( | core::OutputMetadata | metadata | ) |
Stores metadata from the most recent simulation run.
| metadata | The metadata snapshot to store. |
Definition at line 93 of file fers_context.h.
| void FersContext::setOutputConfig | ( | core::OutputConfig | config | ) |
Sets the runtime output configuration.
Definition at line 82 of file fers_context.h.
| void FersContext::setOutputDir | ( | std::string | dir | ) |
Sets the output directory for simulation results.
Definition at line 72 of file fers_context.h.
Referenced by fers_set_output_directory().
Here is the caller graph for this function: