source: tmcsimulator/branches/fep_rpc_client/NetworkReader.h @ 78

Revision 78, 2.3 KB checked in by jtorres, 9 years ago (diff)

All green dots are showing. This is a checkpoint before adding dynamic data packing.

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