OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
openswmm::IInputPlugin Class Referenceabstract

Interface for input file reader/writer plugins. More...

#include <IInputPlugin.hpp>

Inheritance diagram for openswmm::IInputPlugin:
Collaboration diagram for openswmm::IInputPlugin:

Public Member Functions

virtual ~IInputPlugin ()=default
 
virtual PluginState state () const noexcept=0
 Query the current plugin state.
 
virtual int initialize (const std::vector< std::string > &init_args, const IPluginComponentInfo *info)=0
 Initialize from [PLUGINS] arguments.
 
virtual int validate (const SimulationContext &ctx)=0
 Validate configuration against the loaded model.
 
virtual int read (const std::string &path, SimulationContext &ctx)=0
 Read model data from a file into the simulation context.
 
virtual int write (const std::string &path, const SimulationContext &ctx)=0
 Write model data from the simulation context to a file.
 
virtual std::vector< std::string > skipped_sections () const
 Sections or elements that were skipped during the last read().
 
virtual int finalize (const SimulationContext &ctx)=0
 Finalize and release resources.
 
virtual const char * last_error_message () const noexcept
 Get the last error message.
 

Detailed Description

Interface for input file reader/writer plugins.

Constructor & Destructor Documentation

◆ ~IInputPlugin()

virtual openswmm::IInputPlugin::~IInputPlugin ( )
virtualdefault

Member Function Documentation

◆ finalize()

virtual int openswmm::IInputPlugin::finalize ( const SimulationContext ctx)
pure virtual

Finalize and release resources.

Parameters
ctxSimulation context.
Returns
0 on success.
Postcondition
state() == PluginState::FINALIZED on success.

Implemented in openswmm::gpkg::GeoPackageInputPlugin, and openswmm::DefaultInputPlugin.

Here is the caller graph for this function:

◆ initialize()

virtual int openswmm::IInputPlugin::initialize ( const std::vector< std::string > &  init_args,
const IPluginComponentInfo info 
)
pure virtual

Initialize from [PLUGINS] arguments.

Parameters
init_argsTokenized arguments from the [PLUGINS] line.
infoBack-pointer to IPluginComponentInfo.
Returns
0 on success.
Postcondition
state() == PluginState::INITIALIZED on success.

Implemented in openswmm::gpkg::GeoPackageInputPlugin, and openswmm::DefaultInputPlugin.

Here is the caller graph for this function:

◆ last_error_message()

virtual const char * openswmm::IInputPlugin::last_error_message ( ) const
inlinevirtualnoexcept

Get the last error message.

Reimplemented in openswmm::gpkg::GeoPackageInputPlugin, and openswmm::DefaultInputPlugin.

◆ read()

virtual int openswmm::IInputPlugin::read ( const std::string &  path,
SimulationContext ctx 
)
pure virtual

Read model data from a file into the simulation context.

Populates all SoA arrays, name indices, options, and tables in the SimulationContext. The caller (SWMMEngine::open()) is responsible for calling cross-reference resolution after this method returns.

Implementations should also populate ctx.plugin_specs if the input format supports plugin declarations, so the engine can load output/report plugins after reading.

Input plugins are injected into the engine before open() is called — they cannot be discovered via [PLUGINS] because the input file has not been read yet at that point.

Parameters
pathPath to the input file.
ctxSimulation context to populate.
Returns
0 on success, non-zero error code on failure.

Implemented in openswmm::gpkg::GeoPackageInputPlugin, and openswmm::DefaultInputPlugin.

◆ skipped_sections()

virtual std::vector< std::string > openswmm::IInputPlugin::skipped_sections ( ) const
inlinevirtual

Sections or elements that were skipped during the last read().

Returns identifiers for any input sections or elements that had no handler and were ignored. For .inp files these are section tags like "MY_UNKNOWN_SECTION". Other formats may return their own identifiers (e.g., JSON keys).

Returns
Vector of skipped section/element identifiers (empty by default).

Reimplemented in openswmm::gpkg::GeoPackageInputPlugin, and openswmm::DefaultInputPlugin.

◆ state()

virtual PluginState openswmm::IInputPlugin::state ( ) const
pure virtualnoexcept

Query the current plugin state.

Implemented in openswmm::gpkg::GeoPackageInputPlugin, and openswmm::DefaultInputPlugin.

◆ validate()

virtual int openswmm::IInputPlugin::validate ( const SimulationContext ctx)
pure virtual

Validate configuration against the loaded model.

Parameters
ctxSimulation context (after input parsing).
Returns
0 on success.
Postcondition
state() == PluginState::VALIDATED on success.

Implemented in openswmm::gpkg::GeoPackageInputPlugin, and openswmm::DefaultInputPlugin.

◆ write()

virtual int openswmm::IInputPlugin::write ( const std::string &  path,
const SimulationContext ctx 
)
pure virtual

Write model data from the simulation context to a file.

Serializes the full model state to the specified file path in the format supported by this plugin.

Parameters
pathPath to the output file.
ctxSimulation context to serialize.
Returns
0 on success, non-zero error code on failure.

Implemented in openswmm::gpkg::GeoPackageInputPlugin, and openswmm::DefaultInputPlugin.

Here is the caller graph for this function:

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