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

Default input plugin that reads/writes SWMM .inp files. More...

#include <DefaultInputPlugin.hpp>

Inheritance diagram for openswmm::DefaultInputPlugin:
Collaboration diagram for openswmm::DefaultInputPlugin:

Public Member Functions

 DefaultInputPlugin ()
 Construct an UNLOADED plugin and register builtin input/annotation handlers. No file is read; allocation/registration exceptions propagate.
 
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 this plugin INITIALIZED without interpreting arguments.
 
int validate (const SimulationContext &ctx) override
 Mark this plugin VALIDATED without validating a model.
 
int read (const std::string &path, SimulationContext &ctx) override
 Read an input file through the owned section registry.
 
int readText (const std::string &text, SimulationContext &ctx)
 
void registerContextSections (SimulationContext &ctx)
 
int write (const std::string &path, const SimulationContext &ctx) override
 Serialize current engine state through InpWriter and its sidecar rules.
 
int finalize (const SimulationContext &ctx) override
 Mark the plugin FINALIZED without IO or validation.
 
const char * last_error_message () const noexcept override
 Borrow the stored diagnostic text without clearing it.
 
std::vector< std::string > skipped_sections () const override
 Copy the last completed InputReader skipped-section list.
 
input::SectionRegistry & registry () noexcept
 Borrow the owned mutable handler registry for caller-managed extensions.
 
- 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

Default input plugin that reads/writes SWMM .inp files.

Owns a SectionRegistry populated with all built-in SWMM section handlers. The registry maps section tags (JUNCTIONS, CONDUITS, etc.) to handler functions that populate the SimulationContext.

Constructor & Destructor Documentation

◆ DefaultInputPlugin()

openswmm::DefaultInputPlugin::DefaultInputPlugin ( )

Construct an UNLOADED plugin and register builtin input/annotation handlers. No file is read; allocation/registration exceptions propagate.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ finalize()

int openswmm::DefaultInputPlugin::finalize ( const SimulationContext & ctx)
overridevirtual

Mark the plugin FINALIZED without IO or validation.

Parameters
ctxIgnored context.
Returns
Zero; retains registry, diagnostics and skipped sections.

Implements openswmm::IInputPlugin.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialize()

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

Mark this plugin INITIALIZED without interpreting arguments.

Parameters
init_argsIgnored initialization strings; not retained.
infoIgnored metadata pointer; may be null.
Returns
Zero, without clearing an earlier diagnostic or skipped-section list.

Implements openswmm::IInputPlugin.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ last_error_message()

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

◆ read()

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

Read an input file through the owned section registry.

Parameters
pathUTF-8 input filename interpreted by InputReader.
[in,out]ctxEngine state populated by registered handlers; follows InputReader's initialization/error and partial-mutation contract.
Returns
Zero on accepted read, otherwise context error_code or -1 when it is zero. Always copies the reader's skipped-section list; on failure copies error_message to last_error. Success does not clear older last_error or change lifecycle state. Parser/handler/allocation exceptions are not caught by this plugin.

Implements openswmm::IInputPlugin.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readText()

int openswmm::DefaultInputPlugin::readText ( const std::string & text,
SimulationContext & ctx )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerContextSections()

void openswmm::DefaultInputPlugin::registerContextSections ( SimulationContext & ctx)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ registry()

input::SectionRegistry & openswmm::DefaultInputPlugin::registry ( )
inlinenoexcept

Borrow the owned mutable handler registry for caller-managed extensions.

Returns
Registry valid until plugin destruction; do not mutate it during a read or concurrently with registration/dispatch. Changes affect later input parsing.
Here is the caller graph for this function:

◆ skipped_sections()

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

Copy the last completed InputReader skipped-section list.

Returns
Independent names, replaced after read() returns; no new file scan occurs.

Reimplemented from openswmm::IInputPlugin.

◆ state()

PluginState openswmm::DefaultInputPlugin::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::IInputPlugin.

◆ validate()

int openswmm::DefaultInputPlugin::validate ( const SimulationContext & ctx)
overridevirtual

Mark this plugin VALIDATED without validating a model.

Parameters
ctxIgnored context.
Returns
Zero unconditionally; actual model/input validation is performed elsewhere.

Implements openswmm::IInputPlugin.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write()

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

Serialize current engine state through InpWriter and its sidecar rules.

Parameters
pathUTF-8 destination filename; writing can create/replace the input and component/mesh companions according to InpWriter's staged persistence contract.
ctxBorrowed model; const interface does not permit appending ctx.warnings.
Returns
Exact writeInpFile status. Nonzero stores a path failure plus collected writer warnings in last_error. On zero, warnings are discarded and an old error can remain stored; success does not update lifecycle state. Exceptions propagate.

Implements openswmm::IInputPlugin.

Here is the call graph for this function:
Here is the caller graph for this function:

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