![]() |
Eclipse SUMO - Simulation of Urban MObility
|
TraCI server used to control sumo by a remote TraCI client. More...
#include <TraCIServer.h>
Data Structures | |
struct | SocketInfo |
Public Types | |
typedef bool(* | CmdExecutor) (TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage) |
Definition of a method to be called for serving an associated commandID. More... | |
typedef bool(* | SubscriptionHandler) (const std::string &objID, const int variable, VariableWrapper *wrapper) |
Definition of a method to be called for serving an associated commandID. More... | |
Public Member Functions | |
void | cleanup () |
clean up subscriptions More... | |
virtual void | clear () |
std::vector< std::string > & | getLoadArgs () |
SUMOTime | getTargetTime () const |
const std::map< MSNet::VehicleState, std::vector< std::string > > & | getVehicleStateChanges () const |
void | processCommandsUntilSimStep (SUMOTime step) |
process all commands until the next SUMO simulation step. It is guaranteed that t->getTargetTime() >= myStep after call (except the case that a load or close command is received)s More... | |
virtual void | setContext (const std::string &) |
void | setTargetTime (SUMOTime targetTime) |
Sets myTargetTime on server and sockets to the given value. More... | |
void | vehicleStateChanged (const SUMOVehicle *const vehicle, MSNet::VehicleState to, const std::string &info="") |
Called if a vehicle changes its state. More... | |
void | writePositionVector (tcpip::Storage &outputStorage, const libsumo::TraCIPositionVector &shape) |
void | writeResponseWithLength (tcpip::Storage &outputStorage, tcpip::Storage &tempMsg) |
Writing Status Messages | |
void | writeStatusCmd (int commandId, int status, const std::string &description, tcpip::Storage &outputStorage) |
Writes a status command to the given storage. More... | |
void | writeStatusCmd (int commandId, int status, const std::string &description) |
Writes a status command to myOutputStorage. More... | |
bool | writeErrorStatusCmd (int commandId, const std::string &description, tcpip::Storage &outputStorage) |
Writes a status command to the given storage with status = RTYPE_ERR. More... | |
Helpers for reading and checking values | |
bool | readTypeCheckingInt (tcpip::Storage &inputStorage, int &into) |
Reads the value type and an int, verifying the type. More... | |
bool | readTypeCheckingDouble (tcpip::Storage &inputStorage, double &into) |
Reads the value type and a double, verifying the type. More... | |
bool | readTypeCheckingString (tcpip::Storage &inputStorage, std::string &into) |
Reads the value type and a string, verifying the type. More... | |
bool | readTypeCheckingStringList (tcpip::Storage &inputStorage, std::vector< std::string > &into) |
Reads the value type and a string list, verifying the type. More... | |
bool | readTypeCheckingDoubleList (tcpip::Storage &inputStorage, std::vector< double > &into) |
Reads the value type and a double list, verifying the type. More... | |
bool | readTypeCheckingColor (tcpip::Storage &inputStorage, libsumo::TraCIColor &into) |
Reads the value type and a color, verifying the type. More... | |
bool | readTypeCheckingPosition2D (tcpip::Storage &inputStorage, libsumo::TraCIPosition &into) |
Reads the value type and a 2D position, verifying the type. More... | |
bool | readTypeCheckingByte (tcpip::Storage &inputStorage, int &into) |
Reads the value type and a byte, verifying the type. More... | |
bool | readTypeCheckingUnsignedByte (tcpip::Storage &inputStorage, int &into) |
Reads the value type and an unsigned byte, verifying the type. More... | |
bool | readTypeCheckingPolygon (tcpip::Storage &inputStorage, PositionVector &into) |
Reads the value type and a polygon, verifying the type. More... | |
VariableWrapper interface | |
void | initWrapper (const int domainID, const int variable, const std::string &objID) |
bool | wrapDouble (const std::string &objID, const int variable, const double value) |
bool | wrapInt (const std::string &objID, const int variable, const int value) |
bool | wrapString (const std::string &objID, const int variable, const std::string &value) |
bool | wrapStringList (const std::string &objID, const int variable, const std::vector< std::string > &value) |
bool | wrapPosition (const std::string &objID, const int variable, const libsumo::TraCIPosition &value) |
bool | wrapColor (const std::string &objID, const int variable, const libsumo::TraCIColor &value) |
bool | wrapRoadPosition (const std::string &objID, const int variable, const libsumo::TraCIRoadPosition &value) |
tcpip::Storage & | getWrapperStorage () |
Static Public Member Functions | |
static TraCIServer * | getInstance () |
Initialisation and Shutdown | |
static void | openSocket (const std::map< int, CmdExecutor > &execs) |
Initialises the server. More... | |
static void | close () |
request termination of connection More... | |
static bool | wasClosed () |
check whether close was requested More... | |
Data Fields | |
SubscriptionHandler | handle |
Private Member Functions | |
bool | addObjectVariableSubscription (const int commandId, const bool hasContext) |
bool | addSubscriptionFilter () |
void | addSubscriptionFilterDownstreamDistance (double dist) |
void | addSubscriptionFilterLanes (std::vector< int > lanes) |
void | addSubscriptionFilterLeadFollow () |
void | addSubscriptionFilterNoOpposite () |
void | addSubscriptionFilterTurn () |
void | addSubscriptionFilterUpstreamDistance (double dist) |
void | addSubscriptionFilterVClass (SVCPermissions vClasses) |
void | addSubscriptionFilterVType (std::set< std::string > vTypes) |
bool | centralObject (const libsumo::Subscription &s, const std::string &objID) |
check whether a found objID refers to the central object of a context subscription More... | |
void | checkClientOrdering () |
Called once after connection of all clients for executing SET_ORDER (and possibly prior GET_VERSION) commands, that should be executed before simulation starts (in processCommandsUntilNextSimStep()). More... | |
int | dispatchCommand () |
Handles command, writes response to myOutputStorage. More... | |
bool | findObjectShape (int domain, const std::string &id, PositionVector &shape) |
void | initialiseSubscription (libsumo::Subscription &s) |
bool | isVehicleToVehicleContextSubscription (const libsumo::Subscription &s) |
SUMOTime | nextTargetTime () const |
get the minimal next target time among all clients More... | |
TraCIServer & | operator= (const TraCIServer &s) |
Invalidated assignment operator. More... | |
void | processReorderingRequests () |
checks for and processes reordering requests (relevant for multiple clients) More... | |
bool | processSingleSubscription (const libsumo::Subscription &s, tcpip::Storage &writeInto, std::string &errors) |
int | readCommandID (int &commandStart, int &commandLength) |
Reads the next command ID from the input storage. More... | |
std::map< int, SocketInfo * >::iterator | removeCurrentSocket () |
removes myCurrentSocket from mySockets and returns an iterator pointing to the next member according to the ordering More... | |
void | removeFilters () |
void | removeSubscription (int commandId, const std::string &identity, int domain) |
void | sendOutputToAll () const |
send out subscription results (actually just the content of myOutputStorage) to clients which will act in this step (i.e. with client target time <= myTargetTime) More... | |
void | sendSingleSimStepResponse () |
sends an empty response to a simstep command to the current client. (This applies to a situation where the TraCI step frequency is higher than the SUMO step frequency) More... | |
TraCIServer (const SUMOTime begin, const int port, const int numClients) | |
Constructor. More... | |
virtual | ~TraCIServer () |
Destructor. More... | |
Server-internal command handling | |
bool | commandGetVersion () |
Returns the TraCI-version. More... | |
void | postProcessSimulationStep () |
Handles subscriptions to send after a simstep2 command. More... | |
Private Attributes | |
std::map< int, SocketInfo * >::iterator | myCurrentSocket |
The currently active client socket. More... | |
std::map< int, CmdExecutor > | myExecutors |
Map of commandIds -> their executors; applicable if the executor applies to the method footprint. More... | |
tcpip::Storage | myInputStorage |
The storage to read from. More... | |
libsumo::Subscription * | myLastContextSubscription |
The last modified context subscription (the one to add a filter to, see @addSubscriptionFilter(), currently only for vehicle to vehicle context) More... | |
std::vector< std::string > | myLoadArgs |
tcpip::Storage | myOutputStorage |
The storage to write to. More... | |
std::map< int, int > | myParameterSizes |
Map of variable ids to the size of the parameter in bytes. More... | |
tcpip::Socket * | myServerSocket |
The server socket. More... | |
std::map< int, SocketInfo * > | mySocketReorderRequests |
This stores the setOrder(int) requests of the clients. More... | |
std::map< int, SocketInfo * > | mySockets |
The socket connections to the clients the first component (index) determines the client's order (lowest index's commands are processed first),. More... | |
tcpip::Storage | mySubscriptionCache |
The last timestep's subscription results. More... | |
std::vector< libsumo::Subscription > | mySubscriptions |
The list of known, still valid subscriptions. More... | |
SUMOTime | myTargetTime |
The time step to reach until processing the next commands. More... | |
std::map< MSNet::VehicleState, std::vector< std::string > > | myVehicleStateChanges |
Changes in the states of simulated vehicles. More... | |
tcpip::Storage | myWrapperStorage |
A temporary storage to let the wrapper write to. More... | |
Static Private Attributes | |
static bool | myDoCloseConnection = false |
Whether the connection was set to be to close. More... | |
static TraCIServer * | myInstance = nullptr |
Singleton instance of the server. More... | |
TraCI server used to control sumo by a remote TraCI client.
Definition at line 62 of file TraCIServer.h.
typedef bool(* TraCIServer::CmdExecutor) (TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage) |
Definition of a method to be called for serving an associated commandID.
Definition at line 65 of file TraCIServer.h.
|
inherited |
Definition of a method to be called for serving an associated commandID.
Definition at line 117 of file Subscription.h.
|
private |
Constructor.
[in] | port | The port to listen to (to open) |
Definition at line 181 of file TraCIServer.cpp.
References tcpip::Socket::accept(), checkClientOrdering(), libsumo::CMD_GET_EDGE_VARIABLE, libsumo::CMD_GET_INDUCTIONLOOP_VARIABLE, libsumo::CMD_GET_JUNCTION_VARIABLE, libsumo::CMD_GET_LANE_VARIABLE, libsumo::CMD_GET_LANEAREA_VARIABLE, libsumo::CMD_GET_MULTIENTRYEXIT_VARIABLE, libsumo::CMD_GET_PERSON_VARIABLE, libsumo::CMD_GET_POI_VARIABLE, libsumo::CMD_GET_POLYGON_VARIABLE, libsumo::CMD_GET_ROUTE_VARIABLE, libsumo::CMD_GET_SIM_VARIABLE, libsumo::CMD_GET_TL_VARIABLE, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::CMD_SET_EDGE_VARIABLE, libsumo::CMD_SET_LANE_VARIABLE, libsumo::CMD_SET_PERSON_VARIABLE, libsumo::CMD_SET_POI_VARIABLE, libsumo::CMD_SET_POLYGON_VARIABLE, libsumo::CMD_SET_ROUTE_VARIABLE, libsumo::CMD_SET_SIM_VARIABLE, libsumo::CMD_SET_TL_VARIABLE, libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::CMD_SET_VEHICLETYPE_VARIABLE, MsgHandler::getWarningInstance(), MSGlobals::gUsingInternalLanes, MsgHandler::inform(), libsumo::MAX_ORDER, myCurrentSocket, myDoCloseConnection, myExecutors, myParameterSizes, myServerSocket, mySockets, myVehicleStateChanges, TraCIServerAPI_Edge::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_MultiEntryExit::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_TrafficLight::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_LaneArea::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_Edge::processSet(), TraCIServerAPI_VehicleType::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_Route::processSet(), TraCIServerAPI_TrafficLight::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_Simulation::processSet(), TraCIServerAPI_Person::processSet(), TraCIServerAPI_Lane::processSet(), toString(), libsumo::VAR_LEADER, MSNet::VEHICLE_STATE_ARRIVED, MSNet::VEHICLE_STATE_BUILT, MSNet::VEHICLE_STATE_COLLISION, MSNet::VEHICLE_STATE_DEPARTED, MSNet::VEHICLE_STATE_EMERGENCYSTOP, MSNet::VEHICLE_STATE_ENDING_PARKING, MSNet::VEHICLE_STATE_ENDING_STOP, MSNet::VEHICLE_STATE_ENDING_TELEPORT, MSNet::VEHICLE_STATE_NEWROUTE, MSNet::VEHICLE_STATE_STARTING_PARKING, MSNet::VEHICLE_STATE_STARTING_STOP, MSNet::VEHICLE_STATE_STARTING_TELEPORT, WRITE_MESSAGE, and WRITE_WARNING.
Referenced by openSocket().
|
privatevirtual |
Destructor.
Definition at line 273 of file TraCIServer.cpp.
References cleanup(), myCurrentSocket, myServerSocket, and mySockets.
|
private |
Definition at line 1180 of file TraCIServer.cpp.
References initialiseSubscription(), libsumo::INVALID_DOUBLE_VALUE, myInputStorage, myParameterSizes, tcpip::Storage::readChar(), tcpip::Storage::readDouble(), tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), removeSubscription(), STEPS2TIME, SUMOTime_MAX, and TIME2STEPS.
Referenced by dispatchCommand().
|
private |
Definition at line 1213 of file TraCIServer.cpp.
References addSubscriptionFilterDownstreamDistance(), addSubscriptionFilterLanes(), addSubscriptionFilterLeadFollow(), addSubscriptionFilterNoOpposite(), addSubscriptionFilterTurn(), addSubscriptionFilterUpstreamDistance(), addSubscriptionFilterVClass(), addSubscriptionFilterVType(), libsumo::CMD_ADD_SUBSCRIPTION_FILTER, libsumo::FILTER_TYPE_DOWNSTREAM_DIST, libsumo::FILTER_TYPE_LANES, libsumo::FILTER_TYPE_LEAD_FOLLOW, libsumo::FILTER_TYPE_NONE, libsumo::FILTER_TYPE_NOOPPOSITE, libsumo::FILTER_TYPE_TURN, libsumo::FILTER_TYPE_UPSTREAM_DIST, libsumo::FILTER_TYPE_VCLASS, libsumo::FILTER_TYPE_VTYPE, myInputStorage, myLastContextSubscription, parseVehicleClasses(), tcpip::Storage::readByte(), tcpip::Storage::readDouble(), tcpip::Storage::readStringList(), tcpip::Storage::readUnsignedByte(), removeFilters(), libsumo::RTYPE_NOTIMPLEMENTED, libsumo::RTYPE_OK, toString(), WRITE_WARNING, and writeStatusCmd().
Referenced by dispatchCommand().
|
private |
Definition at line 1316 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, libsumo::Subscription::filterDownstreamDist, myLastContextSubscription, libsumo::SUBS_FILTER_DOWNSTREAM_DIST, and toString().
Referenced by addSubscriptionFilter().
|
private |
Definition at line 1299 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, libsumo::Subscription::filterLanes, myLastContextSubscription, libsumo::SUBS_FILTER_LANES, and toString().
Referenced by addSubscriptionFilter().
|
private |
Definition at line 1334 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, myLastContextSubscription, and libsumo::SUBS_FILTER_LEAD_FOLLOW.
Referenced by addSubscriptionFilter().
|
private |
Definition at line 1308 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, myLastContextSubscription, and libsumo::SUBS_FILTER_NOOPPOSITE.
Referenced by addSubscriptionFilter().
|
private |
Definition at line 1342 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, myLastContextSubscription, and libsumo::SUBS_FILTER_TURN.
Referenced by addSubscriptionFilter().
|
private |
Definition at line 1325 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, libsumo::Subscription::filterUpstreamDist, myLastContextSubscription, libsumo::SUBS_FILTER_UPSTREAM_DIST, and toString().
Referenced by addSubscriptionFilter().
|
private |
Definition at line 1350 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, libsumo::Subscription::filterVClasses, myLastContextSubscription, libsumo::SUBS_FILTER_VCLASS, and toString().
Referenced by addSubscriptionFilter().
|
private |
Definition at line 1359 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, libsumo::Subscription::filterVTypes, myLastContextSubscription, libsumo::SUBS_FILTER_VTYPE, and toString().
Referenced by addSubscriptionFilter().
|
private |
check whether a found objID refers to the central object of a context subscription
Definition at line 1523 of file TraCIServer.cpp.
References libsumo::Subscription::commandId, libsumo::Subscription::contextDomain, and libsumo::Subscription::id.
|
private |
Called once after connection of all clients for executing SET_ORDER (and possibly prior GET_VERSION) commands, that should be executed before simulation starts (in processCommandsUntilNextSimStep()).
Definition at line 333 of file TraCIServer.cpp.
References libsumo::CMD_GETVERSION, libsumo::CMD_SETORDER, dispatchCommand(), myCurrentSocket, myInputStorage, myOutputStorage, mySockets, readCommandID(), tcpip::Storage::reset(), tcpip::Storage::writeStorage(), and tcpip::Storage::writeUnsignedByte().
Referenced by TraCIServer().
void TraCIServer::cleanup | ( | ) |
clean up subscriptions
Definition at line 648 of file TraCIServer.cpp.
References OptionsCont::getOptions(), myCurrentSocket, myInputStorage, myOutputStorage, mySockets, mySubscriptionCache, mySubscriptions, myTargetTime, myVehicleStateChanges, tcpip::Storage::reset(), and string2time().
Referenced by MSNet::clearAll(), and ~TraCIServer().
|
inlinevirtualinherited |
Reimplemented in libsumo::Helper::SubscriptionWrapper.
Definition at line 121 of file Subscription.h.
|
static |
request termination of connection
Definition at line 302 of file TraCIServer.cpp.
References myDoCloseConnection, and myInstance.
Referenced by main().
|
private |
Returns the TraCI-version.
Definition at line 862 of file TraCIServer.cpp.
References libsumo::CMD_GETVERSION, myOutputStorage, libsumo::RTYPE_OK, tcpip::Storage::size(), libsumo::TRACI_VERSION, VERSION_STRING, tcpip::Storage::writeInt(), writeStatusCmd(), tcpip::Storage::writeStorage(), tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
Referenced by dispatchCommand().
|
private |
Handles command, writes response to myOutputStorage.
Definition at line 714 of file TraCIServer.cpp.
References addObjectVariableSubscription(), addSubscriptionFilter(), libsumo::CMD_ADD_SUBSCRIPTION_FILTER, libsumo::CMD_CLOSE, libsumo::CMD_GET_GUI_VARIABLE, libsumo::CMD_GETVERSION, libsumo::CMD_LOAD, libsumo::CMD_SET_GUI_VARIABLE, libsumo::CMD_SETORDER, libsumo::CMD_SIMSTEP, libsumo::CMD_SUBSCRIBE_EDGE_CONTEXT, libsumo::CMD_SUBSCRIBE_EDGE_VARIABLE, libsumo::CMD_SUBSCRIBE_GUI_CONTEXT, libsumo::CMD_SUBSCRIBE_GUI_VARIABLE, libsumo::CMD_SUBSCRIBE_INDUCTIONLOOP_CONTEXT, libsumo::CMD_SUBSCRIBE_INDUCTIONLOOP_VARIABLE, libsumo::CMD_SUBSCRIBE_JUNCTION_CONTEXT, libsumo::CMD_SUBSCRIBE_JUNCTION_VARIABLE, libsumo::CMD_SUBSCRIBE_LANE_CONTEXT, libsumo::CMD_SUBSCRIBE_LANE_VARIABLE, libsumo::CMD_SUBSCRIBE_LANEAREA_CONTEXT, libsumo::CMD_SUBSCRIBE_LANEAREA_VARIABLE, libsumo::CMD_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT, libsumo::CMD_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE, libsumo::CMD_SUBSCRIBE_PERSON_CONTEXT, libsumo::CMD_SUBSCRIBE_PERSON_VARIABLE, libsumo::CMD_SUBSCRIBE_POI_CONTEXT, libsumo::CMD_SUBSCRIBE_POI_VARIABLE, libsumo::CMD_SUBSCRIBE_POLYGON_CONTEXT, libsumo::CMD_SUBSCRIBE_POLYGON_VARIABLE, libsumo::CMD_SUBSCRIBE_ROUTE_CONTEXT, libsumo::CMD_SUBSCRIBE_ROUTE_VARIABLE, libsumo::CMD_SUBSCRIBE_SIM_CONTEXT, libsumo::CMD_SUBSCRIBE_SIM_VARIABLE, libsumo::CMD_SUBSCRIBE_TL_CONTEXT, libsumo::CMD_SUBSCRIBE_TL_VARIABLE, libsumo::CMD_SUBSCRIBE_VEHICLE_CONTEXT, libsumo::CMD_SUBSCRIBE_VEHICLE_VARIABLE, libsumo::CMD_SUBSCRIBE_VEHICLETYPE_CONTEXT, libsumo::CMD_SUBSCRIBE_VEHICLETYPE_VARIABLE, commandGetVersion(), DELTA_T, MSNet::getCurrentTimeStep(), MSNet::getInstance(), libsumo::MAX_ORDER, myCurrentSocket, myDoCloseConnection, myExecutors, myInputStorage, myLoadArgs, myOutputStorage, mySocketReorderRequests, mySockets, tcpip::Storage::position(), tcpip::Storage::readChar(), readCommandID(), tcpip::Storage::readDouble(), tcpip::Storage::readInt(), readTypeCheckingStringList(), tcpip::Storage::reset(), libsumo::RTYPE_ERR, libsumo::RTYPE_NOTIMPLEMENTED, libsumo::RTYPE_OK, sendSingleSimStepResponse(), TIME2STEPS, toString(), tcpip::Storage::valid_pos(), writeErrorStatusCmd(), and writeStatusCmd().
Referenced by checkClientOrdering(), and processCommandsUntilSimStep().
|
private |
|
inlinestatic |
Definition at line 71 of file TraCIServer.h.
References myInstance.
Referenced by NLBuilder::build(), MSNet::clearAll(), GUIRunThread::makeStep(), GUIApplicationWindow::onUpdReload(), GUIApplicationWindow::onUpdTraCIStatus(), MSNet::postSimStepOutput(), MSNet::simulate(), MSNet::simulationState(), and MSNet::simulationStep().
|
inline |
Definition at line 249 of file TraCIServer.h.
References myLoadArgs.
Referenced by GUIRunThread::makeStep(), and MSNet::simulate().
|
inline |
Definition at line 67 of file TraCIServer.h.
References myTargetTime.
Referenced by MSNet::simulationStep().
|
inline |
Definition at line 136 of file TraCIServer.h.
References myCurrentSocket, mySockets, and myVehicleStateChanges.
Referenced by TraCIServerAPI_Simulation::writeVehicleStateIDs(), and TraCIServerAPI_Simulation::writeVehicleStateNumber().
tcpip::Storage & TraCIServer::getWrapperStorage | ( | ) |
Definition at line 175 of file TraCIServer.cpp.
References myWrapperStorage.
Referenced by TraCIServerAPI_Edge::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_MultiEntryExit::processGet(), TraCIServerAPI_TrafficLight::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_LaneArea::processGet(), TraCIServerAPI_Lane::processGet(), and TraCIServerAPI_Junction::processGet().
|
private |
Definition at line 988 of file TraCIServer.cpp.
References libsumo::Subscription::beginTime, libsumo::Subscription::commandId, libsumo::Subscription::contextDomain, libsumo::Subscription::endTime, MSNet::getCurrentTimeStep(), MSNet::getInstance(), libsumo::Subscription::id, isVehicleToVehicleContextSubscription(), myLastContextSubscription, myOutputStorage, mySubscriptionCache, mySubscriptions, libsumo::Subscription::parameters, processSingleSubscription(), libsumo::Subscription::range, tcpip::Storage::readByte(), tcpip::Storage::readInt(), tcpip::Storage::reset(), libsumo::RTYPE_ERR, libsumo::RTYPE_OK, tcpip::Storage::size(), tcpip::Storage::valid_pos(), libsumo::Subscription::variables, tcpip::Storage::writeByte(), tcpip::Storage::writeInt(), writeStatusCmd(), and tcpip::Storage::writeStorage().
Referenced by addObjectVariableSubscription().
void TraCIServer::initWrapper | ( | const int | domainID, |
const int | variable, | ||
const std::string & | objID | ||
) |
Definition at line 103 of file TraCIServer.cpp.
References myWrapperStorage, tcpip::Storage::reset(), tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
Referenced by TraCIServerAPI_Edge::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_MultiEntryExit::processGet(), TraCIServerAPI_TrafficLight::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_LaneArea::processGet(), TraCIServerAPI_Lane::processGet(), and TraCIServerAPI_Junction::processGet().
|
private |
Definition at line 1072 of file TraCIServer.cpp.
References libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::CMD_SUBSCRIBE_VEHICLE_CONTEXT, libsumo::Subscription::commandId, and libsumo::Subscription::contextDomain.
Referenced by initialiseSubscription().
|
private |
get the minimal next target time among all clients
Definition at line 444 of file TraCIServer.cpp.
References MIN2(), and mySockets.
Referenced by processCommandsUntilSimStep().
|
static |
Initialises the server.
[in] | execs | The (additional) command executors to use |
Definition at line 284 of file TraCIServer.cpp.
References MSNet::addVehicleStateListener(), MSNet::getInstance(), OptionsCont::getOptions(), myDoCloseConnection, myExecutors, myInstance, mySubscriptionCache, string2time(), TraCIServer(), and tcpip::Storage::writeInt().
Referenced by NLBuilder::init(), and GUILoadThread::run().
|
private |
Invalidated assignment operator.
|
private |
Handles subscriptions to send after a simstep2 command.
Definition at line 881 of file TraCIServer.cpp.
References libsumo::Subscription::beginTime, libsumo::CMD_SIMSTEP, libsumo::CMD_SUBSCRIBE_PERSON_CONTEXT, libsumo::CMD_SUBSCRIBE_PERSON_VARIABLE, libsumo::CMD_SUBSCRIBE_VEHICLE_CONTEXT, libsumo::CMD_SUBSCRIBE_VEHICLE_VARIABLE, libsumo::Subscription::commandId, libsumo::Subscription::endTime, MSTransportableControl::get(), MSNet::getCurrentTimeStep(), MSNet::getInstance(), MSNet::getPersonControl(), libsumo::Subscription::id, myOutputStorage, mySubscriptionCache, mySubscriptions, myVehicleStateChanges, processSingleSubscription(), tcpip::Storage::reset(), libsumo::RTYPE_OK, tcpip::Storage::size(), MSNet::VEHICLE_STATE_ARRIVED, tcpip::Storage::writeInt(), writeStatusCmd(), and tcpip::Storage::writeStorage().
Referenced by processCommandsUntilSimStep().
void TraCIServer::processCommandsUntilSimStep | ( | SUMOTime | step | ) |
process all commands until the next SUMO simulation step. It is guaranteed that t->getTargetTime() >= myStep after call (except the case that a load or close command is received)s
Definition at line 490 of file TraCIServer.cpp.
References libsumo::CMD_CLOSE, libsumo::CMD_LOAD, libsumo::CMD_SIMSTEP, dispatchCommand(), MSNet::getInstance(), myCurrentSocket, myDoCloseConnection, myInputStorage, myLoadArgs, myOutputStorage, mySockets, myTargetTime, myVehicleStateChanges, nextTargetTime(), postProcessSimulationStep(), processReorderingRequests(), removeCurrentSocket(), tcpip::Storage::reset(), sendOutputToAll(), SIMTIME, tcpip::Storage::size(), and tcpip::Storage::valid_pos().
Referenced by MSNet::simulationStep().
|
private |
checks for and processes reordering requests (relevant for multiple clients)
Definition at line 400 of file TraCIServer.cpp.
References mySocketReorderRequests, mySockets, and SIMTIME.
Referenced by processCommandsUntilSimStep().
|
private |
Definition at line 1078 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, libsumo::Helper::applySubscriptionFilters(), libsumo::Helper::collectObjectsInRange(), libsumo::Subscription::commandId, libsumo::Subscription::contextDomain, libsumo::Helper::findObjectShape(), libsumo::Subscription::id, myExecutors, libsumo::Subscription::parameters, libsumo::Subscription::range, tcpip::Storage::readInt(), tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), libsumo::RTYPE_ERR, libsumo::RTYPE_NOTIMPLEMENTED, libsumo::RTYPE_OK, tcpip::Storage::size(), libsumo::SUBS_FILTER_NO_RTREE, libsumo::TRACI_ID_LIST, libsumo::TYPE_STRING, libsumo::Subscription::variables, tcpip::Storage::writeInt(), tcpip::Storage::writePacket(), writeStatusCmd(), tcpip::Storage::writeStorage(), tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
Referenced by initialiseSubscription(), and postProcessSimulationStep().
|
private |
Reads the next command ID from the input storage.
[out] | the | version with reference parameters provides information on the command start position and length used in dispatchCommand for checking purposes |
Definition at line 696 of file TraCIServer.cpp.
References tcpip::Storage::begin(), tcpip::Storage::end(), myInputStorage, tcpip::Storage::position(), tcpip::Storage::readInt(), and tcpip::Storage::readUnsignedByte().
Referenced by checkClientOrdering(), and dispatchCommand().
bool TraCIServer::readTypeCheckingByte | ( | tcpip::Storage & | inputStorage, |
int & | into | ||
) |
Reads the value type and a byte, verifying the type.
[in,changed] | inputStorage The storage to read from | |
[out] | into | Holder of the read value |
Definition at line 1471 of file TraCIServer.cpp.
References tcpip::Storage::readByte(), and libsumo::TYPE_BYTE.
Referenced by TraCIServerAPI_Vehicle::processSet(), and TraCIServerAPI_Person::processSet().
bool TraCIServer::readTypeCheckingColor | ( | tcpip::Storage & | inputStorage, |
libsumo::TraCIColor & | into | ||
) |
Reads the value type and a color, verifying the type.
[in,changed] | inputStorage The storage to read from | |
[out] | into | Holder of the read value |
Definition at line 1446 of file TraCIServer.cpp.
References libsumo::TraCIColor::a, libsumo::TraCIColor::b, libsumo::TraCIColor::g, libsumo::TraCIColor::r, tcpip::Storage::readUnsignedByte(), and libsumo::TYPE_COLOR.
Referenced by TraCIServerAPI_POI::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_Person::processSet(), and TraCIServerAPI_VehicleType::setVariable().
bool TraCIServer::readTypeCheckingDouble | ( | tcpip::Storage & | inputStorage, |
double & | into | ||
) |
Reads the value type and a double, verifying the type.
[in,changed] | inputStorage The storage to read from | |
[out] | into | Holder of the read value |
Definition at line 1406 of file TraCIServer.cpp.
References tcpip::Storage::readDouble(), tcpip::Storage::readUnsignedByte(), and libsumo::TYPE_DOUBLE.
Referenced by TraCIServerAPI_Edge::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Edge::processSet(), TraCIServerAPI_TrafficLight::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_GUI::processSet(), TraCIServerAPI_Person::processSet(), TraCIServerAPI_Lane::processSet(), TraCIServerAPI_Simulation::readStage(), and TraCIServerAPI_VehicleType::setVariable().
bool TraCIServer::readTypeCheckingDoubleList | ( | tcpip::Storage & | inputStorage, |
std::vector< double > & | into | ||
) |
Reads the value type and a double list, verifying the type.
[in,changed] | inputStorage The storage to read from | |
[out] | into | Holder of the read value |
Definition at line 1436 of file TraCIServer.cpp.
References tcpip::Storage::readDoubleList(), tcpip::Storage::readUnsignedByte(), and libsumo::TYPE_DOUBLELIST.
Referenced by TraCIServerAPI_Polygon::processSet().
bool TraCIServer::readTypeCheckingInt | ( | tcpip::Storage & | inputStorage, |
int & | into | ||
) |
Reads the value type and an int, verifying the type.
[in,changed] | inputStorage The storage to read from | |
[out] | into | Holder of the read value |
Definition at line 1396 of file TraCIServer.cpp.
References tcpip::Storage::readInt(), tcpip::Storage::readUnsignedByte(), and libsumo::TYPE_INTEGER.
Referenced by TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_TrafficLight::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_GUI::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_Person::processSet(), and TraCIServerAPI_Simulation::readStage().
bool TraCIServer::readTypeCheckingPolygon | ( | tcpip::Storage & | inputStorage, |
PositionVector & | into | ||
) |
Reads the value type and a polygon, verifying the type.
[in,changed] | inputStorage The storage to read from | |
[out] | into | Holder of the read value |
Definition at line 1491 of file TraCIServer.cpp.
References tcpip::Storage::readDouble(), tcpip::Storage::readInt(), tcpip::Storage::readUnsignedByte(), and libsumo::TYPE_POLYGON.
Referenced by TraCIServerAPI_Polygon::processSet(), and TraCIServerAPI_GUI::processSet().
bool TraCIServer::readTypeCheckingPosition2D | ( | tcpip::Storage & | inputStorage, |
libsumo::TraCIPosition & | into | ||
) |
Reads the value type and a 2D position, verifying the type.
[in,changed] | inputStorage The storage to read from | |
[out] | into | Holder of the read value |
Definition at line 1459 of file TraCIServer.cpp.
References libsumo::POSITION_2D, tcpip::Storage::readDouble(), tcpip::Storage::readUnsignedByte(), libsumo::TraCIPosition::x, libsumo::TraCIPosition::y, and libsumo::TraCIPosition::z.
Referenced by TraCIServerAPI_POI::processSet(), and TraCIServerAPI_GUI::processSet().
bool TraCIServer::readTypeCheckingString | ( | tcpip::Storage & | inputStorage, |
std::string & | into | ||
) |
Reads the value type and a string, verifying the type.
[in,changed] | inputStorage The storage to read from | |
[out] | into | Holder of the read value |
Definition at line 1416 of file TraCIServer.cpp.
References tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), and libsumo::TYPE_STRING.
Referenced by TraCIServerAPI_Edge::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_TrafficLight::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_Edge::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_TrafficLight::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_Route::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_GUI::processSet(), TraCIServerAPI_Simulation::processSet(), TraCIServerAPI_Person::processSet(), TraCIServerAPI_Lane::processSet(), TraCIServerAPI_Simulation::readStage(), and TraCIServerAPI_VehicleType::setVariable().
bool TraCIServer::readTypeCheckingStringList | ( | tcpip::Storage & | inputStorage, |
std::vector< std::string > & | into | ||
) |
Reads the value type and a string list, verifying the type.
[in,changed] | inputStorage The storage to read from | |
[out] | into | Holder of the read value |
Definition at line 1426 of file TraCIServer.cpp.
References tcpip::Storage::readStringList(), tcpip::Storage::readUnsignedByte(), and libsumo::TYPE_STRINGLIST.
Referenced by dispatchCommand(), TraCIServerAPI_Edge::processSet(), TraCIServerAPI_Route::processSet(), TraCIServerAPI_TrafficLight::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_Person::processSet(), TraCIServerAPI_Lane::processSet(), and TraCIServerAPI_Simulation::readStage().
bool TraCIServer::readTypeCheckingUnsignedByte | ( | tcpip::Storage & | inputStorage, |
int & | into | ||
) |
Reads the value type and an unsigned byte, verifying the type.
[in,changed] | inputStorage The storage to read from | |
[out] | into | Holder of the read value |
Definition at line 1481 of file TraCIServer.cpp.
References tcpip::Storage::readUnsignedByte(), and libsumo::TYPE_UBYTE.
Referenced by TraCIServerAPI_Simulation::commandPositionConversion(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_POI::processSet(), and TraCIServerAPI_Vehicle::processSet().
|
private |
removes myCurrentSocket from mySockets and returns an iterator pointing to the next member according to the ordering
Definition at line 666 of file TraCIServer.cpp.
References myCurrentSocket, and mySockets.
Referenced by processCommandsUntilSimStep().
|
private |
Definition at line 1291 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, myLastContextSubscription, and libsumo::SUBS_FILTER_NONE.
Referenced by addSubscriptionFilter().
|
private |
Definition at line 1048 of file TraCIServer.cpp.
References myLastContextSubscription, mySubscriptions, libsumo::RTYPE_ERR, libsumo::RTYPE_OK, and writeStatusCmd().
Referenced by addObjectVariableSubscription().
|
private |
send out subscription results (actually just the content of myOutputStorage) to clients which will act in this step (i.e. with client target time <= myTargetTime)
Definition at line 468 of file TraCIServer.cpp.
References MSNet::getCurrentTimeStep(), MSNet::getInstance(), myOutputStorage, and mySockets.
Referenced by processCommandsUntilSimStep().
|
private |
sends an empty response to a simstep command to the current client. (This applies to a situation where the TraCI step frequency is higher than the SUMO step frequency)
Definition at line 940 of file TraCIServer.cpp.
References libsumo::CMD_SIMSTEP, myCurrentSocket, myOutputStorage, mySubscriptionCache, tcpip::Storage::reset(), libsumo::RTYPE_OK, tcpip::Storage::size(), writeStatusCmd(), and tcpip::Storage::writeStorage().
Referenced by dispatchCommand().
|
inlinevirtualinherited |
Reimplemented in libsumo::Helper::SubscriptionWrapper.
Definition at line 120 of file Subscription.h.
void TraCIServer::setTargetTime | ( | SUMOTime | targetTime | ) |
Sets myTargetTime on server and sockets to the given value.
Definition at line 1514 of file TraCIServer.cpp.
References mySockets, and myTargetTime.
Referenced by NLBuilder::build().
|
virtual |
Called if a vehicle changes its state.
[in] | vehicle | The vehicle which changed its state |
[in] | to | The state the vehicle has changed to |
[in] | info | Additional information on the state change |
Implements MSNet::VehicleStateListener.
Definition at line 322 of file TraCIServer.cpp.
References SUMOTrafficObject::getID(), myDoCloseConnection, mySockets, and myVehicleStateChanges.
|
static |
check whether close was requested
Definition at line 313 of file TraCIServer.cpp.
References myDoCloseConnection.
Referenced by GUIRunThread::makeStep(), MSNet::simulate(), MSNet::simulationState(), and MSNet::simulationStep().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 157 of file TraCIServer.cpp.
References libsumo::TraCIColor::a, libsumo::TraCIColor::b, libsumo::TraCIColor::g, myWrapperStorage, libsumo::TraCIColor::r, libsumo::TYPE_COLOR, and tcpip::Storage::writeUnsignedByte().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 112 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::TYPE_DOUBLE, tcpip::Storage::writeDouble(), and tcpip::Storage::writeUnsignedByte().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 120 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::TYPE_INTEGER, tcpip::Storage::writeInt(), and tcpip::Storage::writeUnsignedByte().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 144 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::POSITION_2D, libsumo::POSITION_3D, libsumo::VAR_POSITION3D, tcpip::Storage::writeDouble(), tcpip::Storage::writeUnsignedByte(), libsumo::TraCIPosition::x, libsumo::TraCIPosition::y, and libsumo::TraCIPosition::z.
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 168 of file TraCIServer.cpp.
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 128 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::TYPE_STRING, tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 136 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::TYPE_STRINGLIST, tcpip::Storage::writeStringList(), and tcpip::Storage::writeUnsignedByte().
Referenced by TraCIServerAPI_Simulation::processGet().
bool TraCIServer::writeErrorStatusCmd | ( | int | commandId, |
const std::string & | description, | ||
tcpip::Storage & | outputStorage | ||
) |
Writes a status command to the given storage with status = RTYPE_ERR.
[in] | commandId | The id of the command to respond to |
[in] | description | The status description (error message, for example) |
[in,filled] | outputStorage The storage to write the status into |
Definition at line 981 of file TraCIServer.cpp.
References libsumo::RTYPE_ERR, and writeStatusCmd().
Referenced by dispatchCommand(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_MultiEntryExit::processGet(), TraCIServerAPI_TrafficLight::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_LaneArea::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_Edge::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_VehicleType::processSet(), TraCIServerAPI_Route::processSet(), TraCIServerAPI_TrafficLight::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_GUI::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_Simulation::processSet(), TraCIServerAPI_Person::processSet(), TraCIServerAPI_Lane::processSet(), and TraCIServerAPI_VehicleType::setVariable().
void TraCIServer::writePositionVector | ( | tcpip::Storage & | outputStorage, |
const libsumo::TraCIPositionVector & | shape | ||
) |
Definition at line 1380 of file TraCIServer.cpp.
References libsumo::TYPE_POLYGON, tcpip::Storage::writeDouble(), tcpip::Storage::writeInt(), and tcpip::Storage::writeUnsignedByte().
Referenced by TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Lane::processGet(), and TraCIServerAPI_Junction::processGet().
void TraCIServer::writeResponseWithLength | ( | tcpip::Storage & | outputStorage, |
tcpip::Storage & | tempMsg | ||
) |
Definition at line 1368 of file TraCIServer.cpp.
References tcpip::Storage::size(), tcpip::Storage::writeInt(), tcpip::Storage::writeStorage(), and tcpip::Storage::writeUnsignedByte().
Referenced by TraCIServerAPI_Edge::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_TrafficLight::processGet(), TraCIServerAPI_MultiEntryExit::processGet(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_LaneArea::processGet(), TraCIServerAPI_Lane::processGet(), and TraCIServerAPI_Junction::processGet().
void TraCIServer::writeStatusCmd | ( | int | commandId, |
int | status, | ||
const std::string & | description | ||
) |
Writes a status command to myOutputStorage.
[in] | commandId | The id of the command to respond to |
[in] | status | The status to send |
[in] | description | The status description (error message, for example) |
Definition at line 961 of file TraCIServer.cpp.
References myOutputStorage, and writeStatusCmd().
void TraCIServer::writeStatusCmd | ( | int | commandId, |
int | status, | ||
const std::string & | description, | ||
tcpip::Storage & | outputStorage | ||
) |
Writes a status command to the given storage.
[in] | commandId | The id of the command to respond to |
[in] | status | The status to send |
[in] | description | The status description (error message, for example) |
[in,filled] | outputStorage The storage to write the status into |
Definition at line 967 of file TraCIServer.cpp.
References libsumo::RTYPE_ERR, libsumo::RTYPE_NOTIMPLEMENTED, toHex(), WRITE_ERROR, tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
Referenced by addSubscriptionFilter(), TraCIServerAPI_Simulation::commandDistanceRequest(), commandGetVersion(), TraCIServerAPI_Simulation::commandPositionConversion(), dispatchCommand(), initialiseSubscription(), postProcessSimulationStep(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_TrafficLight::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_MultiEntryExit::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_LaneArea::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_Edge::processSet(), TraCIServerAPI_TrafficLight::processSet(), TraCIServerAPI_VehicleType::processSet(), TraCIServerAPI_Route::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_GUI::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_Simulation::processSet(), TraCIServerAPI_Person::processSet(), TraCIServerAPI_Lane::processSet(), processSingleSubscription(), removeSubscription(), sendSingleSimStepResponse(), writeErrorStatusCmd(), and writeStatusCmd().
|
inherited |
Definition at line 119 of file Subscription.h.
|
private |
The currently active client socket.
Definition at line 359 of file TraCIServer.h.
Referenced by checkClientOrdering(), cleanup(), dispatchCommand(), getVehicleStateChanges(), processCommandsUntilSimStep(), removeCurrentSocket(), sendSingleSimStepResponse(), TraCIServer(), and ~TraCIServer().
|
staticprivate |
Whether the connection was set to be to close.
Definition at line 346 of file TraCIServer.h.
Referenced by close(), dispatchCommand(), openSocket(), processCommandsUntilSimStep(), TraCIServer(), vehicleStateChanged(), and wasClosed().
|
private |
Map of commandIds -> their executors; applicable if the executor applies to the method footprint.
Definition at line 377 of file TraCIServer.h.
Referenced by dispatchCommand(), openSocket(), processSingleSubscription(), and TraCIServer().
|
private |
The storage to read from.
Definition at line 365 of file TraCIServer.h.
Referenced by addObjectVariableSubscription(), addSubscriptionFilter(), checkClientOrdering(), cleanup(), dispatchCommand(), processCommandsUntilSimStep(), and readCommandID().
|
staticprivate |
Singleton instance of the server.
Definition at line 343 of file TraCIServer.h.
Referenced by close(), getInstance(), and openSocket().
|
private |
The last modified context subscription (the one to add a filter to, see @addSubscriptionFilter(), currently only for vehicle to vehicle context)
Definition at line 388 of file TraCIServer.h.
Referenced by addSubscriptionFilter(), addSubscriptionFilterDownstreamDistance(), addSubscriptionFilterLanes(), addSubscriptionFilterLeadFollow(), addSubscriptionFilterNoOpposite(), addSubscriptionFilterTurn(), addSubscriptionFilterUpstreamDistance(), addSubscriptionFilterVClass(), addSubscriptionFilterVType(), initialiseSubscription(), removeFilters(), and removeSubscription().
|
private |
Definition at line 382 of file TraCIServer.h.
Referenced by dispatchCommand(), getLoadArgs(), and processCommandsUntilSimStep().
|
private |
The storage to write to.
Definition at line 368 of file TraCIServer.h.
Referenced by checkClientOrdering(), cleanup(), commandGetVersion(), dispatchCommand(), initialiseSubscription(), postProcessSimulationStep(), processCommandsUntilSimStep(), sendOutputToAll(), sendSingleSimStepResponse(), and writeStatusCmd().
|
private |
Map of variable ids to the size of the parameter in bytes.
Definition at line 380 of file TraCIServer.h.
Referenced by addObjectVariableSubscription(), and TraCIServer().
|
private |
The server socket.
Definition at line 349 of file TraCIServer.h.
Referenced by TraCIServer(), and ~TraCIServer().
|
private |
This stores the setOrder(int) requests of the clients.
Definition at line 356 of file TraCIServer.h.
Referenced by dispatchCommand(), and processReorderingRequests().
|
private |
The socket connections to the clients the first component (index) determines the client's order (lowest index's commands are processed first),.
Definition at line 353 of file TraCIServer.h.
Referenced by checkClientOrdering(), cleanup(), dispatchCommand(), getVehicleStateChanges(), nextTargetTime(), processCommandsUntilSimStep(), processReorderingRequests(), removeCurrentSocket(), sendOutputToAll(), setTargetTime(), TraCIServer(), vehicleStateChanged(), and ~TraCIServer().
|
private |
The last timestep's subscription results.
Definition at line 374 of file TraCIServer.h.
Referenced by cleanup(), initialiseSubscription(), openSocket(), postProcessSimulationStep(), and sendSingleSimStepResponse().
|
private |
The list of known, still valid subscriptions.
Definition at line 385 of file TraCIServer.h.
Referenced by cleanup(), initialiseSubscription(), postProcessSimulationStep(), and removeSubscription().
|
private |
The time step to reach until processing the next commands.
Definition at line 362 of file TraCIServer.h.
Referenced by cleanup(), getTargetTime(), processCommandsUntilSimStep(), and setTargetTime().
|
private |
Changes in the states of simulated vehicles.
Definition at line 397 of file TraCIServer.h.
Referenced by cleanup(), getVehicleStateChanges(), postProcessSimulationStep(), processCommandsUntilSimStep(), TraCIServer(), and vehicleStateChanged().
|
private |
A temporary storage to let the wrapper write to.
Definition at line 371 of file TraCIServer.h.
Referenced by getWrapperStorage(), initWrapper(), wrapColor(), wrapDouble(), wrapInt(), wrapPosition(), wrapString(), and wrapStringList().