![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Own configuration and output IO state for a GeoPackage adapter. More...
#include <GeoPackageOutputPlugin.hpp>
Public Member Functions | |
| GeoPackageOutputPlugin ()=default | |
| Create an unloaded output adapter with no open database. | |
| PluginState | state () const noexcept override |
| Read the stored adapter lifecycle marker. | |
| int | initialize (const std::vector< std::string > &init_args, const IPluginComponentInfo *info) override |
| Copy output adapter configuration without opening the database. | |
| int | validate (const SimulationContext &ctx) override |
| Mark the adapter validated without inspecting the model. | |
| int | prepare (const SimulationContext &ctx) override |
| Open/create the results database, write model metadata and prepare result insertion. | |
| int | update (const SimulationSnapshot &snapshot) override |
| Copy a snapshot's report-selected values into buffered database rows. | |
| int | finalize (const SimulationContext &ctx) override |
| Flush buffered rows, mark the run completed and release database resources. | |
| const char * | last_error_message () const noexcept override |
| Borrow the most recently stored failure diagnostic. | |
Public Member Functions inherited from openswmm::IOutputPlugin | |
| 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. | |
Own configuration and output IO state for a GeoPackage adapter.
Caller follows initialize/validate/prepare/update/finalize ordering as applicable and serializes all calls. State markers are descriptive; most methods do not enforce ordering. SQLite handles are privately owned; borrowed contexts/snapshots must remain valid during synchronous calls.
|
default |
Create an unloaded output adapter with no open database.
|
overridevirtual |
Flush buffered rows, mark the run completed and release database resources.
Requires a successfully prepared connection. Finalizes insert statement before closing DB and sets FINALIZED; handled failure sets ERROR and may leave resources/buffer for destruction. SQL step status for run completion is not checked.
| [in] | ctx | Unused borrowed context. |
Implements openswmm::IOutputPlugin.
|
override |
Copy output adapter configuration without opening the database.
Sets INITIALIZED on success. Does not clear prior diagnostic/cache/buffer state; use a fresh adapter per independently configured run. Allocation exceptions can propagate during argument copying.
| [in] | init_args | Borrowed arguments: [0] required database path, [1] optional simulation ID (default run_1). Extra arguments are ignored. |
| [in] | info | Unused borrowed metadata pointer; NULL is accepted. |
|
inlineoverridevirtualnoexcept |
Borrow the most recently stored failure diagnostic.
Success does not consistently clear an earlier diagnostic.
Reimplemented from openswmm::IOutputPlugin.
|
overridevirtual |
Open/create the results database, write model metadata and prepare result insertion.
Creates schema, writes the selected model/run, populates variables/species metadata, caches variable IDs/report flags and prepares an insert statement. Sets PREPARED on success, ERROR on handled failure. Does not roll back all earlier model/run setup after a later refusal. Connection and statement remain adapter-owned until finalize/destruction.
| [in] | ctx | Borrowed aligned model context; retained scalar/vector metadata is copied where needed, not owned through this reference. |
Implements openswmm::IOutputPlugin.
|
inlineoverridevirtualnoexcept |
Read the stored adapter lifecycle marker.
Implements openswmm::IOutputPlugin.
|
overridevirtual |
Copy a snapshot's report-selected values into buffered database rows.
Rows own copied object IDs/values; absent cached variables are skipped. Flushes at >=5000 buffered rows. No PREPARED guard, no rollback of rows buffered before a later exception, and no state-marker transition on update failure. SQLite bind/step statuses in the flush loop are discarded, so zero alone does not certify every row was inserted.
| [in] | snapshot | Borrowed snapshot with valid counts/parallel arrays and reported-species names. Values are already in display units, sim_time is elapsed seconds; no conversion here. |
Implements openswmm::IOutputPlugin.
|
overridevirtual |
Mark the adapter validated without inspecting the model.
| [in] | ctx | Unused borrowed context; no model/schema/file validation is performed. |
Implements openswmm::IOutputPlugin.