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

Own configuration and report IO state for a GeoPackage adapter. More...

#include <GeoPackageReportPlugin.hpp>

Inheritance diagram for openswmm::gpkg::GeoPackageReportPlugin:
Collaboration diagram for openswmm::gpkg::GeoPackageReportPlugin:

Public Member Functions

 GeoPackageReportPlugin ()=default
 Create an unloaded report 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 report 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 database and cache existing variable identifiers.
 
int update (const SimulationSnapshot &snapshot) override
 Accept a snapshot without per-step work.
 
int write_summary (const SimulationContext &ctx) override
 Write selected object statistics and run continuity summaries.
 
int finalize (const SimulationContext &ctx) override
 Close the owned report database and mark finalized.
 
const char * last_error_message () const noexcept override
 Borrow the most recently stored failure diagnostic.
 
- Public Member Functions inherited from openswmm::IReportPlugin
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.
 

Detailed Description

Own configuration and report 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.

Constructor & Destructor Documentation

◆ GeoPackageReportPlugin()

openswmm::gpkg::GeoPackageReportPlugin::GeoPackageReportPlugin ( )
default

Create an unloaded report adapter with no open database.

Member Function Documentation

◆ finalize()

int openswmm::gpkg::GeoPackageReportPlugin::finalize ( const SimulationContext & ctx)
overridevirtual

Close the owned report database and mark finalized.

Parameters
[in]ctxUnused borrowed context.
Returns
Always zero; sets FINALIZED without generating a summary.

Implements openswmm::IReportPlugin.

◆ initialize()

int openswmm::gpkg::GeoPackageReportPlugin::initialize ( const std::vector< std::string > & init_args,
const IPluginComponentInfo * info )
override

Copy report 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.

Parameters
[in]init_argsBorrowed arguments: [0] required database path, [1] optional simulation ID (default run_1). Extra arguments are ignored.
[in]infoUnused borrowed metadata pointer; NULL is accepted.
Returns
Zero after configuration; -1 with diagnostic when no database-path argument exists.

◆ last_error_message()

const char * openswmm::gpkg::GeoPackageReportPlugin::last_error_message ( ) const
inlineoverridevirtualnoexcept

Borrow the most recently stored failure diagnostic.

Success does not consistently clear an earlier diagnostic.

Returns
Adapter-owned NUL-terminated string; empty initially. Copy before a later diagnostic mutation or destruction.

Reimplemented from openswmm::IReportPlugin.

◆ prepare()

int openswmm::gpkg::GeoPackageReportPlugin::prepare ( const SimulationContext & ctx)
overridevirtual

Open/create the database and cache existing variable identifiers.

Requires variables schema already present; this adapter does not call create_schema(). Sets PREPARED only on success; failure stores diagnostic without forcing ERROR. Exact variable cache entries from earlier preparation are not cleared.

Parameters
[in]ctxUnused borrowed context; model values are read later in write_summary().
Returns
Zero after normal cache construction; -1 after caught std::exception.

Implements openswmm::IReportPlugin.

Here is the call graph for this function:

◆ state()

PluginState openswmm::gpkg::GeoPackageReportPlugin::state ( ) const
inlineoverridevirtualnoexcept

Read the stored adapter lifecycle marker.

Returns
Last assigned PluginState; individual operations do not independently enforce ordering.

Implements openswmm::IReportPlugin.

◆ update()

int openswmm::gpkg::GeoPackageReportPlugin::update ( const SimulationSnapshot & snapshot)
overridevirtual

Accept a snapshot without per-step work.

Parameters
[in]snapshotUnused borrowed snapshot; final summary reads context statistics instead.
Returns
Always zero; no state changes or IO.

Reimplemented from openswmm::IReportPlugin.

◆ validate()

int openswmm::gpkg::GeoPackageReportPlugin::validate ( const SimulationContext & ctx)
overridevirtual

Mark the adapter validated without inspecting the model.

Parameters
[in]ctxUnused borrowed context; no model/schema/file validation is performed.
Returns
Always zero; sets VALIDATED.

Implements openswmm::IReportPlugin.

◆ write_summary()

int openswmm::gpkg::GeoPackageReportPlugin::write_summary ( const SimulationContext & ctx)
overridevirtual

Write selected object statistics and run continuity summaries.

Requires prepared DB/schema/cache and aligned report-flag arrays. Stores raw context statistics without display conversion: internal ft/cfs/ft3 and seconds where applicable, dimensionless filling. Missing variable IDs skip individual rows. Sets run quality-continuity field to the current placeholder zero. SQLite bind/step statuses are discarded; exceptions trigger best-effort transaction rollback.

Parameters
[in]ctxBorrowed aligned model context; retained scalar/vector metadata is copied where needed, not owned through this reference.
Returns
Zero after normal transaction commit; -1 after caught std::exception.

Implements openswmm::IReportPlugin.

Here is the call graph for this function:

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