| 1 | /* |
|---|
| 2 | * File: HighwaysParser.cpp |
|---|
| 3 | * Author: jtorres |
|---|
| 4 | * |
|---|
| 5 | * Created on October 28, 2017, 7:23 PM |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | #include "HighwaysParser.h" |
|---|
| 9 | |
|---|
| 10 | HighwaysParser::HighwaysParser(char * hwyData) { |
|---|
| 11 | string highwaysData = hwyData; |
|---|
| 12 | istringstream stream(highwaysData); |
|---|
| 13 | parseLines(highwaysData); |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | HighwaysParser::~HighwaysParser() { |
|---|
| 17 | } |
|---|
| 18 | |
|---|
| 19 | vector<FEP_LINE *> HighwaysParser::getLines() { |
|---|
| 20 | |
|---|
| 21 | } |
|---|
| 22 | |
|---|
| 23 | vector<STATION *> HighwaysParser::getStations() { |
|---|
| 24 | |
|---|
| 25 | } |
|---|
| 26 | // FEP line: Represents a serial communication line from field stations to the |
|---|
| 27 | // An FEP Line has several Loop Detector Stations (Stations) connected) |
|---|
| 28 | typedef struct fep_line FEP_LINE; |
|---|
| 29 | struct fep_line |
|---|
| 30 | { |
|---|
| 31 | int lineNum; |
|---|
| 32 | vector<long> lds; |
|---|
| 33 | vector<long> ldsIndex; // location in ldsMap |
|---|
| 34 | |
|---|
| 35 | short count; // actual count from caltrans |
|---|
| 36 | int schedule; |
|---|
| 37 | int lineInfo; |
|---|
| 38 | long systemKey; |
|---|
| 39 | long globalSeq; |
|---|
| 40 | long schedleSeq; |
|---|
| 41 | }; |
|---|
| 42 | void HighwaysParser::parseLines(istringstream highwaysData) |
|---|
| 43 | { |
|---|
| 44 | string currLine; |
|---|
| 45 | getline(highwaysData, currLine); |
|---|
| 46 | int numLines; |
|---|
| 47 | sscanf(highwaysData, "%d", &numLines); |
|---|
| 48 | |
|---|
| 49 | int lineNum = 0; |
|---|
| 50 | long lds = 0; |
|---|
| 51 | long ldsIndex = 0; |
|---|
| 52 | short count = 0; |
|---|
| 53 | int schedule = 0; |
|---|
| 54 | int lineInfo = 0; |
|---|
| 55 | long systemKey = 0; |
|---|
| 56 | long globalSeq = 0; |
|---|
| 57 | long schedleSeq = 0; |
|---|
| 58 | |
|---|
| 59 | for(int lineIndex = 0; lineIndex < numLines; lineIndex++) |
|---|
| 60 | { |
|---|
| 61 | getline(highwaysData, currLine); |
|---|
| 62 | int numStations = 0; |
|---|
| 63 | sscanf(currLine, "%d %d %d", &lineNum, &count, &numStations); |
|---|
| 64 | for(int stationIndex = 0; stationIndex < numStations; stationIndex++) |
|---|
| 65 | { |
|---|
| 66 | getline(highwaysData, currLine); |
|---|
| 67 | sscanf(currLine, "%d %d %d %d %d %d", &lds, ) |
|---|
| 68 | |
|---|
| 69 | } |
|---|
| 70 | } |
|---|
| 71 | getline(highwaysData, currLine); |
|---|
| 72 | } |
|---|
| 73 | |
|---|
| 74 | FEP_LINE * HighwaysParser::parseLine(istringstream highwaysData) |
|---|
| 75 | { |
|---|
| 76 | |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | STATION * HighwaysParser::parseStation(istringstream highwaysData) |
|---|
| 80 | { |
|---|
| 81 | |
|---|
| 82 | } |
|---|
| 83 | |
|---|
| 84 | LOOP * HighwaysParser::parseLoop(istringstream highwaysData) |
|---|
| 85 | { |
|---|
| 86 | |
|---|
| 87 | } |
|---|