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
49namespace openswmm::input {
50
57public:
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
102private:
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,
125 );
126};
127
128} /* namespace openswmm::input */
129
130#endif /* OPENSWMM_ENGINE_INPUT_READER_HPP */
Registry that maps SWMM section tags to handler functions.
Reads and parses a SWMM .inp file into a SimulationContext.
Definition InputReader.hpp:56
const std::vector< std::string > & skipped_sections() const noexcept
List of section tags that were skipped (no registered handler).
Definition InputReader.hpp:98
int lines_read() const noexcept
Number of lines successfully parsed in the last read() call.
Definition InputReader.hpp:93
bool read_stream(std::istream &stream, SimulationContext &ctx)
Parse from an already-open stream (for testing / stdin).
Definition InputReader.cpp:53
bool read(const std::string &path, SimulationContext &ctx)
Read and parse the specified .inp file.
Definition InputReader.cpp:37
Registry that maps section tags (e.g., "[JUNCTIONS]") to handlers.
Definition SectionRegistry.hpp:71
Definition CatchmentHandler.cpp:44
Central, reentrant simulation context.
Definition SimulationContext.hpp:141