- Timestamp:
- 10/25/2017 01:04:40 PM (9 years ago)
- Location:
- branches/FEPSimulator
- Files:
-
- 1 edited
- 1 moved
-
FEPSim.cpp (modified) (4 diffs)
-
HighwaysParser.cpp (moved) (moved from branches/FEPSimulator/NetworkReader.cpp) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/FEPSimulator/FEPSim.cpp
r148 r177 21 21 } 22 22 23 void FEPSim::sendReplys(char * xml) {24 NetworkReader networkReader = NetworkReader(xml);25 vector<FEP_LINE*> lines = networkReader.getLines();26 vector<STATION*> ldsMap = networkReader.getStations();23 void FEPSim::sendReplys(char * buffer) { 24 HighwaysParser highwaysParser = HighwaysParser(buffer); 25 vector<FEP_LINE*> lines = highwaysParser.getLines(); 26 vector<STATION*> ldsMap = highwaysParser.getStations(); 27 27 28 28 // Send one reply for every FEPLine … … 89 89 fepReply.answers.fep_answer_list_u.shortp.answers[0] = fsa; 90 90 // send out data 91 printf("Transferring line=%d, lds_drop_no=%d...\n", lines.at(i)->lineNum, ldsMap.at(index)->drop);91 printf("Transferring line=%d, lds_drop_no=%d...\n", lines.at(i)->lineNum, (int)ldsMap.at(index)->drop); 92 92 // Make RPC Call and handle response 93 93 // printf("Handling ATMS response...\n"); 94 // Transfer the station data to ATMS and listen for response 94 95 handleCallResponse(fep_reply_xfer_32(&fepReply, clnt)); 95 96 } … … 97 98 } 98 99 99 void FEPSim::updateATMS(char * xml) { 100 if (createClient()) { 101 sendReplys(xml); 100 void FEPSim::manageClientConnection(char * buffer) 101 { 102 // Attempt to create RPC client 103 if (createClient()) 104 { 105 // Prepare and send the highway status as FEP replies 106 sendReplys(buffer); 102 107 cout << "Destroying client..." << endl; 103 108 clnt_destroy(clnt); … … 184 189 185 190 // send data to atms 186 updateATMS(buffer);191 manageClientConnection(buffer); 187 192 } 188 193 } -
branches/FEPSimulator/HighwaysParser.cpp
r156 r177 1 1 #include "NetworkReader.h" 2 2 3 NetworkReader::NetworkReader(const char * xml) {3 HighwaysParser::HighwaysParser(const char * xml) { 4 4 ldsIndex = 0; 5 5 loadLines(xml); 6 6 } 7 7 8 LOOP * NetworkReader::parseLoop(TiXmlElement * loopElem) {8 LOOP * HighwaysParser::parseLoop(TiXmlElement * loopElem) { 9 9 LOOP *loop = new LOOP; 10 10 … … 24 24 } 25 25 26 STATION * NetworkReader::parseStation(TiXmlElement *stationElem, FEP_LINE *line) {26 STATION * HighwaysParser::parseStation(TiXmlElement *stationElem, FEP_LINE *line) { 27 27 STATION *station = new STATION; 28 28 … … 62 62 } 63 63 64 FEP_LINE * NetworkReader::parseLine(TiXmlElement * lineElem) {64 FEP_LINE * HighwaysParser::parseLine(TiXmlElement * lineElem) { 65 65 FEP_LINE *line = new FEP_LINE; 66 66 … … 89 89 } 90 90 91 void NetworkReader::loadLines(const char * xml) {91 void HighwaysParser::loadLines(const char * xml) { 92 92 // Load network xml file 93 93 TiXmlDocument doc; … … 107 107 } 108 108 109 vector<FEP_LINE*> NetworkReader::getLines() {109 vector<FEP_LINE*> HighwaysParser::getLines() { 110 110 111 111 return lines; 112 112 } 113 113 114 vector<STATION*> NetworkReader::getStations() {114 vector<STATION*> HighwaysParser::getStations() { 115 115 116 116 return stations; 117 117 } 118 118 119 NetworkReader::~NetworkReader() {119 HighwaysParser::~HighwaysParser() { 120 120 121 121 }
Note: See TracChangeset
for help on using the changeset viewer.
