OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
openswmm::HotStartManager Class Reference

Static utility class for hot start file operations. More...

#include <HotStartManager.hpp>

Collaboration diagram for openswmm::HotStartManager:

Public Member Functions

 HotStartManager ()=delete
 

Static Public Member Functions

static HotStartFilesave (const SimulationContext &ctx, const std::string &path)
 Capture current engine state and write to a hot start file.
 
static HotStartFileopen (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).
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ HotStartManager()

openswmm::HotStartManager::HotStartManager ( )
delete

Member Function Documentation

◆ apply()

int openswmm::HotStartManager::apply ( HotStartFile hs,
SimulationContext ctx,
std::function< void(const std::string &)>  warn_cb = {} 
)
static

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
hsHot start file (from save() or open()).
ctxTarget simulation context (must be INITIALIZED).
warn_cbOptional callback for per-missing-object warnings.
Returns
Number of missing-object warnings generated (0 = perfect match).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ flush()

bool openswmm::HotStartManager::flush ( HotStartFile hs)
static

If the file is dirty, rewrite it to disk.

Returns
true on success, false on I/O error.
Here is the caller graph for this function:

◆ 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
pathFile path.
Returns
Heap-allocated HotStartFile* on success, nullptr on error.
Here is the caller graph for this function:

◆ save()

HotStartFile * openswmm::HotStartManager::save ( const SimulationContext ctx,
const std::string &  path 
)
static

Capture current engine state and write to a hot start file.

Parameters
ctxSimulation context (must be RUNNING or ENDED).
pathOutput file path.
Returns
Heap-allocated HotStartFile* on success (caller owns), or nullptr on I/O error (error description in last_io_error).
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: