Default output plugin: writes SWMM 5.x compatible binary .out file.
More...
#include <DefaultOutputPlugin.hpp>
|
| | DefaultOutputPlugin (std::string out_path) |
| | Store a binary output destination and start in LOADED state.
|
| |
| | ~DefaultOutputPlugin () override=default |
| | Destroy member buffers without implicitly closing out_file_. Caller must finalize() before deletion or otherwise arrange owned stream cleanup; the defaulted destructor adds no FILE RAII or footer.
|
| |
| 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 |
| | Reset write counters and mark INITIALIZED.
|
| |
| int | validate (const SimulationContext &ctx) override |
| | Mark VALIDATED without checking path or model arrays.
|
| |
| int | prepare (const SimulationContext &ctx) override |
| | Open/truncate the binary output and write its reporting layout/header.
|
| |
| int | update (const SimulationSnapshot &snapshot) override |
| | Append and flush one complete report-period record, then increment counters.
|
| |
| int | finalize (const SimulationContext &ctx) override |
| | Write a footer with current counters, close the output and mark FINALIZED.
|
| |
| const char * | last_error_message () const noexcept override |
| | Borrow the stored diagnostic text without clearing it.
|
| |
| virtual | ~IOutputPlugin ()=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.
|
| |
| virtual int | initialize (const std::vector< std::string > &init_args, const class IPluginComponentInfo *info)=0 |
| | Parse instance configuration before model validation/preparation.
|
| |
Default output plugin: writes SWMM 5.x compatible binary .out file.
This plugin is injected automatically when the engine is opened with a non-empty out_path. It does NOT require a [PLUGINS] entry.
◆ DefaultOutputPlugin()
| openswmm::DefaultOutputPlugin::DefaultOutputPlugin |
( |
std::string | out_path | ) |
|
|
explicit |
Store a binary output destination and start in LOADED state.
- Parameters
-
| out_path | UTF-8 filename moved into storage; no file is opened/validated yet. |
◆ ~DefaultOutputPlugin()
| openswmm::DefaultOutputPlugin::~DefaultOutputPlugin |
( |
| ) |
|
|
overridedefault |
Destroy member buffers without implicitly closing out_file_. Caller must finalize() before deletion or otherwise arrange owned stream cleanup; the defaulted destructor adds no FILE RAII or footer.
◆ finalize()
Write a footer with current counters, close the output and mark FINALIZED.
- Parameters
-
| ctx | Ignored; footer error code is always zero rather than context error. |
- Returns
- Zero including when no stream exists. Native long offsets narrow to int without overflow checks; writer/file-size limits must remain valid. fwrite/close errors are ignored. Caller first drains all outstanding update calls.
Implements openswmm::IOutputPlugin.
◆ initialize()
| int openswmm::DefaultOutputPlugin::initialize |
( |
const std::vector< std::string > & | init_args, |
|
|
const IPluginComponentInfo * | info ) |
|
override |
Reset write counters and mark INITIALIZED.
- Parameters
-
| init_args | Ignored strings. |
| info | Ignored metadata pointer. |
- Returns
- Zero. Does not close a preexisting stream or clear all metadata/diagnostics.
◆ last_error_message()
| const char * openswmm::DefaultOutputPlugin::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::IOutputPlugin.
◆ prepare()
Open/truncate the binary output and write its reporting layout/header.
- Parameters
-
| ctx | Stable aligned model, reporting flags, species naming/units and options. Static node/link lengths are internal feet and converted here; subcatch areas are already acres/hectares. Managed sessions use exclusive checkpoint output creation and capture its fresh header. Call once with no prior owned open stream. |
- Returns
- Zero after marking PREPARED/counters zero; -1 for open or managed prefix read failure, with last_error set. General header fwrite/setvbuf errors are not checked. Exceptions can leave a partial file/open stream; no rollback is added.
Implements openswmm::IOutputPlugin.
◆ state()
| PluginState openswmm::DefaultOutputPlugin::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::IOutputPlugin.
◆ update()
Append and flush one complete report-period record, then increment counters.
- Parameters
-
| snapshot | Stable immutable packet with the same object counts/report flags and species stride as prepare(). Values already use project display units, link directions are already applied, and sim_time is a SWMM serial day. Ordinary missing vector entries become zero; optional missing snow-process fields NaN. No finite-value/layout validation or unit conversion is applied to period data. |
- Returns
- -1 if no output stream, otherwise zero after marking UPDATING, writing and flushing. fwrite/fflush errors are not tested, so counters can advance despite IO failure. Call serially, normally on IOThread, without lifecycle/checkpoint races.
Implements openswmm::IOutputPlugin.
◆ validate()
Mark VALIDATED without checking path or model arrays.
- Parameters
-
- Returns
- Zero unconditionally; prepare/update caller invariants still apply.
Implements openswmm::IOutputPlugin.
◆ SWMMEngine
The documentation for this class was generated from the following files: