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

A test execution class. More...

#include <TraCITestClient.h>

Inheritance diagram for TraCITestClient:
Inheritance graph
Collaboration diagram for TraCITestClient:
Collaboration graph

Public Types

typedef std::map< std::string,
SubscribedValues
SubscribedContextValues
 
typedef std::map< std::string,
TraCIValues
SubscribedValues
 
typedef std::map< int, TraCIValueTraCIValues
 {object->{variable->value}} More...
 
Structures definitions
typedef std::vector
< TraCIPosition
TraCIPositionVector
 

Public Member Functions

bool run (std::string fileName, int port, std::string host="localhost")
 Runs a test. More...
 
void simulationStep (SUMOTime 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 close ()
 Closes the connection. More...
 
Atomar getter
SUMOTime getSUMOTime (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 
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)
 
SUMOReal getFloat (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 
SUMOReal getDouble (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 
TraCIBoundary getBoundingBox (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 
TraCIPositionVector getPolygon (int cmd, int var, const std::string &id, tcpip::Storage *add=0)
 
TraCIPosition getPosition (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)
 
TraCIColor getColor (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...
 
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 readContextSubscription (tcpip::Storage &inMsg)
 
void readVariables (tcpip::Storage &inMsg, const std::string &objectID, int variableCount, SubscribedValues &into)
 
void readVariableSubscription (tcpip::Storage &inMsg)
 
void send_commandMoveToXY (const std::string &vehicleID, const std::string &edgeID, const int lane, const SUMOReal x, const SUMOReal y, const SUMOReal angle, const int keepRoute) const
 
Commands handling
void commandSimulationStep (SUMOTime time)
 Sends and validates a simulation step command. More...
 
void commandClose ()
 Sends and validates a Close 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, SUMOTime beginTime, SUMOTime endTime, int varNo, std::ifstream &defFile)
 Sends and validates a SubscribeVariable command. More...
 
void commandSubscribeContextVariable (int domID, const std::string &objID, SUMOTime beginTime, SUMOTime endTime, int domain, SUMOReal range, int varNo, std::ifstream &defFile)
 Sends and validates a SubscribeContext command. More...
 
Command sending methods
void send_commandSimulationStep (SUMOTime time) const
 Sends a SimulationStep command. More...
 
void send_commandClose () const
 Sends a Close command. More...
 
void send_commandGetVariable (int domID, int varID, const std::string &objID, tcpip::Storage *add=0) const
 Sends a GetVariable request. More...
 
void send_commandSetValue (int domID, int varID, const std::string &objID, tcpip::Storage &content) const
 Sends a SetVariable request. More...
 
void send_commandSubscribeObjectVariable (int domID, const std::string &objID, SUMOTime beginTime, SUMOTime endTime, const std::vector< int > &vars) const
 Sends a SubscribeVariable request. More...
 
void send_commandSubscribeObjectContext (int domID, const std::string &objID, SUMOTime beginTime, SUMOTime endTime, int domain, SUMOReal 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...
 
void processGET (tcpip::Storage &inMsg, int command, int expectedType, bool ignoreCommandId=false) const
 

Static Protected Member Functions

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

Protected Attributes

tcpip::SocketmySocket
 The socket. More...
 
SubscribedContextValues mySubscribedContextValues
 
SubscribedValues mySubscribedValues
 

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_SIMSTEP2. 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 53 of file TraCITestClient.h.

Member Typedef Documentation

typedef std::map<std::string, SubscribedValues> TraCIAPI::SubscribedContextValues
inherited

Definition at line 562 of file TraCIAPI.h.

typedef std::map<std::string, TraCIValues> TraCIAPI::SubscribedValues
inherited

Definition at line 561 of file TraCIAPI.h.

typedef std::vector<TraCIPosition> TraCIAPI::TraCIPositionVector
inherited

Definition at line 85 of file TraCIAPI.h.

typedef std::map<int, TraCIValue> TraCIAPI::TraCIValues
inherited

{object->{variable->value}}

Definition at line 560 of file TraCIAPI.h.

Constructor & Destructor Documentation

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

References answerLog.

TraCITestClient::~TraCITestClient ( )

Destructor.

Definition at line 67 of file TraCITestClient.cpp.

References writeResult().

Member Function Documentation

int TraCIAPI::check_commandGetResult ( tcpip::Storage inMsg,
int  command,
int  expectedType = -1,
bool  ignoreCommandId = false 
) const
protectedinherited
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 241 of file TraCIAPI.cpp.

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

Referenced by commandClose(), commandGetVariable(), commandSetValue(), commandSimulationStep(), commandSubscribeContextVariable(), commandSubscribeObjectVariable(), TraCIAPI::processGET(), and TraCIAPI::simulationStep().

void TraCIAPI::close ( )
inherited

Closes the connection.

Definition at line 80 of file TraCIAPI.cpp.

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

Referenced by run().

void TraCITestClient::commandClose ( )
protected

Sends and validates a Close command.

Definition at line 199 of file TraCITestClient.cpp.

References answerLog, TraCIAPI::check_resultState(), CMD_CLOSE, TraCIAPI::send_commandClose(), and tcpip::SocketException::what().

Referenced by run().

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

References answerLog, TraCIAPI::check_commandGetResult(), TraCIAPI::check_resultState(), errorMsg(), readAndReportTypeDependent(), tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), TraCIAPI::send_commandGetVariable(), and tcpip::SocketException::what().

Referenced by run().

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

References answerLog, TraCIAPI::check_resultState(), errorMsg(), TraCIAPI::send_commandSetValue(), setValueTypeDependant(), and tcpip::SocketException::what().

Referenced by run().

void TraCITestClient::commandSimulationStep ( SUMOTime  time)
protected

Sends and validates a simulation step command.

Parameters
[in]timeThe time step to send

Definition at line 183 of file TraCITestClient.cpp.

References answerLog, TraCIAPI::check_resultState(), CMD_SIMSTEP2, TraCIAPI::send_commandSimulationStep(), validateSimulationStep2(), and tcpip::SocketException::what().

Referenced by run().

void TraCITestClient::commandSubscribeContextVariable ( int  domID,
const std::string &  objID,
SUMOTime  beginTime,
SUMOTime  endTime,
int  domain,
SUMOReal  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 294 of file TraCITestClient.cpp.

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

Referenced by run().

void TraCITestClient::commandSubscribeObjectVariable ( int  domID,
const std::string &  objID,
SUMOTime  beginTime,
SUMOTime  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 270 of file TraCITestClient.cpp.

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

Referenced by run().

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 67 of file TraCIAPI.cpp.

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

Referenced by run().

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

Writes an error message.

Parameters
[in]msgThe message to write

Definition at line 337 of file TraCITestClient.cpp.

References answerLog.

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

int TraCIAPI::getByte ( int  cmd,
int  var,
const std::string &  id,
tcpip::Storage add = 0 
)
inherited
SUMOReal TraCIAPI::getDouble ( int  cmd,
int  var,
const std::string &  id,
tcpip::Storage add = 0 
)
inherited
SUMOReal TraCIAPI::getFloat ( int  cmd,
int  var,
const std::string &  id,
tcpip::Storage add = 0 
)
inherited
int TraCIAPI::getInt ( int  cmd,
int  var,
const std::string &  id,
tcpip::Storage add = 0 
)
inherited
TraCIAPI::TraCIPosition TraCIAPI::getPosition ( int  cmd,
int  var,
const std::string &  id,
tcpip::Storage add = 0 
)
inherited
std::string TraCIAPI::getString ( int  cmd,
int  var,
const std::string &  id,
tcpip::Storage add = 0 
)
inherited
std::vector< std::string > TraCIAPI::getStringVector ( int  cmd,
int  var,
const std::string &  id,
tcpip::Storage add = 0 
)
inherited
SUMOTime TraCIAPI::getSUMOTime ( int  cmd,
int  var,
const std::string &  id,
tcpip::Storage add = 0 
)
inherited
int TraCIAPI::getUnsignedByte ( int  cmd,
int  var,
const std::string &  id,
tcpip::Storage add = 0 
)
inherited
void TraCITestClient::readAndReportTypeDependent ( tcpip::Storage inMsg,
int  valueDataType 
)
private
void TraCIAPI::readContextSubscription ( tcpip::Storage inMsg)
protectedinherited
void TraCIAPI::readVariableSubscription ( tcpip::Storage inMsg)
protectedinherited
bool 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 73 of file TraCITestClient.cpp.

References TraCIAPI::close(), commandClose(), commandGetVariable(), commandSetValue(), commandSimulationStep(), commandSubscribeContextVariable(), commandSubscribeObjectVariable(), TraCIAPI::connect(), errorMsg(), setValueTypeDependant(), string2time(), SUMOReal, testAPI(), and tcpip::SocketException::what().

Referenced by main().

void TraCIAPI::send_commandClose ( ) const
protectedinherited

Sends a Close command.

Definition at line 104 of file TraCIAPI.cpp.

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

Referenced by commandClose().

void TraCIAPI::send_commandGetVariable ( int  domID,
int  varID,
const std::string &  objID,
tcpip::Storage add = 0 
) const
protectedinherited
void TraCIAPI::send_commandMoveToXY ( const std::string &  vehicleID,
const std::string &  edgeID,
const int  lane,
const SUMOReal  x,
const SUMOReal  y,
const SUMOReal  angle,
const int  keepRoute 
) const
protectedinherited
void TraCIAPI::send_commandSetValue ( int  domID,
int  varID,
const std::string &  objID,
tcpip::Storage content 
) const
protectedinherited

Sends a SetVariable request.

Parameters
[in]domIDThe domain of the variable
[in]varIDThe variable to set
[in]objIDThe object to change
[in]contentThe value of the variable

Definition at line 142 of file TraCIAPI.cpp.

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

Referenced by commandSetValue(), and TraCIAPI::send_commandMoveToXY().

void TraCIAPI::send_commandSimulationStep ( SUMOTime  time) const
protectedinherited
void TraCIAPI::send_commandSubscribeObjectContext ( int  domID,
const std::string &  objID,
SUMOTime  beginTime,
SUMOTime  endTime,
int  domain,
SUMOReal  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 191 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().

void TraCIAPI::send_commandSubscribeObjectVariable ( int  domID,
const std::string &  objID,
SUMOTime  beginTime,
SUMOTime  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 163 of file TraCIAPI.cpp.

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

Referenced by commandSubscribeObjectVariable().

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 423 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 commandSetValue(), and run().

void TraCITestClient::testAPI ( )
private

call all API methods once

Definition at line 675 of file TraCITestClient.cpp.

References TraCIAPI::TraCIColor::a, TraCIAPI::EdgeScope::adaptTraveltime(), TraCIAPI::RouteScope::add(), TraCIAPI::VehicleScope::add(), answerLog, TraCIAPI::TraCIColor::b, CMD_GET_VEHICLE_VARIABLE, CMD_SUBSCRIBE_EDGE_CONTEXT, CMD_SUBSCRIBE_VEHICLE_VARIABLE, TraCIAPI::edge, TraCIAPI::TraCIColor::g, TraCIAPI::EdgeScope::getAdaptedTraveltime(), TraCIAPI::VehicleScope::getColor(), TraCIAPI::SimulationScope::getContextSubscriptionResults(), TraCIAPI::SimulationScope::getCurrentTime(), TraCIAPI::EdgeScope::getEffort(), TraCIAPI::VehicleTypeScope::getHeight(), TraCIAPI::EdgeScope::getIDCount(), TraCIAPI::VehicleScope::getIDCount(), TraCIAPI::EdgeScope::getIDList(), TraCIAPI::InductionLoopScope::getIDList(), TraCIAPI::RouteScope::getIDList(), TraCIAPI::VehicleTypeScope::getIDList(), TraCIAPI::VehicleScope::getIDList(), TraCIAPI::PersonScope::getIDList(), TraCIAPI::VehicleScope::getLaneID(), TraCIAPI::PersonScope::getNextEdge(), TraCIAPI::VehicleScope::getNextTLS(), TraCIAPI::VehicleScope::getRoadID(), TraCIAPI::PersonScope::getRoadID(), TraCIAPI::GUIScope::getSchema(), TraCIAPI::VehicleScope::getSlope(), TraCIAPI::VehicleScope::getSpeedMode(), TraCIAPI::SimulationScope::getSubscriptionResults(), TraCIAPI::EdgeScope::getTraveltime(), TraCIAPI::PersonScope::getTypeID(), TraCIAPI::InductionLoopScope::getVehicleData(), TraCIAPI::VehicleScope::getWaitingTime(), TraCIAPI::PersonScope::getWaitingTime(), TraCIAPI::VehicleTypeScope::getWidth(), TraCIAPI::gui, TraCIAPI::inductionloop, joinToString(), TraCIAPI::VehicleScope::moveToXY(), TraCIAPI::person, TraCIAPI::TraCIColor::r, TraCIAPI::VehicleScope::remove(), TraCIAPI::route, TraCIAPI::GUIScope::screenshot(), TraCIAPI::VehicleScope::setColor(), TraCIAPI::EdgeScope::setEffort(), TraCIAPI::VehicleTypeScope::setHeight(), TraCIAPI::GUIScope::setSchema(), TraCIAPI::VehicleTypeScope::setWidth(), TraCIAPI::simulation, TraCIAPI::simulationStep(), TraCIAPI::SimulationScope::subscribe(), TraCIAPI::SimulationScope::subscribeContext(), TIME2STEPS, VAR_LANEPOSITION, VAR_ROAD_ID, TraCIAPI::vehicle, and TraCIAPI::vehicletype.

Referenced by run().

template<class T >
static std::string TraCIAPI::toString ( const T &  t,
std::streamsize  accuracy = OUTPUT_ACCURACY 
)
inlinestaticprotectedinherited
bool TraCITestClient::validateSimulationStep2 ( tcpip::Storage inMsg)
private

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

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

Definition at line 348 of file TraCITestClient.cpp.

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

Referenced by commandSimulationStep().

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

Validates whether the given message is a valid subscription return message.

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

Definition at line 365 of file TraCITestClient.cpp.

References answerLog, readAndReportTypeDependent(), tcpip::Storage::readInt(), tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), RESPONSE_SUBSCRIBE_GUI_CONTEXT, RESPONSE_SUBSCRIBE_GUI_VARIABLE, RESPONSE_SUBSCRIBE_INDUCTIONLOOP_CONTEXT, RESPONSE_SUBSCRIBE_INDUCTIONLOOP_VARIABLE, and RTYPE_OK.

Referenced by commandSubscribeContextVariable(), commandSubscribeObjectVariable(), and validateSimulationStep2().

void TraCITestClient::writeResult ( )
private

Writes the results file.

Definition at line 321 of file TraCITestClient.cpp.

References answerLog, and outputFileName.

Referenced by ~TraCITestClient().

Field Documentation

EdgeScope TraCIAPI::edge
inherited

Scope for interaction with edges.

Definition at line 837 of file TraCIAPI.h.

Referenced by testAPI().

GUIScope TraCIAPI::gui
inherited

Scope for interaction with the gui.

Definition at line 839 of file TraCIAPI.h.

Referenced by testAPI().

InductionLoopScope TraCIAPI::inductionloop
inherited

Scope for interaction with inductive loops.

Definition at line 841 of file TraCIAPI.h.

Referenced by testAPI().

JunctionScope TraCIAPI::junction
inherited

Scope for interaction with junctions.

Definition at line 843 of file TraCIAPI.h.

LaneScope TraCIAPI::lane
inherited

Scope for interaction with lanes.

Definition at line 845 of file TraCIAPI.h.

MeMeScope TraCIAPI::multientryexit
inherited

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

Definition at line 847 of file TraCIAPI.h.

SubscribedContextValues TraCIAPI::mySubscribedContextValues
protectedinherited

Definition at line 963 of file TraCIAPI.h.

Referenced by TraCIAPI::readContextSubscription(), and TraCIAPI::simulationStep().

SubscribedValues TraCIAPI::mySubscribedValues
protectedinherited

Definition at line 962 of file TraCIAPI.h.

Referenced by TraCIAPI::readVariableSubscription(), and TraCIAPI::simulationStep().

std::string TraCITestClient::outputFileName
private

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

Definition at line 194 of file TraCITestClient.h.

Referenced by writeResult().

PersonScope TraCIAPI::person
inherited

Scope for interaction with persons.

Definition at line 863 of file TraCIAPI.h.

Referenced by testAPI().

POIScope TraCIAPI::poi
inherited

Scope for interaction with POIs.

Definition at line 849 of file TraCIAPI.h.

PolygonScope TraCIAPI::polygon
inherited

Scope for interaction with polygons.

Definition at line 851 of file TraCIAPI.h.

RouteScope TraCIAPI::route
inherited

Scope for interaction with routes.

Definition at line 853 of file TraCIAPI.h.

Referenced by testAPI().

SimulationScope TraCIAPI::simulation
inherited

Scope for interaction with the simulation.

Definition at line 855 of file TraCIAPI.h.

Referenced by testAPI().

TrafficLightScope TraCIAPI::trafficlights
inherited

Scope for interaction with traffic lights.

Definition at line 857 of file TraCIAPI.h.

VehicleScope TraCIAPI::vehicle
inherited

Scope for interaction with vehicles.

Definition at line 861 of file TraCIAPI.h.

Referenced by testAPI().

VehicleTypeScope TraCIAPI::vehicletype
inherited

Scope for interaction with vehicle types.

Definition at line 859 of file TraCIAPI.h.

Referenced by testAPI().


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