Eclipse SUMO - Simulation of Urban MObility
TraCITestClient Class Reference

A test execution class. More...

#include <TraCITestClient.h>

Inheritance diagram for TraCITestClient:
Collaboration diagram for TraCITestClient:

Public Member Functions

const tcpip::StoragegetCommandStorage () const
 
void load (const std::vector< std::string > &args)
 Let sumo load a simulation using the given command line like options. More...
 
int run (std::string fileName, int port, std::string host="localhost")
 Runs a test. More...
 
void simulationStep (double time=0)
 Advances by one step (or up to the given time) More...
 
 TraCITestClient (std::string outputFileName="testclient_result.out")
 Constructor. More...
 
 ~TraCITestClient ()
 Destructor. More...
 
Connection handling
void connect (const std::string &host, int port)
 Connects to the specified SUMO server. More...
 
void setOrder (int order)
 set priority (execution order) for the client More...
 
void close ()
 ends the simulation and closes the connection More...
 
Atomar getter
int getUnsignedByte (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 
int getByte (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 
int getInt (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 
double getDouble (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 
libsumo::TraCIPositionVector getPolygon (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 
libsumo::TraCIPosition getPosition (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 
libsumo::TraCIPosition getPosition3D (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 
std::string getString (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 
std::vector< std::string > getStringVector (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 
libsumo::TraCIColor getColor (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 
libsumo::TraCIStage getTraCIStage (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 

Data Fields

EdgeScope edge
 Scope for interaction with edges. More...
 
GUIScope gui
 Scope for interaction with the gui. More...
 
InductionLoopScope inductionloop
 Scope for interaction with inductive loops. More...
 
JunctionScope junction
 Scope for interaction with junctions. More...
 
LaneScope lane
 Scope for interaction with lanes. More...
 
LaneAreaScope lanearea
 Scope for interaction with lanes. More...
 
MeMeScope multientryexit
 Scope for interaction with multi-entry/-exit detectors. More...
 
PersonScope person
 Scope for interaction with persons. More...
 
POIScope poi
 Scope for interaction with POIs. More...
 
PolygonScope polygon
 Scope for interaction with polygons. More...
 
RouteScope route
 Scope for interaction with routes. More...
 
SimulationScope simulation
 Scope for interaction with the simulation. More...
 
TrafficLightScope trafficlights
 Scope for interaction with traffic lights. More...
 
VehicleScope vehicle
 Scope for interaction with vehicles. More...
 
VehicleTypeScope vehicletype
 Scope for interaction with vehicle types. More...
 

Protected Member Functions

void closeSocket ()
 Closes the connection. More...
 
void readContextSubscription (int cmdId, tcpip::Storage &inMsg)
 
void readVariables (tcpip::Storage &inMsg, const std::string &objectID, int variableCount, libsumo::SubscriptionResults &into)
 
void readVariableSubscription (int cmdId, tcpip::Storage &inMsg)
 
Commands handling
void commandSimulationStep (double time)
 Sends and validates a simulation step command. More...
 
void commandClose ()
 Sends and validates a Close command. More...
 
void commandSetOrder (int order)
 Sends and validates a SetOrder command. More...
 
void commandGetVariable (int domID, int varID, const std::string &objID, tcpip::Storage *addData=0)
 Sends and validates a GetVariable command. More...
 
void commandSetValue (int domID, int varID, const std::string &objID, std::ifstream &defFile)
 Sends and validates a SetVariable command. More...
 
void commandSubscribeObjectVariable (int domID, const std::string &objID, double beginTime, double endTime, int varNo, std::ifstream &defFile)
 Sends and validates a SubscribeVariable command. More...
 
void commandSubscribeContextVariable (int domID, const std::string &objID, double beginTime, double endTime, int domain, double range, int varNo, std::ifstream &defFile)
 Sends and validates a SubscribeContext command. More...
 
Command sending methods
void send_commandSimulationStep (double time) const
 Sends a SimulationStep command. More...
 
void send_commandClose () const
 Sends a Close command. More...
 
void send_commandSetOrder (int order) const
 Sends a SetOrder command. More...
 
void createCommand (int cmdID, int varID, const std::string &objID, tcpip::Storage *add=nullptr) const
 Sends a GetVariable / SetVariable request if mySocket is connected. Otherwise writes to myOutput only. More...
 
void createFilterCommand (int cmdID, int varID, tcpip::Storage *add=nullptr) const
 
void send_commandSubscribeObjectVariable (int domID, const std::string &objID, double beginTime, double endTime, const std::vector< int > &vars) const
 Sends a SubscribeVariable request. More...
 
void send_commandSubscribeObjectContext (int domID, const std::string &objID, double beginTime, double endTime, int domain, double range, const std::vector< int > &vars) const
 Sends a SubscribeContext request. More...
 
void check_resultState (tcpip::Storage &inMsg, int command, bool ignoreCommandId=false, std::string *acknowledgement=0) const
 Validates the result state of a command. More...
 
int check_commandGetResult (tcpip::Storage &inMsg, int command, int expectedType=-1, bool ignoreCommandId=false) const
 Validates the result state of a command. More...
 
bool processGet (int command, int expectedType, bool ignoreCommandId=false)
 
bool processSet (int command)
 

Static Protected Member Functions

template<class T >
static std::string toString (const T &t, std::streamsize accuracy=PRECISION)
 

Protected Attributes

std::map< int, TraCIScopeWrapper * > myDomains
 
tcpip::Storage myInput
 The reusable input storage. More...
 
tcpip::Storage myOutput
 The reusable output storage. More...
 
tcpip::SocketmySocket
 The socket. More...
 

Private Member Functions

void testAPI ()
 call all API methods once More...
 
Report helper
void writeResult ()
 Writes the results file. More...
 
void errorMsg (std::stringstream &msg)
 Writes an error message. More...
 
Results validation methods
bool validateSimulationStep2 (tcpip::Storage &inMsg)
 Validates whether the given message is a valid answer to CMD_SIMSTEP. More...
 
bool validateSubscription (tcpip::Storage &inMsg)
 Validates whether the given message is a valid subscription return message. More...
 
Conversion helper
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. More...
 
void readAndReportTypeDependent (tcpip::Storage &inMsg, int valueDataType)
 Reads a value of the given type from the given storage and reports it. More...
 

Private Attributes

std::stringstream answerLog
 Stream containing the log. More...
 
std::string outputFileName
 The name of the file to write the results log into. More...
 

Detailed Description

A test execution class.

Reads a program file and executes the actions stored within it

Definition at line 45 of file TraCITestClient.h.

Constructor & Destructor Documentation

◆ TraCITestClient()

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

Constructor.

Parameters
[in]outputFileNameThe name of the file the outputs will be written into

Definition at line 49 of file TraCITestClient.cpp.

References answerLog.

◆ ~TraCITestClient()

TraCITestClient::~TraCITestClient ( )

Destructor.

Definition at line 57 of file TraCITestClient.cpp.

References writeResult().

Member Function Documentation

◆ check_commandGetResult()

int TraCIAPI::check_commandGetResult ( tcpip::Storage inMsg,
int  command,
int  expectedType = -1,
bool  ignoreCommandId = false 
) const
protectedinherited

◆ check_resultState()

void TraCIAPI::check_resultState ( tcpip::Storage inMsg,
int  command,
bool  ignoreCommandId = false,
std::string *  acknowledgement = 0 
) const
protectedinherited

Validates the result state of a command.

Parameters
[in]inMsgThe buffer to read the message from
[in]commandThe original command id
[in]ignoreCommandIdWhether the returning command id shall be validated
[in]acknowledgementPointer to an existing string into which the acknowledgement message shall be inserted

Definition at line 267 of file TraCIAPI.cpp.

References TraCIAPI::mySocket, tcpip::Storage::position(), tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), tcpip::Socket::receiveExact(), libsumo::RTYPE_ERR, libsumo::RTYPE_NOTIMPLEMENTED, libsumo::RTYPE_OK, and TraCIAPI::toString().

Referenced by TraCIAPI::close(), commandClose(), commandGetVariable(), commandSetOrder(), commandSetValue(), commandSimulationStep(), commandSubscribeContextVariable(), commandSubscribeObjectVariable(), TraCIAPI::load(), TraCIAPI::processGet(), TraCIAPI::processSet(), TraCIAPI::setOrder(), and TraCIAPI::simulationStep().

◆ close()

void TraCIAPI::close ( )
inherited

ends the simulation and closes the connection

Definition at line 103 of file TraCIAPI.cpp.

References TraCIAPI::check_resultState(), TraCIAPI::closeSocket(), libsumo::CMD_CLOSE, and TraCIAPI::send_commandClose().

◆ closeSocket()

void TraCIAPI::closeSocket ( )
protectedinherited

Closes the connection.

Definition at line 113 of file TraCIAPI.cpp.

References tcpip::Socket::close(), and TraCIAPI::mySocket.

Referenced by TraCIAPI::close(), run(), and TraCIAPI::toString().

◆ commandClose()

void TraCITestClient::commandClose ( )
protected

Sends and validates a Close command.

Definition at line 194 of file TraCITestClient.cpp.

References answerLog, TraCIAPI::check_resultState(), libsumo::CMD_CLOSE, and TraCIAPI::send_commandClose().

Referenced by run().

◆ commandGetVariable()

void TraCITestClient::commandGetVariable ( int  domID,
int  varID,
const std::string &  objID,
tcpip::Storage addData = 0 
)
protected

Sends and validates a GetVariable command.

Parameters
[in]domIDThe ID of the domain the addressed object belongs to
[in]varIDThe ID of the variable one asks for
[in]objIDThe ID of the object a variable shall be retrieved from
[in]addDataStorage to read additional data from, if needed

Definition at line 224 of file TraCITestClient.cpp.

References answerLog, TraCIAPI::check_commandGetResult(), TraCIAPI::check_resultState(), TraCIAPI::createCommand(), errorMsg(), TraCIAPI::myOutput, TraCIAPI::mySocket, readAndReportTypeDependent(), tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), and tcpip::Socket::sendExact().

Referenced by run().

◆ commandSetOrder()

void TraCITestClient::commandSetOrder ( int  order)
protected

Sends and validates a SetOrder command.

Definition at line 209 of file TraCITestClient.cpp.

References answerLog, TraCIAPI::check_resultState(), libsumo::CMD_SETORDER, and TraCIAPI::send_commandSetOrder().

Referenced by run().

◆ commandSetValue()

void TraCITestClient::commandSetValue ( int  domID,
int  varID,
const std::string &  objID,
std::ifstream &  defFile 
)
protected

Sends and validates a SetVariable command.

Parameters
[in]domIDThe ID of the domain the addressed object belongs to
[in]varIDThe ID of the variable to set
[in]objIDThe ID of the object which shall be changed
[in]defFileStorage to read additional data from

Definition at line 258 of file TraCITestClient.cpp.

References answerLog, TraCIAPI::check_resultState(), TraCIAPI::createCommand(), errorMsg(), TraCIAPI::myOutput, TraCIAPI::mySocket, tcpip::Socket::sendExact(), and setValueTypeDependant().

Referenced by run().

◆ commandSimulationStep()

void TraCITestClient::commandSimulationStep ( double  time)
protected

Sends and validates a simulation step command.

Parameters
[in]timeThe time step to send

Definition at line 178 of file TraCITestClient.cpp.

References answerLog, TraCIAPI::check_resultState(), libsumo::CMD_SIMSTEP, TraCIAPI::send_commandSimulationStep(), and validateSimulationStep2().

Referenced by run().

◆ commandSubscribeContextVariable()

void TraCITestClient::commandSubscribeContextVariable ( int  domID,
const std::string &  objID,
double  beginTime,
double  endTime,
int  domain,
double  range,
int  varNo,
std::ifstream &  defFile 
)
protected

Sends and validates a SubscribeContext command.

Parameters
[in]domIDThe ID of the domain the addressed object belongs to
[in]objIDThe ID of the object a variable shall be subscribed from
[in]beginTimeThe time the subscription shall begin at
[in]endTimeThe time the subscription shall end at
[in]domainThe domain of the objects which shall be reported
[in]rangeThe range within which objects shall be for being reported
[in]varNoThe number of subscribed variables
[in]defFileThe stream to read variable values from

Definition at line 306 of file TraCITestClient.cpp.

References answerLog, TraCIAPI::check_resultState(), TraCIAPI::send_commandSubscribeObjectContext(), and validateSubscription().

Referenced by run().

◆ commandSubscribeObjectVariable()

void TraCITestClient::commandSubscribeObjectVariable ( int  domID,
const std::string &  objID,
double  beginTime,
double  endTime,
int  varNo,
std::ifstream &  defFile 
)
protected

Sends and validates a SubscribeVariable command.

Parameters
[in]domIDThe ID of the domain the addressed object belongs to
[in]objIDThe ID of the object a variable shall be subscribed from
[in]beginTimeThe time the subscription shall begin at
[in]endTimeThe time the subscription shall end at
[in]varNoThe number of subscribed variables
[in]defFileThe stream to read variable values from

Definition at line 282 of file TraCITestClient.cpp.

References answerLog, TraCIAPI::check_resultState(), TraCIAPI::send_commandSubscribeObjectVariable(), and validateSubscription().

Referenced by run().

◆ connect()

void TraCIAPI::connect ( const std::string &  host,
int  port 
)
inherited

Connects to the specified SUMO server.

Parameters
[in]hostThe name of the host to connect to
[in]portThe port to connect to
Exceptions
tcpip::SocketExceptionif the connection fails

Definition at line 75 of file TraCIAPI.cpp.

References tcpip::Socket::connect(), and TraCIAPI::mySocket.

Referenced by run().

◆ createCommand()

void TraCIAPI::createCommand ( int  cmdID,
int  varID,
const std::string &  objID,
tcpip::Storage add = nullptr 
) const
protectedinherited

Sends a GetVariable / SetVariable request if mySocket is connected. Otherwise writes to myOutput only.

Parameters
[in]cmdIDThe command and domain of the variable
[in]varIDThe variable to retrieve
[in]objIDThe object to retrieve the variable from
[in]addOptional additional parameter

Definition at line 161 of file TraCIAPI.cpp.

References TraCIAPI::myOutput, tcpip::Storage::reset(), tcpip::Storage::size(), tcpip::Storage::writeInt(), tcpip::Storage::writeStorage(), tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().

Referenced by commandGetVariable(), commandSetValue(), TraCIAPI::getByte(), TraCIAPI::getColor(), TraCIAPI::getDouble(), TraCIAPI::getInt(), TraCIAPI::getPolygon(), TraCIAPI::getPosition(), TraCIAPI::getPosition3D(), TraCIAPI::getString(), TraCIAPI::getStringVector(), TraCIAPI::getTraCIStage(), and TraCIAPI::getUnsignedByte().

◆ createFilterCommand()

void TraCIAPI::createFilterCommand ( int  cmdID,
int  varID,
tcpip::Storage add = nullptr 
) const
protectedinherited

◆ errorMsg()

void TraCITestClient::errorMsg ( std::stringstream &  msg)
private

Writes an error message.

Parameters
[in]msgThe message to write

Definition at line 349 of file TraCITestClient.cpp.

References answerLog.

Referenced by commandGetVariable(), commandSetValue(), and run().

◆ getByte()

int TraCIAPI::getByte ( int  cmd,
int  var,
const std::string &  id,
tcpip::Storage add = 0 
)
inherited

◆ getColor()

◆ getCommandStorage()

const tcpip::Storage& TraCIAPI::getCommandStorage ( ) const
inlineinherited

Definition at line 97 of file TraCIAPI.h.

References TraCIAPI::myOutput.

◆ getDouble()

double TraCIAPI::getDouble ( int  cmd,
int  var,
const std::string &  id,
tcpip::Storage add = 0 
)
inherited

◆ getInt()

int TraCIAPI::getInt ( int  cmd,
int  var,
const std::string &  id,
tcpip::Storage add = 0 
)
inherited

◆ getPolygon()

◆ getPosition()

◆ getPosition3D()

◆ getString()

std::string TraCIAPI::getString ( int  cmd,
int  var,
const std::string &  id,
tcpip::Storage add = 0 
)
inherited

◆ getStringVector()

std::vector< std::string > TraCIAPI::getStringVector ( int  cmd,
int  var,
const std::string &  id,
tcpip::Storage add = 0 
)
inherited

◆ getTraCIStage()

◆ getUnsignedByte()

int TraCIAPI::getUnsignedByte ( int  cmd,
int  var,
const std::string &  id,
tcpip::Storage add = 0 
)
inherited

◆ load()

void TraCIAPI::load ( const std::vector< std::string > &  args)
inherited

◆ processGet()

◆ processSet()

bool TraCIAPI::processSet ( int  command)
protectedinherited

◆ readAndReportTypeDependent()

void TraCITestClient::readAndReportTypeDependent ( tcpip::Storage inMsg,
int  valueDataType 
)
private

◆ readContextSubscription()

void TraCIAPI::readContextSubscription ( int  cmdId,
tcpip::Storage inMsg 
)
protectedinherited

◆ readVariables()

◆ readVariableSubscription()

void TraCIAPI::readVariableSubscription ( int  cmdId,
tcpip::Storage inMsg 
)
protectedinherited

◆ run()

int TraCITestClient::run ( std::string  fileName,
int  port,
std::string  host = "localhost" 
)

Runs a test.

Parameters
[in]fileNameThe name of the file containing the test script
[in]portThe server port to connect to
[in]hostThe server name to connect to

Definition at line 63 of file TraCITestClient.cpp.

References TraCIAPI::closeSocket(), commandClose(), commandGetVariable(), commandSetOrder(), commandSetValue(), commandSimulationStep(), commandSubscribeContextVariable(), commandSubscribeObjectVariable(), TraCIAPI::connect(), errorMsg(), setValueTypeDependant(), and testAPI().

Referenced by main().

◆ send_commandClose()

void TraCIAPI::send_commandClose ( ) const
protectedinherited

Sends a Close command.

Definition at line 137 of file TraCIAPI.cpp.

References libsumo::CMD_CLOSE, TraCIAPI::mySocket, tcpip::Socket::sendExact(), and tcpip::Storage::writeUnsignedByte().

Referenced by TraCIAPI::close(), and commandClose().

◆ send_commandSetOrder()

void TraCIAPI::send_commandSetOrder ( int  order) const
protectedinherited

◆ send_commandSimulationStep()

void TraCIAPI::send_commandSimulationStep ( double  time) const
protectedinherited

◆ send_commandSubscribeObjectContext()

void TraCIAPI::send_commandSubscribeObjectContext ( int  domID,
const std::string &  objID,
double  beginTime,
double  endTime,
int  domain,
double  range,
const std::vector< int > &  vars 
) const
protectedinherited

Sends a SubscribeContext request.

Parameters
[in]domIDThe domain of the variable
[in]objIDThe object to subscribe the variables from
[in]beginTimeThe begin time step of subscriptions
[in]endTimeThe end time step of subscriptions
[in]domainThe domain of the objects which values shall be returned
[in]rangeThe range around the obj to investigate
[in]varsThe variables to subscribe

Definition at line 236 of file TraCIAPI.cpp.

References TraCIAPI::mySocket, tcpip::Socket::sendExact(), tcpip::Storage::size(), tcpip::Storage::writeDouble(), tcpip::Storage::writeInt(), tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().

Referenced by commandSubscribeContextVariable().

◆ send_commandSubscribeObjectVariable()

void TraCIAPI::send_commandSubscribeObjectVariable ( int  domID,
const std::string &  objID,
double  beginTime,
double  endTime,
const std::vector< int > &  vars 
) const
protectedinherited

Sends a SubscribeVariable request.

Parameters
[in]domIDThe domain of the variable
[in]objIDThe object to subscribe the variables from
[in]beginTimeThe begin time step of subscriptions
[in]endTimeThe end time step of subscriptions
[in]varsThe variables to subscribe

Definition at line 208 of file TraCIAPI.cpp.

References TraCIAPI::mySocket, tcpip::Socket::sendExact(), tcpip::Storage::size(), tcpip::Storage::writeDouble(), tcpip::Storage::writeInt(), tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().

Referenced by commandSubscribeObjectVariable().

◆ setOrder()

void TraCIAPI::setOrder ( int  order)
inherited

set priority (execution order) for the client

Definition at line 88 of file TraCIAPI.cpp.

References TraCIAPI::check_resultState(), libsumo::CMD_SETORDER, TraCIAPI::mySocket, tcpip::Socket::sendExact(), tcpip::Storage::writeInt(), and tcpip::Storage::writeUnsignedByte().

Referenced by testAPI().

◆ setValueTypeDependant()

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 435 of file TraCITestClient.cpp.

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

Referenced by commandSetValue(), and run().

◆ simulationStep()

◆ testAPI()

void TraCITestClient::testAPI ( )
private

call all API methods once

Definition at line 644 of file TraCITestClient.cpp.

References libsumo::TraCIColor::a, TraCIAPI::EdgeScope::adaptTraveltime(), TraCIAPI::RouteScope::add(), TraCIAPI::VehicleScope::add(), TraCIAPI::PersonScope::add(), TraCIAPI::VehicleScope::addSubscriptionFilterLCManeuver(), answerLog, TraCIAPI::PersonScope::appendDrivingStage(), TraCIAPI::PersonScope::appendStage(), TraCIAPI::PersonScope::appendWaitingStage(), TraCIAPI::PersonScope::appendWalkingStage(), libsumo::TraCIConnection::approachedInternal, libsumo::TraCIConnection::approachedLane, libsumo::TraCIStage::arrivalPos, libsumo::TraCIColor::b, TraCIAPI::VehicleScope::changeTarget(), libsumo::CMD_GET_VEHICLE_VARIABLE, TraCIAPI::SimulationScope::convert2D(), TraCIAPI::SimulationScope::convert3D(), TraCIAPI::SimulationScope::convertGeo(), TraCIAPI::SimulationScope::convertRoad(), TraCIAPI::VehicleTypeScope::copy(), libsumo::TraCIStage::description, libsumo::TraCIConnection::direction, libsumo::TraCINextTLSData::dist, TraCIAPI::edge, libsumo::TraCIStage::edges, libsumo::TraCIVehicleData::entryTime, libsumo::TraCIColor::g, TraCIAPI::VehicleTypeScope::getAccel(), TraCIAPI::VehicleScope::getAcceleration(), TraCIAPI::VehicleScope::getAccumulatedWaitingTime(), TraCIAPI::EdgeScope::getAdaptedTraveltime(), TraCIAPI::PersonScope::getAngle(), TraCIAPI::VehicleTypeScope::getApparentDecel(), TraCIAPI::SimulationScope::getBusStopWaiting(), TraCIAPI::SimulationScope::getBusStopWaitingIDList(), TraCIAPI::POIScope::getColor(), TraCIAPI::PolygonScope::getColor(), TraCIAPI::VehicleScope::getColor(), TraCIAPI::PersonScope::getColor(), TraCIAPI::TrafficLightScope::getCompleteRedYellowGreenDefinition(), TraCIAPI::TraCIScopeWrapper::getContextSubscriptionResults(), TraCIAPI::TrafficLightScope::getControlledLanes(), TraCIAPI::TrafficLightScope::getControlledLinks(), TraCIAPI::SimulationScope::getCurrentTime(), TraCIAPI::SimulationScope::getDeltaT(), TraCIAPI::SimulationScope::getDistance2D(), TraCIAPI::SimulationScope::getDistanceRoad(), TraCIAPI::PersonScope::getEdges(), TraCIAPI::EdgeScope::getEffort(), TraCIAPI::VehicleTypeScope::getEmergencyDecel(), TraCIAPI::LaneScope::getFoes(), TraCIAPI::VehicleTypeScope::getHeight(), TraCIAPI::EdgeScope::getIDCount(), TraCIAPI::JunctionScope::getIDCount(), TraCIAPI::LaneScope::getIDCount(), TraCIAPI::POIScope::getIDCount(), TraCIAPI::PolygonScope::getIDCount(), TraCIAPI::TrafficLightScope::getIDCount(), TraCIAPI::VehicleScope::getIDCount(), TraCIAPI::EdgeScope::getIDList(), TraCIAPI::InductionLoopScope::getIDList(), TraCIAPI::JunctionScope::getIDList(), TraCIAPI::LaneScope::getIDList(), TraCIAPI::POIScope::getIDList(), TraCIAPI::PolygonScope::getIDList(), TraCIAPI::RouteScope::getIDList(), TraCIAPI::TrafficLightScope::getIDList(), TraCIAPI::VehicleTypeScope::getIDList(), TraCIAPI::VehicleScope::getIDList(), TraCIAPI::PersonScope::getIDList(), TraCIAPI::LaneScope::getInternalFoes(), TraCIAPI::VehicleScope::getLaneChangeState(), TraCIAPI::VehicleScope::getLaneID(), TraCIAPI::EdgeScope::getLaneNumber(), TraCIAPI::VehicleScope::getLanePosition(), TraCIAPI::PersonScope::getLanePosition(), TraCIAPI::VehicleTypeScope::getLateralAlignment(), TraCIAPI::VehicleScope::getLateralLanePosition(), TraCIAPI::VehicleScope::getLateralSpeed(), TraCIAPI::VehicleScope::getLeader(), TraCIAPI::PersonScope::getLength(), TraCIAPI::VehicleScope::getLine(), TraCIAPI::PolygonScope::getLineWidth(), TraCIAPI::LaneScope::getLinkNumber(), TraCIAPI::LaneScope::getLinks(), TraCIAPI::VehicleScope::getMaxSpeed(), TraCIAPI::VehicleTypeScope::getMaxSpeedLat(), TraCIAPI::VehicleTypeScope::getMinGapLat(), TraCIAPI::PersonScope::getNextEdge(), TraCIAPI::TrafficLightScope::getNextSwitch(), TraCIAPI::VehicleScope::getNextTLS(), TraCIAPI::TraCIScopeWrapper::getParameter(), TraCIAPI::VehicleTypeScope::getPersonCapacity(), TraCIAPI::VehicleScope::getPersonCapacity(), TraCIAPI::TrafficLightScope::getPhase(), TraCIAPI::TrafficLightScope::getPhaseDuration(), TraCIAPI::TrafficLightScope::getPhaseName(), TraCIAPI::POIScope::getPosition(), TraCIAPI::PersonScope::getPosition(), TraCIAPI::PersonScope::getPosition3D(), TraCIAPI::TrafficLightScope::getProgram(), TraCIAPI::TrafficLightScope::getRedYellowGreenState(), TraCIAPI::PersonScope::getRemainingStages(), TraCIAPI::VehicleScope::getRoadID(), TraCIAPI::PersonScope::getRoadID(), TraCIAPI::VehicleScope::getRoute(), TraCIAPI::VehicleScope::getRouteID(), TraCIAPI::VehicleScope::getRoutingMode(), TraCIAPI::GUIScope::getSchema(), TraCIAPI::JunctionScope::getShape(), TraCIAPI::PolygonScope::getShape(), TraCIAPI::VehicleScope::getShapeClass(), TraCIAPI::VehicleScope::getSignals(), TraCIAPI::VehicleScope::getSlope(), TraCIAPI::PersonScope::getSlope(), TraCIAPI::VehicleScope::getSpeed(), TraCIAPI::PersonScope::getSpeed(), TraCIAPI::VehicleScope::getSpeedMode(), TraCIAPI::PersonScope::getStage(), TraCIAPI::VehicleScope::getStopState(), TraCIAPI::EdgeScope::getStreetName(), libsumo::TraCIPosition::getString(), libsumo::TraCIRoadPosition::getString(), libsumo::TraCIColor::getString(), TraCIAPI::TraCIScopeWrapper::getSubscriptionResults(), TraCIAPI::EdgeScope::getTraveltime(), TraCIAPI::VehicleScope::getTypeID(), TraCIAPI::PersonScope::getTypeID(), TraCIAPI::PersonScope::getVehicle(), TraCIAPI::InductionLoopScope::getVehicleData(), TraCIAPI::VehicleScope::getVia(), TraCIAPI::VehicleScope::getWaitingTime(), TraCIAPI::PersonScope::getWaitingTime(), TraCIAPI::VehicleTypeScope::getWidth(), TraCIAPI::GUIScope::getZoom(), TraCIAPI::gui, libsumo::TraCIConnection::hasFoe, libsumo::TraCIConnection::hasPrio, libsumo::TraCIVehicleData::id, libsumo::TraCINextTLSData::id, TraCIAPI::inductionloop, libsumo::TraCIConnection::isOpen, TraCIAPI::VehicleScope::isRouteValid(), joinToString(), TraCIAPI::junction, TraCIAPI::lane, libsumo::TraCIVehicleData::leaveTime, libsumo::TraCIConnection::length, libsumo::TraCIVehicleData::length, TraCIAPI::load(), TraCIAPI::VehicleScope::moveTo(), TraCIAPI::VehicleScope::moveToXY(), TraCIAPI::person, libsumo::TraCILogic::phases, TraCIAPI::poi, TraCIAPI::polygon, libsumo::TraCIColor::r, TraCIAPI::VehicleScope::remove(), TraCIAPI::PersonScope::removeStage(), TraCIAPI::PersonScope::removeStages(), TraCIAPI::VehicleScope::rerouteTraveltime(), TraCIAPI::PersonScope::rerouteTraveltime(), TraCIAPI::route, libsumo::ROUTING_MODE_AGGREGATED, TraCIAPI::GUIScope::screenshot(), TraCIAPI::VehicleTypeScope::setAccel(), TraCIAPI::VehicleTypeScope::setApparentDecel(), TraCIAPI::VehicleScope::setColor(), TraCIAPI::PersonScope::setColor(), TraCIAPI::TrafficLightScope::setCompleteRedYellowGreenDefinition(), TraCIAPI::EdgeScope::setEffort(), TraCIAPI::VehicleTypeScope::setEmergencyDecel(), TraCIAPI::VehicleTypeScope::setHeight(), TraCIAPI::PersonScope::setHeight(), TraCIAPI::VehicleTypeScope::setLateralAlignment(), TraCIAPI::PersonScope::setLength(), TraCIAPI::VehicleScope::setLine(), TraCIAPI::PolygonScope::setLineWidth(), TraCIAPI::VehicleScope::setMaxSpeed(), TraCIAPI::VehicleTypeScope::setMaxSpeedLat(), TraCIAPI::PersonScope::setMinGap(), TraCIAPI::VehicleTypeScope::setMinGapLat(), TraCIAPI::setOrder(), TraCIAPI::TraCIScopeWrapper::setParameter(), TraCIAPI::TrafficLightScope::setPhase(), TraCIAPI::TrafficLightScope::setPhaseName(), TraCIAPI::TrafficLightScope::setRedYellowGreenState(), TraCIAPI::VehicleScope::setRoute(), TraCIAPI::VehicleScope::setRouteID(), TraCIAPI::VehicleScope::setRoutingMode(), TraCIAPI::GUIScope::setSchema(), TraCIAPI::PolygonScope::setShape(), TraCIAPI::VehicleScope::setShapeClass(), TraCIAPI::VehicleScope::setSignals(), TraCIAPI::PersonScope::setSpeed(), TraCIAPI::VehicleScope::setSpeedFactor(), TraCIAPI::VehicleScope::setType(), TraCIAPI::PersonScope::setType(), TraCIAPI::VehicleScope::setVia(), TraCIAPI::VehicleTypeScope::setWidth(), TraCIAPI::PersonScope::setWidth(), TraCIAPI::GUIScope::setZoom(), TraCIAPI::VehicleScope::SIGNAL_FOGLIGHT, TraCIAPI::simulation, TraCIAPI::simulationStep(), libsumo::STAGE_WALKING, libsumo::TraCIConnection::state, libsumo::TraCINextTLSData::state, TraCIAPI::TraCIScopeWrapper::subscribe(), TraCIAPI::TraCIScopeWrapper::subscribeContext(), TIME2STEPS, libsumo::TraCINextTLSData::tlIndex, TraCIAPI::trafficlights, libsumo::TraCIVehicleData::typeID, libsumo::VAR_LANEPOSITION, libsumo::VAR_ROAD_ID, libsumo::VAR_SPEED, TraCIAPI::vehicle, and TraCIAPI::vehicletype.

Referenced by run().

◆ toString()

template<class T >
static std::string TraCIAPI::toString ( const T &  t,
std::streamsize  accuracy = PRECISION 
)
inlinestaticprotectedinherited

◆ validateSimulationStep2()

bool TraCITestClient::validateSimulationStep2 ( tcpip::Storage inMsg)
private

Validates whether the given message is a valid answer to CMD_SIMSTEP.

Parameters
[in]inMsgThe storage contain the message to validate
Returns
Whether the message is valid

Definition at line 360 of file TraCITestClient.cpp.

References answerLog, tcpip::Storage::readInt(), and validateSubscription().

Referenced by commandSimulationStep().

◆ validateSubscription()

bool TraCITestClient::validateSubscription ( tcpip::Storage inMsg)
private

◆ writeResult()

void TraCITestClient::writeResult ( )
private

Writes the results file.

Definition at line 333 of file TraCITestClient.cpp.

References answerLog, and outputFileName.

Referenced by ~TraCITestClient().

Field Documentation

◆ answerLog

◆ edge

EdgeScope TraCIAPI::edge
inherited

Scope for interaction with edges.

Definition at line 930 of file TraCIAPI.h.

Referenced by testAPI(), and TraCIAPI::TraCIAPI().

◆ gui

GUIScope TraCIAPI::gui
inherited

Scope for interaction with the gui.

Definition at line 932 of file TraCIAPI.h.

Referenced by testAPI(), and TraCIAPI::TraCIAPI().

◆ inductionloop

InductionLoopScope TraCIAPI::inductionloop
inherited

Scope for interaction with inductive loops.

Definition at line 934 of file TraCIAPI.h.

Referenced by testAPI().

◆ junction

JunctionScope TraCIAPI::junction
inherited

Scope for interaction with junctions.

Definition at line 936 of file TraCIAPI.h.

Referenced by testAPI(), and TraCIAPI::TraCIAPI().

◆ lane

LaneScope TraCIAPI::lane
inherited

Scope for interaction with lanes.

Definition at line 938 of file TraCIAPI.h.

Referenced by testAPI(), and TraCIAPI::TraCIAPI().

◆ lanearea

LaneAreaScope TraCIAPI::lanearea
inherited

Scope for interaction with lanes.

Definition at line 940 of file TraCIAPI.h.

Referenced by TraCIAPI::TraCIAPI().

◆ multientryexit

MeMeScope TraCIAPI::multientryexit
inherited

Scope for interaction with multi-entry/-exit detectors.

Definition at line 942 of file TraCIAPI.h.

Referenced by TraCIAPI::TraCIAPI().

◆ myDomains

std::map<int, TraCIScopeWrapper*> TraCIAPI::myDomains
protectedinherited

◆ myInput

◆ myOutput

tcpip::Storage TraCIAPI::myOutput
mutableprotectedinherited

◆ mySocket

◆ outputFileName

std::string TraCITestClient::outputFileName
private

The name of the file to write the results log into.

Definition at line 191 of file TraCITestClient.h.

Referenced by writeResult().

◆ person

PersonScope TraCIAPI::person
inherited

Scope for interaction with persons.

Definition at line 944 of file TraCIAPI.h.

Referenced by testAPI(), and TraCIAPI::TraCIAPI().

◆ poi

POIScope TraCIAPI::poi
inherited

Scope for interaction with POIs.

Definition at line 946 of file TraCIAPI.h.

Referenced by testAPI(), and TraCIAPI::TraCIAPI().

◆ polygon

PolygonScope TraCIAPI::polygon
inherited

Scope for interaction with polygons.

Definition at line 948 of file TraCIAPI.h.

Referenced by testAPI(), and TraCIAPI::TraCIAPI().

◆ route

RouteScope TraCIAPI::route
inherited

Scope for interaction with routes.

Definition at line 950 of file TraCIAPI.h.

Referenced by testAPI(), and TraCIAPI::TraCIAPI().

◆ simulation

SimulationScope TraCIAPI::simulation
inherited

Scope for interaction with the simulation.

Definition at line 952 of file TraCIAPI.h.

Referenced by testAPI(), and TraCIAPI::TraCIAPI().

◆ trafficlights

TrafficLightScope TraCIAPI::trafficlights
inherited

Scope for interaction with traffic lights.

Definition at line 954 of file TraCIAPI.h.

Referenced by testAPI(), and TraCIAPI::TraCIAPI().

◆ vehicle

VehicleScope TraCIAPI::vehicle
inherited

Scope for interaction with vehicles.

Definition at line 956 of file TraCIAPI.h.

Referenced by testAPI(), and TraCIAPI::TraCIAPI().

◆ vehicletype

VehicleTypeScope TraCIAPI::vehicletype
inherited

Scope for interaction with vehicle types.

Definition at line 958 of file TraCIAPI.h.

Referenced by testAPI(), and TraCIAPI::TraCIAPI().


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