| 1 | /** |
|---|
| 2 | * File: NetworkReader.h |
|---|
| 3 | * |
|---|
| 4 | * A NetworkReader reads in data about the traffic network from a specified |
|---|
| 5 | * xml file. |
|---|
| 6 | * |
|---|
| 7 | * A NetworkReader contains two public methods 'getLines' and 'getLoops', |
|---|
| 8 | * which are getters for the list of FEP_LINES, and STATIONS, respectively. |
|---|
| 9 | * |
|---|
| 10 | * Example XML file: |
|---|
| 11 | * <code> |
|---|
| 12 | * <Network> |
|---|
| 13 | * <Line> |
|---|
| 14 | * <Line_Num>5</Line_Num> |
|---|
| 15 | * <Count>20</Count> |
|---|
| 16 | * <Schedule>1</Schedule> |
|---|
| 17 | * <Line_Info>1</Line_Info> |
|---|
| 18 | * <System_Key>1123005673</System_Key> |
|---|
| 19 | * <Global_Seq>1357648</Global_Seq> |
|---|
| 20 | * <Schedule_Seq>26492</Schedule_Seq> |
|---|
| 21 | * <Stations> |
|---|
| 22 | * <Station> |
|---|
| 23 | * <LDS_ID>1205270</LDS_ID> |
|---|
| 24 | * <Line_Num>5</Line_Num> |
|---|
| 25 | * <Drop>19</Drop> |
|---|
| 26 | * <Location>MAIN 1</Location> |
|---|
| 27 | * <Post_Mile>33.0</Post_Mile> |
|---|
| 28 | * <Direction>S</Direction> |
|---|
| 29 | * <Freeway>5</Freeway> |
|---|
| 30 | * <ML_Tot_Vol>0</ML_Tot_Vol> |
|---|
| 31 | * <Opp_Tot_Vol>0</Opp_Tot_Vol> |
|---|
| 32 | * <Loops> |
|---|
| 33 | * <Loop> |
|---|
| 34 | * <Loop_ID>1205272</Loop_ID> |
|---|
| 35 | * <Loop_Location>RAMP_ON</Loop_Location> |
|---|
| 36 | * <Lane_Num>1</Lane_Num> |
|---|
| 37 | * <Vol>0</Vol> |
|---|
| 38 | * <Occ>0</Occ> |
|---|
| 39 | * <Spd>0</Spd> |
|---|
| 40 | * </Loop> |
|---|
| 41 | * ....... |
|---|
| 42 | * </code> |
|---|
| 43 | * |
|---|
| 44 | * @author John A. Torres |
|---|
| 45 | * @verions 9/08/2017 |
|---|
| 46 | */ |
|---|
| 47 | |
|---|
| 48 | // Include guard |
|---|
| 49 | #ifndef __NETWORKREADER_H_INCLUDED__ |
|---|
| 50 | #define __NETWORKREADER_H_INCLUDED__ |
|---|
| 51 | |
|---|
| 52 | // Included dependencies |
|---|
| 53 | #include "network.h" |
|---|
| 54 | #include <vector> |
|---|
| 55 | #include <string.h> |
|---|
| 56 | #include <iostream> |
|---|
| 57 | #include "tinyxml.h" |
|---|
| 58 | #include "DataPacker.h" |
|---|
| 59 | |
|---|
| 60 | class NetworkReader |
|---|
| 61 | { |
|---|
| 62 | public: |
|---|
| 63 | NetworkReader(const char * networkFile); // Constructor |
|---|
| 64 | ~NetworkReader(); // Destructor |
|---|
| 65 | |
|---|
| 66 | vector<FEP_LINE*> getLines(); // Getter for FEP_LINE list |
|---|
| 67 | vector<STATION*> getStations(); // Getter for STATION list |
|---|
| 68 | private: |
|---|
| 69 | vector<FEP_LINE*> lines; |
|---|
| 70 | vector<STATION*> stations; |
|---|
| 71 | int ldsIndex; |
|---|
| 72 | |
|---|
| 73 | void loadLines(const char * networkFileName); |
|---|
| 74 | LOOP * parseLoop(TiXmlElement * loopElem); |
|---|
| 75 | STATION * parseStation(TiXmlElement *stationElem, FEP_LINE *line); |
|---|
| 76 | FEP_LINE * parseLine(TiXmlElement *lineElem); |
|---|
| 77 | }; |
|---|
| 78 | |
|---|
| 79 | #endif |
|---|