EPANET  3.0
EPANET Development Project
inputreader.h
Go to the documentation of this file.
1 /* EPANET 3
2  *
3  * Copyright (c) 2016 Open Water Analytics
4  * Licensed under the terms of the MIT License (see the LICENSE file for details).
5  *
6  */
7 
10 
11 #ifndef INPUTREADER_H_
12 #define INPUTREADER_H_
13 
14 #include <iostream>
15 #include <sstream>
16 
17 class Network;
18 class InputParser;
19 
28 
30 {
31  public:
32 
33  enum Section {
34  TITLE, JUNCTION, RESERVOIR, TANK,
35  PIPE, PUMP, VALVE, PATTERN,
36  CURVE, CONTROL, RULE, EMITTER,
37  DEMAND, STATUS, ROUGHNESS, LEAKAGE,
38  ENERGY, QUALITY, SOURCE, REACTION,
39  MIXING, OPTION, TIME, REPORT,
40  COORD, VERTICES, LABEL, MAP,
41  BACKDROP, TAG, END
42  };
43 
44  InputReader();
45  ~InputReader() {}
46 
47  void readFile(const char* inpFile, Network* network);
48 
49  protected:
50 
51  std::istringstream sin;
52  int errcount;
53  int section;
54 
55  void parseFile(std::istream& fin, InputParser& parser);
56  void trimLine(std::string& line);
57  void findSection(std::string& token);
58 };
59 
60 #endif
std::istringstream sin
string stream containing a line of input
Definition: inputreader.h:51
int section
file section being processed
Definition: inputreader.h:53
Parses lines of network input data from a text file.
Definition: inputparser.h:35
Reads lines of project input data from a text file.
Definition: inputreader.h:29
Contains the data elements that describe a pipe network.
Definition: network.h:41
int errcount
error count
Definition: inputreader.h:52