SUMO - Simulation of Urban MObility
|
#include <TraCITestClient.h>
Definition at line 78 of file TraCITestClient.h.
TraCITestClient::TraCITestClient | ( | std::string | outputFileName = "testclient_result.out" | ) |
Definition at line 64 of file TraCITestClient.cpp.
References answerLog.
Definition at line 74 of file TraCITestClient.cpp.
References socket, and writeResult().
Definition at line 124 of file TraCITestClient.cpp.
References tcpip::Socket::close(), and socket.
Referenced by run().
void TraCITestClient::commandClose | ( | ) |
Definition at line 1025 of file TraCITestClient.cpp.
References answerLog, CMD_CLOSE, errorMsg(), tcpip::Socket::receiveExact(), reportResultState(), tcpip::Socket::sendExact(), socket, tcpip::SocketException::what(), and tcpip::Storage::writeUnsignedByte().
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::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 | ||
) | [private] |
Definition at line 549 of file TraCITestClient.cpp.
References answerLog, CMD_DISTANCEREQUEST, errorMsg(), testclient::PositionRoadMap::laneId, testclient::PositionRoadMap::pos, POSITION_2D, POSITION_3D, POSITION_ROADMAP, tcpip::Socket::receiveExact(), reportResultState(), testclient::PositionRoadMap::roadId, tcpip::Socket::sendExact(), tcpip::Storage::size(), socket, validateDistanceRequest(), tcpip::SocketException::what(), tcpip::Storage::writeDouble(), tcpip::Storage::writeStorage(), tcpip::Storage::writeString(), tcpip::Storage::writeUnsignedByte(), testclient::Position::x, testclient::Position3D::x, testclient::Position::y, testclient::Position3D::y, and testclient::Position3D::z.
void TraCITestClient::commandGetVariable | ( | int | domID, |
int | varID, | ||
const std::string & | objID | ||
) |
Definition at line 659 of file TraCITestClient.cpp.
References answerLog, errorMsg(), tcpip::Storage::position(), readAndReportTypeDependent(), tcpip::Storage::readInt(), tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), tcpip::Socket::receiveExact(), reportResultState(), tcpip::Socket::sendExact(), socket, tcpip::SocketException::what(), tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
Referenced by run().
void TraCITestClient::commandGetVariablePlus | ( | int | domID, |
int | varID, | ||
const std::string & | objID, | ||
std::ifstream & | defFile | ||
) |
Definition at line 727 of file TraCITestClient.cpp.
References answerLog, errorMsg(), tcpip::Storage::position(), readAndReportTypeDependent(), tcpip::Storage::readInt(), tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), tcpip::Socket::receiveExact(), reportResultState(), tcpip::Socket::sendExact(), setValueTypeDependant(), socket, tcpip::SocketException::what(), tcpip::Storage::writeStorage(), tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
Referenced by run().
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::commandPositionConversion | ( | testclient::Position * | pos2D, |
testclient::Position3D * | pos3D, | ||
testclient::PositionRoadMap * | posRoad, | ||
int | posId | ||
) | [private] |
Definition at line 413 of file TraCITestClient.cpp.
References answerLog, CMD_POSITIONCONVERSION, errorMsg(), testclient::PositionRoadMap::laneId, testclient::PositionRoadMap::pos, POSITION_2D, POSITION_3D, POSITION_ROADMAP, tcpip::Socket::receiveExact(), reportResultState(), testclient::PositionRoadMap::roadId, tcpip::Socket::sendExact(), tcpip::Storage::size(), socket, validatePositionConversion(), tcpip::SocketException::what(), tcpip::Storage::writeDouble(), tcpip::Storage::writeStorage(), tcpip::Storage::writeString(), tcpip::Storage::writeUnsignedByte(), testclient::Position::x, testclient::Position3D::x, testclient::Position::y, testclient::Position3D::y, and testclient::Position3D::z.
void TraCITestClient::commandSetValue | ( | int | domID, |
int | varID, | ||
const std::string & | objID, | ||
std::ifstream & | defFile | ||
) |
Definition at line 973 of file TraCITestClient.cpp.
References answerLog, errorMsg(), tcpip::Socket::receiveExact(), reportResultState(), tcpip::Socket::sendExact(), setValueTypeDependant(), socket, tcpip::SocketException::what(), tcpip::Storage::writeStorage(), tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
Referenced by run().
void TraCITestClient::commandSimulationStep2 | ( | SUMOTime | time | ) |
Definition at line 352 of file TraCITestClient.cpp.
References answerLog, CMD_SIMSTEP2, errorMsg(), tcpip::Socket::receiveExact(), reportResultState(), tcpip::Socket::sendExact(), socket, validateSimulationStep2(), tcpip::SocketException::what(), tcpip::Storage::writeInt(), and tcpip::Storage::writeUnsignedByte().
Referenced by run().
void TraCITestClient::commandSubscribeVariable | ( | int | domID, |
const std::string & | objID, | ||
int | beginTime, | ||
int | endTime, | ||
int | varNo, | ||
std::ifstream & | defFile | ||
) |
Definition at line 801 of file TraCITestClient.cpp.
References answerLog, errorMsg(), tcpip::Socket::receiveExact(), reportResultState(), tcpip::Socket::sendExact(), socket, validateSubscription(), tcpip::SocketException::what(), tcpip::Storage::writeInt(), tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
Referenced by run().
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] |
Definition at line 98 of file TraCITestClient.cpp.
References answerLog.
Referenced by commandClose(), commandDistanceRequest(), commandGetVariable(), commandGetVariablePlus(), commandPositionConversion(), commandSetValue(), commandSimulationStep2(), commandSubscribeVariable(), connect(), and run().
bool TraCITestClient::readAndReportTypeDependent | ( | tcpip::Storage & | inMsg, |
int | valueDataType | ||
) | [private] |
Definition at line 1260 of file TraCITestClient.cpp.
References answerLog, testclient::BoundingBox::lowerLeft, POSITION_2D, POSITION_3D, POSITION_ROADMAP, tcpip::Storage::readByte(), tcpip::Storage::readDouble(), tcpip::Storage::readFloat(), tcpip::Storage::readInt(), tcpip::Storage::readString(), tcpip::Storage::readStringList(), tcpip::Storage::readUnsignedByte(), SUMOReal, TLPHASE_GREEN, TLPHASE_RED, TLPHASE_YELLOW, TYPE_BOUNDINGBOX, TYPE_BYTE, TYPE_COLOR, TYPE_COMPOUND, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INTEGER, TYPE_POLYGON, TYPE_STRING, TYPE_STRINGLIST, TYPE_TLPHASELIST, TYPE_UBYTE, testclient::BoundingBox::upperRight, testclient::Position::x, and testclient::Position::y.
Referenced by commandGetVariable(), commandGetVariablePlus(), and validateSubscription().
bool TraCITestClient::reportResultState | ( | tcpip::Storage & | inMsg, |
int | command, | ||
bool | ignoreCommandId = false |
||
) | [private] |
Definition at line 305 of file TraCITestClient.cpp.
References answerLog, tcpip::Storage::position(), tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), RTYPE_ERR, RTYPE_NOTIMPLEMENTED, and RTYPE_OK.
Referenced by commandClose(), commandDistanceRequest(), commandGetVariable(), commandGetVariablePlus(), commandPositionConversion(), commandSetValue(), commandSimulationStep2(), and commandSubscribeVariable().
bool TraCITestClient::run | ( | std::string | fileName, |
int | port, | ||
std::string | host = "localhost" |
||
) |
Definition at line 133 of file TraCITestClient.cpp.
References close(), commandClose(), commandDistanceRequest(), commandGetVariable(), commandGetVariablePlus(), commandPositionConversion(), commandSetValue(), commandSimulationStep2(), commandSubscribeVariable(), connect(), errorMsg(), flag, testclient::PositionRoadMap::laneId, testclient::PositionRoadMap::pos, testclient::PositionRoadMap::roadId, string2time(), testclient::Position::x, testclient::Position3D::x, testclient::Position::y, testclient::Position3D::y, and testclient::Position3D::z.
Referenced by main().
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.
[out] | into | The storage to add the value type and the value into |
[in] | defFile | The file to read the values from |
[out] | msg | If any error occurs, this should be filled |
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] |
Definition at line 1192 of file TraCITestClient.cpp.
References answerLog, CMD_DISTANCEREQUEST, flag, tcpip::Storage::position(), tcpip::Storage::readDouble(), tcpip::Storage::readUnsignedByte(), and SUMOReal.
Referenced by commandDistanceRequest().
bool TraCITestClient::validatePositionConversion | ( | tcpip::Storage & | inMsg | ) | [private] |
Definition at line 1124 of file TraCITestClient.cpp.
References answerLog, CMD_POSITIONCONVERSION, testclient::PositionRoadMap::laneId, testclient::PositionRoadMap::pos, tcpip::Storage::position(), POSITION_2D, POSITION_3D, POSITION_ROADMAP, tcpip::Storage::readDouble(), tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), testclient::PositionRoadMap::roadId, testclient::Position::x, testclient::Position3D::x, testclient::Position::y, testclient::Position3D::y, and testclient::Position3D::z.
Referenced by commandPositionConversion().
bool TraCITestClient::validateSimulationStep2 | ( | tcpip::Storage & | inMsg | ) | [private] |
Definition at line 1069 of file TraCITestClient.cpp.
References answerLog, tcpip::Storage::readInt(), and validateSubscription().
Referenced by commandSimulationStep2().
bool TraCITestClient::validateSubscription | ( | tcpip::Storage & | inMsg | ) | [private] |
Definition at line 1091 of file TraCITestClient.cpp.
References answerLog, tcpip::Storage::position(), readAndReportTypeDependent(), tcpip::Storage::readInt(), tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), and RTYPE_OK.
Referenced by commandSubscribeVariable(), and validateSimulationStep2().
void TraCITestClient::writeResult | ( | ) | [private] |
Definition at line 81 of file TraCITestClient.cpp.
References answerLog, and outputFileName.
Referenced by ~TraCITestClient().
std::stringstream testclient::TraCITestClient::answerLog [private] |
Definition at line 162 of file TraCITestClient.h.
Referenced by commandClose(), commandDistanceRequest(), commandGetVariable(), commandGetVariablePlus(), commandPositionConversion(), commandSetValue(), commandSimulationStep2(), commandSubscribeVariable(), errorMsg(), readAndReportTypeDependent(), reportResultState(), TraCITestClient(), validateDistanceRequest(), validatePositionConversion(), validateSimulationStep2(), validateSubscription(), and writeResult().
std::string testclient::TraCITestClient::outputFileName [private] |
Definition at line 160 of file TraCITestClient.h.
Referenced by writeResult().
tcpip::Socket* testclient::TraCITestClient::socket [private] |
Definition at line 158 of file TraCITestClient.h.
Referenced by close(), commandClose(), commandDistanceRequest(), commandGetVariable(), commandGetVariablePlus(), commandPositionConversion(), commandSetValue(), commandSimulationStep2(), commandSubscribeVariable(), connect(), and ~TraCITestClient().