SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
testclient::TraCITestClient Class Reference

#include <TraCITestClient.h>

Public Member Functions

bool close ()
void commandClose ()
void commandDistanceRequest (testclient::Position pos1, testclient::Position pos2, int flag)
void commandDistanceRequest (testclient::Position3D pos1, testclient::Position3D pos2, int flag)
void commandDistanceRequest (testclient::Position pos1, testclient::Position3D pos2, int flag)
void commandDistanceRequest (testclient::Position3D pos1, testclient::Position pos2, int flag)
void commandDistanceRequest (testclient::PositionRoadMap pos1, testclient::PositionRoadMap pos2, int flag)
void commandDistanceRequest (testclient::PositionRoadMap pos1, testclient::Position pos2, int flag)
void commandDistanceRequest (testclient::PositionRoadMap pos1, testclient::Position3D pos2, int flag)
void commandDistanceRequest (testclient::Position pos1, testclient::PositionRoadMap pos2, int flag)
void commandDistanceRequest (testclient::Position3D pos1, testclient::PositionRoadMap pos2, int flag)
void commandGetVariable (int domID, int varID, const std::string &objID)
void commandGetVariablePlus (int domID, int varID, const std::string &objID, std::ifstream &defFile)
void commandPositionConversion (testclient::Position pos, int posId)
void commandPositionConversion (testclient::Position3D pos, int posId)
void commandPositionConversion (testclient::PositionRoadMap pos, int posId)
void commandSetValue (int domID, int varID, const std::string &objID, std::ifstream &defFile)
void commandSimulationStep2 (SUMOTime time)
void commandSubscribeVariable (int domID, const std::string &objID, int beginTime, int endTime, int varNo, std::ifstream &defFile)
bool connect (int port, std::string host="localhost")
bool run (std::string fileName, int port, std::string host="localhost")
 TraCITestClient (std::string outputFileName="testclient_result.out")
 ~TraCITestClient ()

Private Member Functions

void commandDistanceRequest (testclient::Position *pos1_2D, testclient::Position3D *pos1_3D, testclient::PositionRoadMap *pos1_Road, testclient::Position *pos2_2D, testclient::Position3D *pos2_3D, testclient::PositionRoadMap *pos2_Road, int flag)
void commandPositionConversion (testclient::Position *pos2D, testclient::Position3D *pos3D, testclient::PositionRoadMap *posRoad, int posId)
void errorMsg (std::stringstream &msg)
bool readAndReportTypeDependent (tcpip::Storage &inMsg, int valueDataType)
bool reportResultState (tcpip::Storage &inMsg, int command, bool ignoreCommandId=false)
int setValueTypeDependant (tcpip::Storage &into, std::ifstream &defFile, std::stringstream &msg)
 Parses the next value type / value pair from the stream and inserts it into the storage.
bool validateDistanceRequest (tcpip::Storage &inMsg)
bool validatePositionConversion (tcpip::Storage &inMsg)
bool validateSimulationStep2 (tcpip::Storage &inMsg)
bool validateSubscription (tcpip::Storage &inMsg)
void writeResult ()

Private Attributes

std::stringstream answerLog
std::string outputFileName
tcpip::Socketsocket

Detailed Description

Definition at line 78 of file TraCITestClient.h.

Constructor & Destructor Documentation

TraCITestClient::TraCITestClient ( std::string  outputFileName = "testclient_result.out")

Definition at line 64 of file TraCITestClient.cpp.

References answerLog.

TraCITestClient::~TraCITestClient ( )

Definition at line 74 of file TraCITestClient.cpp.

References socket, and writeResult().

Member Function Documentation

bool TraCITestClient::close ( )

Definition at line 124 of file TraCITestClient.cpp.

References tcpip::Socket::close(), and socket.

Referenced by run().

void TraCITestClient::commandDistanceRequest ( testclient::Position  pos1,
testclient::Position  pos2,
int  flag 
)

Definition at line 494 of file TraCITestClient.cpp.

Referenced by commandDistanceRequest(), and run().

void TraCITestClient::commandDistanceRequest ( testclient::Position3D  pos1,
testclient::Position3D  pos2,
int  flag 
)

Definition at line 506 of file TraCITestClient.cpp.

References commandDistanceRequest().

void TraCITestClient::commandDistanceRequest ( testclient::Position  pos1,
testclient::Position3D  pos2,
int  flag 
)

Definition at line 500 of file TraCITestClient.cpp.

