/**
* File: NetworkReader.h
*
* A NetworkReader reads in data about the traffic network from a specified
* xml file.
*
* A NetworkReader contains two public methods 'getLines' and 'getLoops',
* which are getters for the list of FEP_LINES, and STATIONS, respectively.
*
* Example XML file:
*
*
*
* 5
* 20
* 1
* 1
* 1123005673
* 1357648
* 26492
*
*
* 1205270
* 5
* 19
* MAIN 1
* 33.0
* S
* 5
* 0
* 0
*
*
* 1205272
* RAMP_ON
* 1
* 0
* 0
* 0
*
* .......
*
*
* @author John A. Torres
* @verions 9/08/2017
*/
// Include guard
#ifndef __NETWORKREADER_H_INCLUDED__
#define __NETWORKREADER_H_INCLUDED__
// Included dependencies
#include "network.h"
#include
#include
#include
#include "tinyxml.h"
#include "DataPacker.h"
class NetworkReader {
public:
/**
* Constructor
* @param xml Highway Status XML data
*/
NetworkReader(const char * xml);
/**
* Destructor: no cleaning necessary
*/
~NetworkReader();
/**
* Returns FEP_LINE list.
*
* @return List of FEP_LINES
*/
vector getLines();
/**
* Returns STATIONS list.
* @return List of STATIONs
*/
vector getStations();
private:
vector lines;
vector stations;
int ldsIndex;
/**
* Loads Highway Status data from xml.
*
* @param xml Highway Status XML.
*/
void loadLines(const char * networkFileName);
/**
* Parses a single LOOP
* @param loopElem TinyXML loop elem
* @return LOOP
*/
LOOP * parseLoop(TiXmlElement * loopElem);
/**
* Parses a single STATION
*
* @param TinyXML station element
* @param the parent FEP_LINE
* @return STATION
*/
STATION * parseStation(TiXmlElement *stationElem, FEP_LINE *line);
/**
* Parses a single FEP_LINE
* @param TinyXML line element
* @return FEP_LINE
*/
FEP_LINE * parseLine(TiXmlElement *lineElem);
};
#endif