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

Reads and parses a SWMM .inp file into a SimulationContext. More...

#include <InputReader.hpp>

Collaboration diagram for openswmm::input::InputReader:

Public Member Functions

 InputReader (SectionRegistry &registry)
 Construct an InputReader with a pre-populated registry.
 
bool read (const std::string &path, SimulationContext &ctx)
 Read and parse the specified .inp file.
 
bool read_stream (std::istream &stream, SimulationContext &ctx)
 Parse from an already-open stream (for testing / stdin).
 
int lines_read () const noexcept
 Number of lines successfully parsed in the last read() call.
 
const std::vector< std::string > & skipped_sections () const noexcept
 List of section tags that were skipped (no registered handler).
 

Detailed Description

Reads and parses a SWMM .inp file into a SimulationContext.

Constructor & Destructor Documentation

◆ InputReader()

openswmm::input::InputReader::InputReader ( SectionRegistry registry)
explicit

Construct an InputReader with a pre-populated registry.

Parameters
registryReference to the section registry (must outlive this reader).

Member Function Documentation

◆ lines_read()

int openswmm::input::InputReader::lines_read ( ) const
inlinenoexcept

Number of lines successfully parsed in the last read() call.

◆ read()

bool openswmm::input::InputReader::read ( const std::string &  path,
SimulationContext ctx 
)

Read and parse the specified .inp file.

After parsing, ctx holds all objects, options, and tables. Any parse errors are reported via ctx.error_code / ctx.error_message. The function returns false if a fatal parse error occurred.

Parameters
pathPath to the input file.
ctxSimulation context to populate.
Returns
true on success, false if a fatal error occurred.
See also
ctx.error_code, ctx.error_message for diagnostics.
Here is the call graph for this function:

◆ read_stream()

bool openswmm::input::InputReader::read_stream ( std::istream &  stream,
SimulationContext ctx 
)

Parse from an already-open stream (for testing / stdin).

Parameters
streamInput stream.
ctxSimulation context to populate.
Returns
true on success.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ skipped_sections()

const std::vector< std::string > & openswmm::input::InputReader::skipped_sections ( ) const
inlinenoexcept

List of section tags that were skipped (no registered handler).


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