References commandDistanceRequest().

void TraCITestClient::commandDistanceRequest ( testclient::Position3D  pos1,
testclient::Position  pos2,
int  flag 
)

Definition at line 512 of file TraCITestClient.cpp.

References commandDistanceRequest().

void TraCITestClient::commandDistanceRequest ( testclient::PositionRoadMap  pos1,
testclient::PositionRoadMap  pos2,
int  flag 
)

Definition at line 530 of file TraCITestClient.cpp.

References commandDistanceRequest().

void TraCITestClient::commandDistanceRequest ( testclient::PositionRoadMap  pos1,
testclient::Position  pos2,
int  flag 
)

Definition at line 518 of file TraCITestClient.cpp.

References commandDistanceRequest().

void TraCITestClient::commandDistanceRequest ( testclient::PositionRoadMap  pos1,
testclient::Position3D  pos2,
int  flag 
)

Definition at line 524 of file TraCITestClient.cpp.

References commandDistanceRequest().

void TraCITestClient::commandDistanceRequest ( testclient::Position  pos1,
testclient::PositionRoadMap  pos2,
int  flag 
)

Definition at line 536 of file TraCITestClient.cpp.

References commandDistanceRequest().

void TraCITestClient::commandDistanceRequest ( testclient::Position3D  pos1,
testclient::PositionRoadMap  pos2,
int  flag 
)

Definition at line 542 of file TraCITestClient.cpp.

References commandDistanceRequest().

void TraCITestClient::commandPositionConversion ( testclient::Position  pos,
int  posId 
)

Definition at line 395 of file TraCITestClient.cpp.

Referenced by commandPositionConversion(), and run().

void TraCITestClient::commandPositionConversion ( testclient::Position3D  pos,
int  posId 
)

Definition at line 401 of file TraCITestClient.cpp.

References commandPositionConversion().

void TraCITestClient::commandPositionConversion ( testclient::PositionRoadMap  pos,
int  posId 
)

Definition at line 407 of file TraCITestClient.cpp.

References commandPositionConversion().

void TraCITestClient::commandSetValue ( int  domID,
int  varID,
const std::string &  objID,
std::ifstream &  defFile 
)
void TraCITestClient::commandSubscribeVariable ( int  domID,
const std::string &  objID,
int  beginTime,
int  endTime,
int  varNo,
std::ifstream &  defFile 
)
bool TraCITestClient::connect ( int  port,
std::string  host = "localhost" 
)

Definition at line 105 of file TraCITestClient.cpp.

References tcpip::Socket::connect(), errorMsg(), socket, and tcpip::SocketException::what().

Referenced by run().

void TraCITestClient::errorMsg ( std::stringstream &  msg)
private
int TraCITestClient::setValueTypeDependant ( tcpip::Storage into,
std::ifstream &  defFile,
std::stringstream &  msg 
)
private

Parses the next value type / value pair from the stream and inserts it into the storage.

Parameters
[out]intoThe storage to add the value type and the value into
[in]defFileThe file to read the values from
[out]msgIf any error occurs, this should be filled
Returns
The number of written bytes

Definition at line 866 of file TraCITestClient.cpp.

References POSITION_2D, POSITION_3D, POSITION_ROADMAP, REQUEST_AIRDIST, REQUEST_DRIVINGDIST, TYPE_BYTE, TYPE_COLOR, TYPE_COMPOUND, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INTEGER, TYPE_POLYGON, TYPE_STRING, TYPE_STRINGLIST, TYPE_UBYTE, tcpip::Storage::writeByte(), tcpip::Storage::writeDouble(), tcpip::Storage::writeFloat(), tcpip::Storage::writeInt(), tcpip::Storage::writeString(), tcpip::Storage::writeStringList(), and tcpip::Storage::writeUnsignedByte().

Referenced by commandGetVariablePlus(), and commandSetValue().

bool TraCITestClient::validateDistanceRequest ( tcpip::Storage inMsg)
private
bool TraCITestClient::validateSimulationStep2 ( tcpip::Storage inMsg)
private
void TraCITestClient::writeResult ( )
private

Definition at line 81 of file TraCITestClient.cpp.

References answerLog, and outputFileName.

Referenced by ~TraCITestClient().

Field Documentation

std::string testclient::TraCITestClient::outputFileName
private

Definition at line 160 of file TraCITestClient.h.

Referenced by writeResult().


The documentation for this class was generated from the following files: