Default report plugin: writes SWMM 5.x compatible .rpt report file.
More...
#include <DefaultReportPlugin.hpp>
|
| | DefaultReportPlugin (std::string rpt_path) |
| | Store a report destination and start in LOADED state.
|
| |
| | ~DefaultReportPlugin () override |
| | Write an interruption marker, flush and close a report still open at destruction. No summary is generated; fprintf/flush/close errors are ignored. Caller first serializes all active report use and releases borrowed diagnostic pointers.
|
| |
| 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 without opening the report.
|
| |
| int | validate (const SimulationContext &ctx) override |
| | Mark VALIDATED without checking path or model data.
|
| |
| int | prepare (const SimulationContext &ctx) override |
| | Open a progressive report, write its preamble and mark PREPARED.
|
| |
| int | update (const SimulationSnapshot &snapshot) override |
| | Mark UPDATING without writing per-step report content.
|
| |
| int | finalize (const SimulationContext &ctx) override |
| | Append outstanding errors/warnings, flush and mark FINALIZED.
|
| |
| int | write_summary (const SimulationContext &ctx) override |
| | Write result/snow/timing sections and close the report stream.
|
| |
| void | requireFreshOutput () noexcept |
| | Require exclusive file creation for managed-session report paths. Sets a retained flag only; existing streams are not reopened and no IO occurs.
|
| |
| const char * | last_error_message () const noexcept override |
| | Borrow the stored diagnostic text without clearing it.
|
| |
| virtual | ~IReportPlugin ()=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 report plugin: writes SWMM 5.x compatible .rpt report file.
◆ DefaultReportPlugin()
| openswmm::DefaultReportPlugin::DefaultReportPlugin |
( |
std::string | rpt_path | ) |
|
|
explicit |
Store a report destination and start in LOADED state.
- Parameters
-
| rpt_path | UTF-8 filename moved into storage; empty disables actual report IO. No file is opened and no path is validated until prepare()/write_summary(). |
◆ ~DefaultReportPlugin()
| openswmm::DefaultReportPlugin::~DefaultReportPlugin |
( |
| ) |
|
|
override |
Write an interruption marker, flush and close a report still open at destruction. No summary is generated; fprintf/flush/close errors are ignored. Caller first serializes all active report use and releases borrowed diagnostic pointers.
◆ finalize()
Append outstanding errors/warnings, flush and mark FINALIZED.
- Parameters
-
| ctx | Stable model diagnostics; errors are capped at one hundred plus a maximum-count notice, warnings are not capped. |
- Returns
- Zero even with no open file or unchecked fprintf/flush failure. Stream remains open for write_summary(); this is not the final file-close operation.
Implements openswmm::IReportPlugin.
◆ initialize()
| int openswmm::DefaultReportPlugin::initialize |
( |
const std::vector< std::string > & | init_args, |
|
|
const IPluginComponentInfo * | info ) |
|
override |
Mark INITIALIZED without opening the report.
- Parameters
-
| init_args | Ignored strings. |
| info | Ignored metadata pointer. |
- Returns
- Zero, retaining previous diagnostics/counters.
◆ last_error_message()
| const char * openswmm::DefaultReportPlugin::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::IReportPlugin.
◆ prepare()
Open a progressive report, write its preamble and mark PREPARED.
- Parameters
-
| ctx | Stable compatible model/options; rpt_disabled skips opening. A nonempty enabled destination uses truncate mode normally, exclusive creation after requireFreshOutput(). Call only once before final close; no guard closes an already open stream on repeated prepare. |
- Returns
- -1 plus ERROR/last_error only for failed exclusive managed creation; ordinary open failure still returns zero and marks PREPARED with no file. Preamble/flush errors are not checked; exceptions propagate.
Implements openswmm::IReportPlugin.
◆ requireFreshOutput()
| void openswmm::DefaultReportPlugin::requireFreshOutput |
( |
| ) |
|
|
inlinenoexcept |
Require exclusive file creation for managed-session report paths. Sets a retained flag only; existing streams are not reopened and no IO occurs.
◆ state()
| PluginState openswmm::DefaultReportPlugin::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::IReportPlugin.
◆ update()
Mark UPDATING without writing per-step report content.
- Parameters
-
| snapshot | Ignored immutable packet. |
- Returns
- Zero; report summaries use SimulationContext later.
Reimplemented from openswmm::IReportPlugin.
◆ validate()
Mark VALIDATED without checking path or model data.
- Parameters
-
- Returns
- Zero unconditionally.
Implements openswmm::IReportPlugin.
◆ write_summary()
Write result/snow/timing sections and close the report stream.
- Parameters
-
| ctx | Stable aligned model/statistics/options. Uses progressive preamble when prepared; otherwise opens/truncates (or creates exclusively) and writes the whole report including diagnostics. Run finalize() first to flush new diagnostics into an already open progressive stream. |
- Returns
- Zero for empty/disabled report or after writing/closing, -1 for fallback open failure. Does not detect later write/close errors, set last_error for that fallback failure, or change lifecycle state. Repeated calls after close can rewrite the report (or fail exclusive creation). Exceptions propagate.
Implements openswmm::IReportPlugin.
The documentation for this class was generated from the following files: