Static utility class for hot start file operations.
More...
#include <HotStartManager.hpp>
|
| static HotStartFile * | save (const SimulationContext &ctx, const std::string &path) |
| | Capture current engine state and write to a hot start file.
|
| |
| static HotStartFile * | open (const std::string &path) |
| | Read and validate a hot start file.
|
| |
| static int | apply (HotStartFile &hs, SimulationContext &ctx, std::function< void(const std::string &)> warn_cb={}) |
| | Apply hot start records to a simulation context.
|
| |
| static bool | flush (HotStartFile &hs) |
| | If the file is dirty, rewrite it to disk.
|
| |
| static const std::string & | last_io_error () noexcept |
| | Description of the most recent I/O error (empty = none).
|
| |
Static utility class for hot start file operations.
All operations on the binary file are handled here. The HotStartFile struct is the data carrier; HotStartManager provides the I/O logic.
◆ HotStartManager()
| openswmm::HotStartManager::HotStartManager |
( |
| ) |
|
|
delete |
◆ apply()
Apply hot start records to a simulation context.
For each record in the hot start file, the matching object (by string ID) in ctx is updated. Objects in the hot start that are absent from ctx generate warnings — they do not fail.
- Parameters
-
| hs | Hot start file (from save() or open()). |
| ctx | Target simulation context (must be INITIALIZED). |
| warn_cb | Optional callback for per-missing-object warnings. |
- Returns
- Number of missing-object warnings generated (0 = perfect match).
◆ flush()
If the file is dirty, rewrite it to disk.
- Returns
- true on success, false on I/O error.
◆ last_io_error()
| const std::string & openswmm::HotStartManager::last_io_error |
( |
| ) |
|
|
staticnoexcept |
Description of the most recent I/O error (empty = none).
◆ open()
| HotStartFile * openswmm::HotStartManager::open |
( |
const std::string & |
path | ) |
|
|
static |
Read and validate a hot start file.
Validates magic, version, and CRC32. Loads all records into memory.
- Parameters
-
- Returns
- Heap-allocated
HotStartFile* on success, nullptr on error.
◆ save()
Capture current engine state and write to a hot start file.
- Parameters
-
| ctx | Simulation context (must be RUNNING or ENDED). |
| path | Output file path. |
- Returns
- Heap-allocated
HotStartFile* on success (caller owns), or nullptr on I/O error (error description in last_io_error).
The documentation for this class was generated from the following files: