Changeset 177 in tmcsimulator for branches/FEPSimulator


Ignore:
Timestamp:
10/25/2017 01:04:40 PM (9 years ago)
Author:
jdalbey
Message:

FEPSim.cpp Clarify comments and variable names.

Location:
branches/FEPSimulator
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/FEPSimulator/FEPSim.cpp

    r148 r177  
    2121} 
    2222 
    23 void FEPSim::sendReplys(char * xml) { 
    24     NetworkReader networkReader = NetworkReader(xml); 
    25     vector<FEP_LINE*> lines = networkReader.getLines(); 
    26     vector<STATION*> ldsMap = networkReader.getStations(); 
     23void FEPSim::sendReplys(char * buffer) { 
     24    HighwaysParser highwaysParser = HighwaysParser(buffer); 
     25    vector<FEP_LINE*> lines = highwaysParser.getLines(); 
     26    vector<STATION*> ldsMap = highwaysParser.getStations(); 
    2727 
    2828    // Send one reply for every FEPLine 
     
    8989            fepReply.answers.fep_answer_list_u.shortp.answers[0] = fsa; 
    9090            // 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); 
    9292            // Make RPC Call and handle response 
    9393            // printf("Handling ATMS response...\n"); 
     94            // Transfer the station data to ATMS and listen for response 
    9495            handleCallResponse(fep_reply_xfer_32(&fepReply, clnt)); 
    9596        } 
     
    9798} 
    9899 
    99 void FEPSim::updateATMS(char * xml) { 
    100     if (createClient()) { 
    101         sendReplys(xml); 
     100void 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); 
    102107        cout << "Destroying client..." << endl; 
    103108        clnt_destroy(clnt); 
     
    184189 
    185190        // send data to atms 
    186         updateATMS(buffer); 
     191        manageClientConnection(buffer); 
    187192    } 
    188193} 
  • branches/FEPSimulator/HighwaysParser.cpp

    r156 r177  
    11#include "NetworkReader.h" 
    22 
    3 NetworkReader::NetworkReader(const char * xml) { 
     3HighwaysParser::HighwaysParser(const char * xml) { 
    44    ldsIndex = 0; 
    55    loadLines(xml); 
    66} 
    77 
    8 LOOP * NetworkReader::parseLoop(TiXmlElement * loopElem) { 
     8LOOP * HighwaysParser::parseLoop(TiXmlElement * loopElem) { 
    99    LOOP *loop = new LOOP; 
    1010 
     
    2424} 
    2525 
    26 STATION * NetworkReader::parseStation(TiXmlElement *stationElem, FEP_LINE *line) { 
     26STATION * HighwaysParser::parseStation(TiXmlElement *stationElem, FEP_LINE *line) { 
    2727    STATION *station = new STATION; 
    2828 
     
    6262} 
    6363 
    64 FEP_LINE * NetworkReader::parseLine(TiXmlElement * lineElem) { 
     64FEP_LINE * HighwaysParser::parseLine(TiXmlElement * lineElem) { 
    6565    FEP_LINE *line = new FEP_LINE; 
    6666 
     
    8989} 
    9090 
    91 void NetworkReader::loadLines(const char * xml) { 
     91void HighwaysParser::loadLines(const char * xml) { 
    9292    // Load network xml file 
    9393    TiXmlDocument doc; 
     
    107107} 
    108108 
    109 vector<FEP_LINE*> NetworkReader::getLines() { 
     109vector<FEP_LINE*> HighwaysParser::getLines() { 
    110110 
    111111    return lines; 
    112112} 
    113113 
    114 vector<STATION*> NetworkReader::getStations() { 
     114vector<STATION*> HighwaysParser::getStations() { 
    115115 
    116116    return stations; 
    117117} 
    118118 
    119 NetworkReader::~NetworkReader() { 
     119HighwaysParser::~HighwaysParser() { 
    120120 
    121121} 
Note: See TracChangeset for help on using the changeset viewer.