Default state-IO plugin: OpenSWMM binary + legacy SWMM5 hot-start.
More...
#include <DefaultStateIOPlugin.hpp>
|
| | DefaultStateIOPlugin ()=default |
| | Construct an UNLOADED stateless hot-start facade with empty diagnostics.
|
| |
| PluginState | state () const noexcept override |
| | Read the last assigned lifecycle marker without synchronization.
|
| |
| int | initialize (const std::vector< std::string > &init_args, const IPluginComponentInfo *info) override |
| | Mark INITIALIZED and clear last_error.
|
| |
| int | validate (const SimulationContext &ctx) override |
| | Mark VALIDATED without inspecting model compatibility.
|
| |
| bool | can_read (const std::string &path) const override |
| | Probe a leading hot-start signature or a recognized filename suffix.
|
| |
| int | read_state (const std::string &path, SimulationContext &ctx) override |
| | Open and apply a hot-start through HotStartManager.
|
| |
| int | write_state (const std::string &path, const SimulationContext &ctx) override |
| | Save current model/solver state through HotStartManager.
|
| |
| std::vector< std::string > | warnings () const override |
| | Copy warnings collected by the last read_state()/write_state() cycle.
|
| |
| int | finalize (const SimulationContext &ctx) override |
| | Mark FINALIZED without opening/closing a persistent stream.
|
| |
| const char * | last_error_message () const noexcept override |
| | Borrow the stored diagnostic text without clearing it.
|
| |
| virtual | ~IStateIOPlugin ()=default |
| | Destroy this polymorphic instance after its callbacks and resource lifecycle finish. Default base destructor performs no finalize, file flush, I/O-thread join or model cleanup. Host deletes instances while their library remains loaded; implementations release owned resources safely. Never delete shared component metadata here.
|
| |
Default state-IO plugin: OpenSWMM binary + legacy SWMM5 hot-start.
◆ DefaultStateIOPlugin()
| openswmm::DefaultStateIOPlugin::DefaultStateIOPlugin |
( |
| ) |
|
|
default |
Construct an UNLOADED stateless hot-start facade with empty diagnostics.
◆ can_read()
| bool openswmm::DefaultStateIOPlugin::can_read |
( |
const std::string & | path | ) |
const |
|
overridevirtual |
Probe a leading hot-start signature or a recognized filename suffix.
- Parameters
-
| path | UTF-8 filename; attempts a read-only 16-byte prefix, then also accepts a case-insensitive .hs/.hsf suffix even for absent or invalid-content files. |
- Returns
- True for the recognized OpenSWMM/legacy prefix or suffix fallback. This is a format-selection hint, not full validation or proof read_state() will succeed. Does not mutate diagnostics, warnings or lifecycle state.
Reimplemented from openswmm::IStateIOPlugin.
◆ finalize()
Mark FINALIZED without opening/closing a persistent stream.
- Parameters
-
- Returns
- Zero; diagnostics and warnings remain.
Implements openswmm::IStateIOPlugin.
◆ initialize()
| int openswmm::DefaultStateIOPlugin::initialize |
( |
const std::vector< std::string > & | init_args, |
|
|
const IPluginComponentInfo * | info ) |
|
overridevirtual |
Mark INITIALIZED and clear last_error.
- Parameters
-
| init_args | Ignored initialization strings. |
| info | Ignored optional metadata pointer. |
- Returns
- Zero; the previous warnings list is retained.
Implements openswmm::IStateIOPlugin.
◆ last_error_message()
| const char * openswmm::DefaultStateIOPlugin::last_error_message |
( |
| ) |
const |
|
inlineoverridevirtualnoexcept |
Borrow the stored diagnostic text without clearing it.
- Returns
- NUL-terminated member bytes, possibly empty/stale; valid until the next error mutation or destruction. Never free; use the method return code for success.
Reimplemented from openswmm::IStateIOPlugin.
◆ read_state()
| int openswmm::DefaultStateIOPlugin::read_state |
( |
const std::string & | path, |
|
|
SimulationContext & | ctx ) |
|
overridevirtual |
Open and apply a hot-start through HotStartManager.
- Parameters
-
| path | UTF-8 source filename; this call does not rely on can_read() being called. |
| [in,out] | ctx | Compatible model/solver state with state_accessors wired when solver-internal restoration is required. Application can mutate a prefix before a later failure; caller owns transaction/rollback if needed. |
- Returns
- Zero on successful apply, one on normal open/apply failure. Clears warnings and last_error initially; appends apply warnings plus file warnings on success. No lifecycle state change occurs and exceptions propagate.
Implements openswmm::IStateIOPlugin.
◆ state()
| PluginState openswmm::DefaultStateIOPlugin::state |
( |
| ) |
const |
|
inlineoverridevirtualnoexcept |
Read the last assigned lifecycle marker without synchronization.
- Returns
- Stored state; methods do not generally enforce an incoming-state transition. Serialize plugin lifecycle/IO with active worker calls.
Implements openswmm::IStateIOPlugin.
◆ validate()
Mark VALIDATED without inspecting model compatibility.
- Parameters
-
| ctx | Ignored context; format/model checks happen during state application. |
- Returns
- Zero unconditionally.
Implements openswmm::IStateIOPlugin.
◆ warnings()
| std::vector< std::string > openswmm::DefaultStateIOPlugin::warnings |
( |
| ) |
const |
|
inlineoverridevirtual |
Copy warnings collected by the last read_state()/write_state() cycle.
- Returns
- Independent list; initialize/validate/finalize do not clear it.
Reimplemented from openswmm::IStateIOPlugin.
◆ write_state()
| int openswmm::DefaultStateIOPlugin::write_state |
( |
const std::string & | path, |
|
|
const SimulationContext & | ctx ) |
|
overridevirtual |
Save current model/solver state through HotStartManager.
- Parameters
-
| path | UTF-8 destination following the manager's direct-write behavior; this plugin adds no atomic replacement or rollback. |
| ctx | Borrowed state; wired state_accessors include solver-internal data and let the manager select its extended format. |
- Returns
- Zero after save returns an owned handle (deleted here), one for a normal failed save. Clears warnings/error initially, does not copy save warnings, and does not change lifecycle state. Exceptions propagate.
Implements openswmm::IStateIOPlugin.
The documentation for this class was generated from the following files: