![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Reads and parses a SWMM .inp file into a SimulationContext. More...
#include <InputReader.hpp>
Public Member Functions | |
| InputReader (SectionRegistry ®istry) | |
| Borrow a pre-populated handler registry. | |
| bool | read (const std::string &path, SimulationContext &ctx) |
| Open a UTF-8 input path and parse its section stream. | |
| bool | read_stream (std::istream &stream, SimulationContext &ctx) |
| Read section batches and replay deferred rows once. | |
| int | lines_read () const noexcept |
| Read the physical-line counter from the most recent stream parse. | |
| const std::vector< std::string > & | skipped_sections () const noexcept |
| Borrow unrecognized, unhandled section tags from the last stream parse. | |
Reads and parses a SWMM .inp file into a SimulationContext.
|
explicit |
Borrow a pre-populated handler registry.
No handlers are registered automatically by this constructor. Caller serializes reader, registry and context access.
| [in] | registry | Mutable registry reference that must outlive the reader and all synchronous reads. |
|
inlinenoexcept |
Read the physical-line counter from the most recent stream parse.
| bool openswmm::input::InputReader::read | ( | const std::string & | path, |
| SimulationContext & | ctx ) |
Open a UTF-8 input path and parse its section stream.
Open failure sets error_code=2, an error message and ERROR_STATE. On success delegates read_stream(); allocation/handler exceptions propagate. Does not perform post-parse cross-reference resolution or full model validation itself.
| [in] | path | Borrowed input filename; copied into ctx.inp_file_path only after successful open. |
| [in,out] | ctx | Caller-owned model context; handlers mutate it directly. This reader does not clear prior objects, errors or error_code and does not roll back partial input. |
| bool openswmm::input::InputReader::read_stream | ( | std::istream & | stream, |
| SimulationContext & | ctx ) |
Read section batches and replay deferred rows once.
Resets reader counters/skipped sections and ctx.unknown_section_headers, sets report object selections to NONE, preserves object comment rows and TITLE prose, ignores data before the first header. Existing objects/errors remain. Does not distinguish EOF from a stream read failure or call PostParseResolver.
| [in,out] | stream | Borrowed open stream read from its current position until getline stops; no seek/close is performed. |
| [in,out] | ctx | Caller-owned model context; handlers mutate it directly. This reader does not clear prior objects, errors or error_code and does not roll back partial input. |
|
inlinenoexcept |
Borrow unrecognized, unhandled section tags from the last stream parse.
Tags are unique in encounter order; known legacy prefixes without handlers are silently omitted.