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

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

#include <GeoPackageInputPlugin.hpp>

Inheritance diagram for openswmm::gpkg::GeoPackageInputPlugin:
Collaboration diagram for openswmm::gpkg::GeoPackageInputPlugin:

Public Member Functions

 GeoPackageInputPlugin ()=default
 Create an unloaded input 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 input adapter configuration without opening the database.
 
int validate (const SimulationContext &ctx) override
 Mark the adapter validated without inspecting the model.
 
int read (const std::string &path, SimulationContext &ctx) override
 Read one simulation from a read-only GeoPackage connection.
 
int write (const std::string &path, const SimulationContext &ctx) override
 Write the model into the configured simulation of a GeoPackage.
 
std::vector< std::string > skipped_sections () const override
 Return the adapter's unsupported-section listing.
 
int finalize (const SimulationContext &ctx) override
 Mark the input adapter finalized.
 
const char * last_error_message () const noexcept override
 Borrow the most recently stored failure diagnostic.
 
- Public Member Functions inherited from openswmm::IInputPlugin
virtual ~IInputPlugin ()=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.
 

Detailed Description

Own configuration and input 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

◆ GeoPackageInputPlugin()

openswmm::gpkg::GeoPackageInputPlugin::GeoPackageInputPlugin ( )
default

Create an unloaded input adapter with no open database.

Member Function Documentation

◆ finalize()

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

Mark the input adapter finalized.

Parameters
[in]ctxUnused borrowed context.
Returns
Always zero; read/write use local connections so no persistent database is closed here.

Implements openswmm::IInputPlugin.

◆ initialize()

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

Copy input 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. SRS uses stoi prefix parsing; its exceptions are caught and set SRS zero.

Parameters
[in]init_argsBorrowed arguments: [0] simulation ID (default retained/default), [1] optional SRS integer; missing entries preserve prior configuration.
[in]infoUnused borrowed metadata pointer; NULL is accepted.
Returns
Zero after configuration; -1 is not returned for SRS parse errors: malformed SRS becomes zero.

Implements openswmm::IInputPlugin.

◆ last_error_message()

const char * openswmm::gpkg::GeoPackageInputPlugin::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::IInputPlugin.

◆ read()

int openswmm::gpkg::GeoPackageInputPlugin::read ( const std::string & path,
SimulationContext & ctx )
overridevirtual

Read one simulation from a read-only GeoPackage connection.

When configured ID equals default, selects the first returned simulations row (no ordering guarantee), then nodes fallback if none. Stores that selected ID for later calls. Does not change PluginState on read result and does not enforce initialized/validated state.

Parameters
[in]pathBorrowed existing .gpkg filename, opened read-only.
[in,out]ctxCaller-owned context populated directly by read_model(); no rollback of partial context adoption is supplied by this adapter.
Returns
Zero for normal read; read_model refusal code, or -1 after a caught std::exception.

Implements openswmm::IInputPlugin.

Here is the call graph for this function:

◆ skipped_sections()

std::vector< std::string > openswmm::gpkg::GeoPackageInputPlugin::skipped_sections ( ) const
inlineoverridevirtual

Return the adapter's unsupported-section listing.

Returns
Always an empty owned vector; no read diagnostics are inferred from this listing.

Reimplemented from openswmm::IInputPlugin.

◆ state()

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

Read the stored adapter lifecycle marker.

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

Implements openswmm::IInputPlugin.

◆ validate()

int openswmm::gpkg::GeoPackageInputPlugin::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::IInputPlugin.

◆ write()

int openswmm::gpkg::GeoPackageInputPlugin::write ( const std::string & path,
const SimulationContext & ctx )
overridevirtual

Write the model into the configured simulation of a GeoPackage.

Creates/updates schema, infers SRS from text after a CRS colon only when configured SRS is zero, and registers a positive inferred EPSG row. No model CRS transform. Does not change adapter state; writer controls transaction semantics.

Parameters
[in]pathBorrowed destination opened READWRITE|CREATE; existing model rows may be replaced by write_model().
[in]ctxBorrowed aligned model context; retained scalar/vector metadata is copied where needed, not owned through this reference.
Returns
Zero after writer returns; -1 after a caught std::exception.

Implements openswmm::IInputPlugin.

Here is the call graph for this function:

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