OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
InputReader.hpp
Go to the documentation of this file.
1
39
#ifndef OPENSWMM_ENGINE_INPUT_READER_HPP
40
#define OPENSWMM_ENGINE_INPUT_READER_HPP
41
42
#include "
SectionRegistry.hpp
"
43
#include "../core/SimulationContext.hpp"
44
45
#include <string>
46
#include <vector>
47
#include <iosfwd>
48
49
namespace
openswmm::input
{
50
56
class
InputReader
{
57
public
:
63
explicit
InputReader
(
SectionRegistry
& registry);
64
79
bool
read
(
const
std::string& path,
SimulationContext
& ctx);
80
88
bool
read_stream
(std::istream& stream,
SimulationContext
& ctx);
89
93
int
lines_read
() const noexcept {
return
lines_read_; }
94
98
const
std::vector<std::string>&
skipped_sections
() const noexcept {
99
return
skipped_sections_;
100
}
101
102
private
:
103
SectionRegistry
& registry_;
104
int
lines_read_ = 0;
105
std::vector<std::string> skipped_sections_;
106
116
static
std::string parse_section_header(std::string_view line);
117
121
void
dispatch_section(
122
const
std::string& tag,
123
const
std::vector<std::string>& lines,
124
SimulationContext
& ctx
125
);
126
};
127
128
}
/* namespace openswmm::input */
129
130
#endif
/* OPENSWMM_ENGINE_INPUT_READER_HPP */
SectionRegistry.hpp
Registry that maps SWMM section tags to handler functions.
openswmm::input::InputReader
Reads and parses a SWMM .inp file into a SimulationContext.
Definition
InputReader.hpp:56
openswmm::input::InputReader::skipped_sections
const std::vector< std::string > & skipped_sections() const noexcept
List of section tags that were skipped (no registered handler).
Definition
InputReader.hpp:98
openswmm::input::InputReader::lines_read
int lines_read() const noexcept
Number of lines successfully parsed in the last read() call.
Definition
InputReader.hpp:93
openswmm::input::InputReader::read_stream
bool read_stream(std::istream &stream, SimulationContext &ctx)
Parse from an already-open stream (for testing / stdin).
Definition
InputReader.cpp:53
openswmm::input::InputReader::read
bool read(const std::string &path, SimulationContext &ctx)
Read and parse the specified .inp file.
Definition
InputReader.cpp:37
openswmm::input::SectionRegistry
Registry that maps section tags (e.g., "[JUNCTIONS]") to handlers.
Definition
SectionRegistry.hpp:71
openswmm::input
Definition
CatchmentHandler.cpp:44
openswmm::SimulationContext
Central, reentrant simulation context.
Definition
SimulationContext.hpp:141
src
engine
input
InputReader.hpp
Generated by
1.9.8