![]() |
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. | |
typedef bool(* | SubscriptionHandler) (const std::string &objID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData) |
Definition of a method to be called for serving an associated commandID. | |
Public Member Functions | |
void | cleanup () |
clean up subscriptions | |
virtual void | clear () |
virtual void | empty (const std::string &) |
std::vector< std::string > & | getLoadArgs () |
SUMOTime | getTargetTime () const |
const std::map< MSNet::TransportableState, std::vector< std::string > > & | getTransportableStateChanges () const |
const std::map< MSNet::VehicleState, std::vector< std::string > > & | getVehicleStateChanges () const |
int | processCommands (const SUMOTime step, const bool afterMove=false) |
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 | |
virtual void | setContext (const std::string *const) |
void | stateLoaded (SUMOTime targetTime) |
updates myTargetTime and resets vehicle state changes after loading a simulation state | |
void | transportableStateChanged (const MSTransportable *const transportable, MSNet::TransportableState to, const std::string &info="") |
Called if a transportable changes its state. | |
void | vehicleStateChanged (const SUMOVehicle *const vehicle, MSNet::VehicleState to, const std::string &info="") |
Called if a vehicle changes its state. | |
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. | |
void | writeStatusCmd (int commandId, int status, const std::string &description) |
Writes a status command to myOutputStorage. | |
bool | writeErrorStatusCmd (int commandId, const std::string &description, tcpip::Storage &outputStorage) |
Writes a status command to the given storage with status = RTYPE_ERR. | |
Helpers for reading and checking values | |
bool | readTypeCheckingDouble (tcpip::Storage &inputStorage, double &into) |
Reads the value type and a double, verifying the type. | |
bool | readTypeCheckingString (tcpip::Storage &inputStorage, std::string &into) |
Reads the value type and a string, verifying the type. | |
bool | readTypeCheckingStringList (tcpip::Storage &inputStorage, std::vector< std::string > &into) |
Reads the value type and a string list, verifying the type. | |
bool | readTypeCheckingDoubleList (tcpip::Storage &inputStorage, std::vector< double > &into) |
Reads the value type and a double list, verifying the type. | |
bool | readTypeCheckingColor (tcpip::Storage &inputStorage, libsumo::TraCIColor &into) |
Reads the value type and a color, verifying the type. | |
bool | readTypeCheckingPosition2D (tcpip::Storage &inputStorage, libsumo::TraCIPosition &into) |
Reads the value type and a 2D position, verifying the type. | |
bool | readTypeCheckingByte (tcpip::Storage &inputStorage, int &into) |
Reads the value type and a byte, verifying the type. | |
bool | readTypeCheckingUnsignedByte (tcpip::Storage &inputStorage, int &into) |
Reads the value type and an unsigned byte, verifying the type. | |
bool | readTypeCheckingPolygon (tcpip::Storage &inputStorage, PositionVector &into) |
Reads the value type and a polygon, verifying the type. | |
VariableWrapper interface | |
void | initWrapper (const int domainID, const int variable, const std::string &objID) |
bool | wrapConnectionVector (const std::string &objID, const int variable, const std::vector< libsumo::TraCIConnection > &value) |
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 | wrapDoubleList (const std::string &objID, const int variable, const std::vector< double > &value) |
bool | wrapPosition (const std::string &objID, const int variable, const libsumo::TraCIPosition &value) |
bool | wrapPositionVector (const std::string &objID, const int variable, const libsumo::TraCIPositionVector &value) |
bool | wrapColor (const std::string &objID, const int variable, const libsumo::TraCIColor &value) |
bool | wrapStringDoublePair (const std::string &objID, const int variable, const std::pair< std::string, double > &value) |
bool | wrapStringDoublePairList (const std::string &objID, const int variable, const std::vector< std::pair< std::string, double > > &value) |
bool | wrapStringPair (const std::string &objID, const int variable, const std::pair< std::string, std::string > &value) |
bool | wrapIntPair (const std::string &objID, const int variable, const std::pair< int, int > &value) |
bool | wrapStage (const std::string &objID, const int variable, const libsumo::TraCIStage &value) |
bool | wrapReservationVector (const std::string &objID, const int variable, const std::vector< libsumo::TraCIReservation > &value) |
bool | wrapLogicVector (const std::string &objID, const int variable, const std::vector< libsumo::TraCILogic > &value) |
bool | wrapLinkVectorVector (const std::string &objID, const int variable, const std::vector< std::vector< libsumo::TraCILink > > &value) |
bool | wrapSignalConstraintVector (const std::string &objID, const int variable, const std::vector< libsumo::TraCISignalConstraint > &value) |
bool | wrapJunctionFoeVector (const std::string &objID, const int variable, const std::vector< libsumo::TraCIJunctionFoe > &value) |
bool | wrapNextStopDataVector (const std::string &objID, const int variable, const std::vector< libsumo::TraCINextStopData > &value) |
bool | wrapVehicleDataVector (const std::string &objID, const int variable, const std::vector< libsumo::TraCIVehicleData > &value) |
bool | wrapBestLanesDataVector (const std::string &objID, const int variable, const std::vector< libsumo::TraCIBestLanesData > &value) |
bool | wrapNextTLSDataVector (const std::string &objID, const int variable, const std::vector< libsumo::TraCINextTLSData > &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. | |
static void | close () |
request termination of connection | |
static bool | wasClosed () |
check whether close was requested | |
Data Fields | |
SubscriptionHandler | handle |
Private Member Functions | |
bool | addObjectVariableSubscription (const int commandId, const bool hasContext) |
bool | addSubscriptionFilter () |
void | addSubscriptionFilterDownstreamDistance (double dist) |
void | addSubscriptionFilterFieldOfVision (double openingAngle) |
Filter only vehicles within field of vision. | |
void | addSubscriptionFilterLanes (std::vector< int > lanes) |
void | addSubscriptionFilterLateralDistance (double dist) |
Filter only vehicles within the given lateral distance. | |
void | addSubscriptionFilterLeadFollow () |
void | addSubscriptionFilterNoOpposite () |
void | addSubscriptionFilterTurn (double dist) |
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 | |
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()). | |
int | dispatchCommand () |
Handles command, writes response to myOutputStorage. | |
void | initialiseSubscription (libsumo::Subscription &s) |
SUMOTime | nextTargetTime () const |
get the minimal next target time among all clients | |
TraCIServer & | operator= (const TraCIServer &s)=delete |
Invalidated assignment operator. | |
void | processReorderingRequests () |
checks for and processes reordering requests (relevant for multiple clients) | |
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. | |
std::map< int, SocketInfo * >::iterator | removeCurrentSocket () |
removes myCurrentSocket from mySockets and returns an iterator pointing to the next member according to the ordering | |
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) | |
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) | |
TraCIServer (const SUMOTime begin, const int port, const int numClients) | |
Constructor. | |
virtual | ~TraCIServer () |
Destructor. | |
Server-internal command handling | |
bool | commandGetVersion () |
Returns the TraCI-version. | |
void | postProcessSimulationStep () |
Handles subscriptions to send after a simstep2 command. | |
Private Attributes | |
std::map< int, SocketInfo * >::iterator | myCurrentSocket |
The currently active client socket. | |
std::map< int, CmdExecutor > | myExecutors |
Map of commandIds -> their executors; applicable if the executor applies to the method footprint. | |
tcpip::Storage | myInputStorage |
The storage to read from. | |
libsumo::Subscription * | myLastContextSubscription |
The last modified context subscription (the one to add a filter to, see @addSubscriptionFilter(), currently only for vehicle to vehicle context) | |
std::vector< std::string > | myLoadArgs |
tcpip::Storage | myOutputStorage |
The storage to write to. | |
std::set< std::pair< int, int > > | myParameterized |
Set of variables which have parameters. | |
std::map< int, SocketInfo * > | mySocketReorderRequests |
This stores the setOrder(int) requests of the clients. | |
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),. | |
tcpip::Storage | mySubscriptionCache |
The last timestep's subscription results. | |
std::vector< libsumo::Subscription > | mySubscriptions |
The list of known, still valid subscriptions. | |
SUMOTime | myTargetTime |
The time step to reach until processing the next commands. | |
std::map< MSNet::TransportableState, std::vector< std::string > > | myTransportableStateChanges |
Changes in the states of simulated transportables. | |
std::map< MSNet::VehicleState, std::vector< std::string > > | myVehicleStateChanges |
Changes in the states of simulated vehicles. | |
tcpip::Storage | myWrapperStorage |
A temporary storage to let the wrapper write to. | |
Static Private Attributes | |
static bool | myDoCloseConnection = false |
Whether the connection was set to be to close. | |
static TraCIServer * | myInstance = nullptr |
Singleton instance of the server. | |
TraCI server used to control sumo by a remote TraCI client.
Definition at line 59 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 62 of file TraCIServer.h.
|
inherited |
Definition of a method to be called for serving an associated commandID.
Definition at line 153 of file Subscription.h.
|
private |
Constructor.
[in] | port | The port to listen to (to open) |
Definition at line 445 of file TraCIServer.cpp.
References tcpip::Socket::accept(), MSNet::ARRIVED, MSNet::BUILT, checkClientOrdering(), libsumo::CMD_CHANGELANE, libsumo::CMD_GET_BUSSTOP_VARIABLE, libsumo::CMD_GET_CALIBRATOR_VARIABLE, libsumo::CMD_GET_CHARGINGSTATION_VARIABLE, 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_MEANDATA_VARIABLE, libsumo::CMD_GET_MULTIENTRYEXIT_VARIABLE, libsumo::CMD_GET_OVERHEADWIRE_VARIABLE, libsumo::CMD_GET_PARKINGAREA_VARIABLE, libsumo::CMD_GET_PERSON_VARIABLE, libsumo::CMD_GET_POI_VARIABLE, libsumo::CMD_GET_POLYGON_VARIABLE, libsumo::CMD_GET_REROUTER_VARIABLE, libsumo::CMD_GET_ROUTE_VARIABLE, libsumo::CMD_GET_ROUTEPROBE_VARIABLE, libsumo::CMD_GET_SIM_VARIABLE, libsumo::CMD_GET_TL_VARIABLE, libsumo::CMD_GET_VARIABLESPEEDSIGN_VARIABLE, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::CMD_SET_BUSSTOP_VARIABLE, libsumo::CMD_SET_CALIBRATOR_VARIABLE, libsumo::CMD_SET_CHARGINGSTATION_VARIABLE, libsumo::CMD_SET_EDGE_VARIABLE, libsumo::CMD_SET_INDUCTIONLOOP_VARIABLE, libsumo::CMD_SET_JUNCTION_VARIABLE, libsumo::CMD_SET_LANE_VARIABLE, libsumo::CMD_SET_LANEAREA_VARIABLE, libsumo::CMD_SET_MULTIENTRYEXIT_VARIABLE, libsumo::CMD_SET_OVERHEADWIRE_VARIABLE, libsumo::CMD_SET_PARKINGAREA_VARIABLE, libsumo::CMD_SET_PERSON_VARIABLE, libsumo::CMD_SET_POI_VARIABLE, libsumo::CMD_SET_POLYGON_VARIABLE, libsumo::CMD_SET_REROUTER_VARIABLE, libsumo::CMD_SET_ROUTE_VARIABLE, libsumo::CMD_SET_ROUTEPROBE_VARIABLE, libsumo::CMD_SET_SIM_VARIABLE, libsumo::CMD_SET_TL_VARIABLE, libsumo::CMD_SET_VARIABLESPEEDSIGN_VARIABLE, libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::CMD_SUBSCRIBE_EDGE_VARIABLE, libsumo::CMD_SUBSCRIBE_LANE_VARIABLE, libsumo::CMD_SUBSCRIBE_PERSON_VARIABLE, libsumo::CMD_SUBSCRIBE_TL_VARIABLE, libsumo::CMD_SUBSCRIBE_VEHICLE_VARIABLE, MSNet::COLLISION, MSNet::CONTAINER_ARRIVED, MSNet::CONTAINER_DEPARTED, MSNet::DEPARTED, libsumo::DISTANCE_REQUEST, MSNet::EMERGENCYSTOP, MSNet::ENDING_PARKING, MSNet::ENDING_STOP, MSNet::ENDING_TELEPORT, MsgHandler::getWarningInstance(), MSGlobals::gUseMesoSim, MSGlobals::gUsingInternalLanes, MsgHandler::inform(), libsumo::LANE_CHANGES, MSNet::MANEUVERING, libsumo::MAX_ORDER, myCurrentSocket, myDoCloseConnection, myExecutors, myParameterized, mySockets, myTransportableStateChanges, myVehicleStateChanges, MSNet::NEWROUTE, MSNet::PERSON_ARRIVED, MSNet::PERSON_DEPARTED, TraCIServerAPI_BusStop::processGet(), TraCIServerAPI_Calibrator::processGet(), TraCIServerAPI_ChargingStation::processGet(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_LaneArea::processGet(), TraCIServerAPI_MeanData::processGet(), TraCIServerAPI_MultiEntryExit::processGet(), TraCIServerAPI_OverheadWire::processGet(), TraCIServerAPI_ParkingArea::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Rerouter::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_RouteProbe::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_TrafficLight::processGet(), TraCIServerAPI_VariableSpeedSign::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_BusStop::processSet(), TraCIServerAPI_Calibrator::processSet(), TraCIServerAPI_ChargingStation::processSet(), TraCIServerAPI_Edge::processSet(), TraCIServerAPI_InductionLoop::processSet(), TraCIServerAPI_Junction::processSet(), TraCIServerAPI_Lane::processSet(), TraCIServerAPI_LaneArea::processSet(), TraCIServerAPI_MultiEntryExit::processSet(), TraCIServerAPI_OverheadWire::processSet(), TraCIServerAPI_ParkingArea::processSet(), TraCIServerAPI_Person::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_Rerouter::processSet(), TraCIServerAPI_Route::processSet(), TraCIServerAPI_RouteProbe::processSet(), TraCIServerAPI_Simulation::processSet(), TraCIServerAPI_TrafficLight::processSet(), TraCIServerAPI_VariableSpeedSign::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_VehicleType::processSet(), libsumo::SPLIT_TAXI_RESERVATIONS, MSNet::STARTING_PARKING, MSNet::STARTING_STOP, MSNet::STARTING_TELEPORT, TL, libsumo::TL_BLOCKING_VEHICLES, libsumo::TL_CONSTRAINT, libsumo::TL_CONSTRAINT_BYFOE, libsumo::TL_PRIORITY_VEHICLES, libsumo::TL_RIVAL_VEHICLES, toString(), libsumo::VAR_ANGLE, libsumo::VAR_EDGE_EFFORT, libsumo::VAR_EDGE_TRAVELTIME, libsumo::VAR_EDGES, libsumo::VAR_FOES, libsumo::VAR_FOLLOW_SPEED, libsumo::VAR_FOLLOWER, libsumo::VAR_LEADER, libsumo::VAR_NEIGHBORS, libsumo::VAR_NEXT_STOPS, libsumo::VAR_NEXT_STOPS2, libsumo::VAR_PARAMETER, libsumo::VAR_PARAMETER_WITH_KEY, libsumo::VAR_PERSON_NUMBER, libsumo::VAR_SECURE_GAP, libsumo::VAR_STAGE, libsumo::VAR_STOP_PARAMETER, libsumo::VAR_STOP_SPEED, libsumo::VAR_TAXI_FLEET, libsumo::VAR_TAXI_RESERVATIONS, WRITE_MESSAGE, WRITE_MESSAGEF, and WRITE_WARNING.
|
privatevirtual |
|
private |
Definition at line 1492 of file TraCIServer.cpp.
References libsumo::CMD_SUBSCRIBE_SIM_CONTEXT, libsumo::DISTANCE_REQUEST, initialiseSubscription(), libsumo::INVALID_DOUBLE_VALUE, myInputStorage, myParameterized, libsumo::POSITION_2D, libsumo::POSITION_3D, libsumo::POSITION_ROADMAP, tcpip::Storage::readByte(), tcpip::Storage::readDouble(), tcpip::Storage::readInt(), tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), removeSubscription(), libsumo::RTYPE_ERR, STEPS2TIME, SUMOTime_MAX, TIME2STEPS, toHex(), libsumo::TYPE_BYTE, libsumo::TYPE_COMPOUND, libsumo::TYPE_DOUBLE, libsumo::TYPE_INTEGER, libsumo::TYPE_STRING, libsumo::TYPE_UBYTE, tcpip::Storage::valid_pos(), and writeStatusCmd().
Referenced by dispatchCommand().
|
private |
Definition at line 1576 of file TraCIServer.cpp.
References addSubscriptionFilterDownstreamDistance(), addSubscriptionFilterFieldOfVision(), addSubscriptionFilterLanes(), addSubscriptionFilterLateralDistance(), addSubscriptionFilterLeadFollow(), addSubscriptionFilterNoOpposite(), addSubscriptionFilterTurn(), addSubscriptionFilterUpstreamDistance(), addSubscriptionFilterVClass(), addSubscriptionFilterVType(), libsumo::CMD_ADD_SUBSCRIPTION_FILTER, libsumo::FILTER_TYPE_DOWNSTREAM_DIST, libsumo::FILTER_TYPE_FIELD_OF_VISION, libsumo::FILTER_TYPE_LANES, libsumo::FILTER_TYPE_LATERAL_DIST, 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_ERR, libsumo::RTYPE_NOTIMPLEMENTED, libsumo::RTYPE_OK, toHex(), toString(), and writeStatusCmd().
Referenced by dispatchCommand().
|
private |
Definition at line 1697 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, libsumo::Subscription::filterDownstreamDist, myLastContextSubscription, libsumo::SUBS_FILTER_DOWNSTREAM_DIST, and toString().
Referenced by addSubscriptionFilter().
|
private |
Filter only vehicles within field of vision.
[in] | openingAngle | The opening angle of the circle sector |
Definition at line 1750 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, libsumo::Subscription::filterFieldOfVisionOpeningAngle, myLastContextSubscription, libsumo::SUBS_FILTER_FIELD_OF_VISION, and toString().
Referenced by addSubscriptionFilter().
|
private |
Definition at line 1680 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, libsumo::Subscription::filterLanes, myLastContextSubscription, libsumo::SUBS_FILTER_LANES, and toString().
Referenced by addSubscriptionFilter().
|
private |
Filter only vehicles within the given lateral distance.
[in] | dist | The lateral distance |
Definition at line 1759 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, libsumo::Subscription::filterLateralDist, myLastContextSubscription, libsumo::SUBS_FILTER_LATERAL_DIST, and toString().
Referenced by addSubscriptionFilter().
|
private |
Definition at line 1715 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, myLastContextSubscription, and libsumo::SUBS_FILTER_LEAD_FOLLOW.
Referenced by addSubscriptionFilter().
|
private |
Definition at line 1689 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, myLastContextSubscription, and libsumo::SUBS_FILTER_NOOPPOSITE.
Referenced by addSubscriptionFilter().
|
private |
Definition at line 1723 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, libsumo::Subscription::filterFoeDistToJunction, myLastContextSubscription, and libsumo::SUBS_FILTER_TURN.
Referenced by addSubscriptionFilter().
|
private |
Definition at line 1706 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 1732 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 1741 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 1922 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 676 of file TraCIServer.cpp.
References libsumo::CMD_GETVERSION, libsumo::CMD_SETORDER, dispatchCommand(), myCurrentSocket, myInputStorage, myOutputStorage, mySockets, readCommandID(), tcpip::Storage::reset(), TL, tcpip::Storage::writeStorage(), and tcpip::Storage::writeUnsignedByte().
Referenced by TraCIServer().
void TraCIServer::cleanup | ( | ) |
clean up subscriptions
Definition at line 946 of file TraCIServer.cpp.
References OptionsCont::getOptions(), myCurrentSocket, myInputStorage, myOutputStorage, mySockets, mySubscriptionCache, mySubscriptions, myTargetTime, myTransportableStateChanges, myVehicleStateChanges, tcpip::Storage::reset(), and string2time().
Referenced by MSNet::clearAll().
|
inlinevirtualinherited |
Reimplemented in libsumo::Helper::SubscriptionWrapper.
Definition at line 158 of file Subscription.h.
Referenced by libsumo::Helper::SubscriptionWrapper::clear().
|
static |
request termination of connection
Definition at line 634 of file TraCIServer.cpp.
References myDoCloseConnection, and myInstance.
Referenced by main().
|
private |
Returns the TraCI-version.
Definition at line 1184 of file TraCIServer.cpp.
References libsumo::CMD_GETVERSION, myOutputStorage, libsumo::RTYPE_OK, tcpip::Storage::size(), libsumo::TRACI_VERSION, 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 997 of file TraCIServer.cpp.
References addObjectVariableSubscription(), addSubscriptionFilter(), libsumo::CMD_ADD_SUBSCRIPTION_FILTER, libsumo::CMD_CLOSE, libsumo::CMD_EXECUTEMOVE, 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_BUSSTOP_CONTEXT, libsumo::CMD_SUBSCRIBE_BUSSTOP_VARIABLE, libsumo::CMD_SUBSCRIBE_CALIBRATOR_CONTEXT, libsumo::CMD_SUBSCRIBE_CALIBRATOR_VARIABLE, libsumo::CMD_SUBSCRIBE_CHARGINGSTATION_CONTEXT, libsumo::CMD_SUBSCRIBE_CHARGINGSTATION_VARIABLE, 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_MEANDATA_CONTEXT, libsumo::CMD_SUBSCRIBE_MEANDATA_VARIABLE, libsumo::CMD_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT, libsumo::CMD_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE, libsumo::CMD_SUBSCRIBE_OVERHEADWIRE_CONTEXT, libsumo::CMD_SUBSCRIBE_OVERHEADWIRE_VARIABLE, libsumo::CMD_SUBSCRIBE_PARKINGAREA_CONTEXT, libsumo::CMD_SUBSCRIBE_PARKINGAREA_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_REROUTER_CONTEXT, libsumo::CMD_SUBSCRIBE_REROUTER_VARIABLE, libsumo::CMD_SUBSCRIBE_ROUTE_CONTEXT, libsumo::CMD_SUBSCRIBE_ROUTE_VARIABLE, libsumo::CMD_SUBSCRIBE_ROUTEPROBE_CONTEXT, libsumo::CMD_SUBSCRIBE_ROUTEPROBE_VARIABLE, libsumo::CMD_SUBSCRIBE_SIM_CONTEXT, libsumo::CMD_SUBSCRIBE_SIM_VARIABLE, libsumo::CMD_SUBSCRIBE_TL_CONTEXT, libsumo::CMD_SUBSCRIBE_TL_VARIABLE, libsumo::CMD_SUBSCRIBE_VARIABLESPEEDSIGN_CONTEXT, libsumo::CMD_SUBSCRIBE_VARIABLESPEEDSIGN_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(), removeCurrentSocket(), 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 processCommands().
|
inlinevirtualinherited |
Reimplemented in libsumo::Helper::SubscriptionWrapper.
Definition at line 182 of file Subscription.h.
Referenced by libsumo::Helper::handleSingleSubscription().
|
inlinestatic |
Definition at line 68 of file TraCIServer.h.
References myInstance.
Referenced by MSNet::adaptToState(), NLBuilder::build(), MSNet::clearAll(), GUIApplicationWindow::dependentBuild(), MSNet::generateStatistics(), GUIApplicationWindow::onCmdReload(), GUIApplicationWindow::onUpdReload(), GUIApplicationWindow::onUpdTraCIStatus(), MSNet::postSimStepOutput(), TraCIServerAPI_Simulation::processSet(), MSNet::simulationState(), and MSNet::simulationStep().
|
inline |
Definition at line 249 of file TraCIServer.h.
References myLoadArgs.
Referenced by MSNet::adaptToState(), and MSNet::simulationStep().
|
inline |
Definition at line 64 of file TraCIServer.h.
References myTargetTime.
Referenced by MSNet::simulationStep().
|
inline |
Definition at line 145 of file TraCIServer.h.
References myCurrentSocket, mySockets, and myTransportableStateChanges.
Referenced by TraCIServerAPI_Simulation::writeTransportableStateIDs(), and TraCIServerAPI_Simulation::writeTransportableStateNumber().
|
inline |
Definition at line 135 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 439 of file TraCIServer.cpp.
References myWrapperStorage.
Referenced by TraCIServerAPI_GUI::processGet(), TraCIServerAPI_BusStop::processGet(), TraCIServerAPI_Calibrator::processGet(), TraCIServerAPI_ChargingStation::processGet(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_LaneArea::processGet(), TraCIServerAPI_MeanData::processGet(), TraCIServerAPI_MultiEntryExit::processGet(), TraCIServerAPI_OverheadWire::processGet(), TraCIServerAPI_ParkingArea::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Rerouter::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_RouteProbe::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_TrafficLight::processGet(), TraCIServerAPI_VariableSpeedSign::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_VehicleType::processGet(), and TraCIServerAPI_TrafficLight::writeConstraint().
|
private |
Definition at line 1310 of file TraCIServer.cpp.
References libsumo::Subscription::beginTime, libsumo::Subscription::commandId, libsumo::Subscription::endTime, MSNet::getCurrentTimeStep(), MSNet::getInstance(), libsumo::Subscription::isVehicleToPersonContextSubscription(), libsumo::Subscription::isVehicleToVehicleContextSubscription(), myLastContextSubscription, myOutputStorage, mySubscriptionCache, mySubscriptions, libsumo::Helper::needNewSubscription(), processSingleSubscription(), tcpip::Storage::readByte(), tcpip::Storage::readInt(), tcpip::Storage::reset(), libsumo::RTYPE_ERR, libsumo::RTYPE_OK, tcpip::Storage::size(), tcpip::Storage::valid_pos(), 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 113 of file TraCIServer.cpp.
References myWrapperStorage, tcpip::Storage::reset(), tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
Referenced by TraCIServerAPI_GUI::processGet(), TraCIServerAPI_BusStop::processGet(), TraCIServerAPI_Calibrator::processGet(), TraCIServerAPI_ChargingStation::processGet(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_LaneArea::processGet(), TraCIServerAPI_MeanData::processGet(), TraCIServerAPI_MultiEntryExit::processGet(), TraCIServerAPI_OverheadWire::processGet(), TraCIServerAPI_ParkingArea::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Rerouter::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_RouteProbe::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_TrafficLight::processGet(), TraCIServerAPI_VariableSpeedSign::processGet(), TraCIServerAPI_Vehicle::processGet(), and TraCIServerAPI_VehicleType::processGet().
|
private |
get the minimal next target time among all clients
Definition at line 780 of file TraCIServer.cpp.
References MIN2(), and mySockets.
Referenced by processCommands().
|
static |
Initialises the server.
[in] | execs | The (additional) command executors to use |
Definition at line 615 of file TraCIServer.cpp.
References MSNet::addTransportableStateListener(), MSNet::addVehicleStateListener(), MSNet::getInstance(), OptionsCont::getOptions(), myDoCloseConnection, myExecutors, myInstance, mySubscriptionCache, string2time(), and tcpip::Storage::writeInt().
Referenced by NLBuilder::init(), and GUILoadThread::run().
|
privatedelete |
Invalidated assignment operator.
|
private |
Handles subscriptions to send after a simstep2 command.
Definition at line 1202 of file TraCIServer.cpp.
References MSNet::ARRIVED, 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(), tcpip::Storage::writeInt(), writeStatusCmd(), and tcpip::Storage::writeStorage().
Referenced by processCommands().
int TraCIServer::processCommands | ( | const SUMOTime | step, |
const bool | afterMove = false |
||
) |
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 826 of file TraCIServer.cpp.
References libsumo::CMD_CLOSE, libsumo::CMD_EXECUTEMOVE, libsumo::CMD_LOAD, libsumo::CMD_SIMSTEP, dispatchCommand(), MSNet::getInstance(), myCurrentSocket, myDoCloseConnection, myInputStorage, myLoadArgs, myOutputStorage, mySockets, myTargetTime, myTransportableStateChanges, myVehicleStateChanges, nextTargetTime(), postProcessSimulationStep(), processReorderingRequests(), 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 736 of file TraCIServer.cpp.
References mySocketReorderRequests, mySockets, and SIMTIME.
Referenced by processCommands().
|
private |
Definition at line 1381 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, libsumo::Helper::applySubscriptionFilters(), libsumo::Helper::collectObjectIDsInRange(), 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::writeChar(), tcpip::Storage::writeInt(), 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 979 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 1861 of file TraCIServer.cpp.
References tcpip::Storage::readByte(), and libsumo::TYPE_BYTE.
Referenced by TraCIServerAPI_Vehicle::insertReplaceStop(), TraCIServerAPI_Person::processSet(), and TraCIServerAPI_Vehicle::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 1836 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_Person::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_Vehicle::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 1796 of file TraCIServer.cpp.
References tcpip::Storage::readDouble(), tcpip::Storage::readUnsignedByte(), and libsumo::TYPE_DOUBLE.
Referenced by TraCIServerAPI_Vehicle::insertReplaceStop(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_GUI::processSet(), TraCIServerAPI_ChargingStation::processSet(), TraCIServerAPI_InductionLoop::processSet(), TraCIServerAPI_Person::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_Simulation::processSet(), TraCIServerAPI_TrafficLight::processSet(), TraCIServerAPI_Vehicle::processSet(), 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 1826 of file TraCIServer.cpp.
References tcpip::Storage::readDoubleList(), tcpip::Storage::readUnsignedByte(), and libsumo::TYPE_DOUBLELIST.
Referenced by TraCIServerAPI_Polygon::processSet().
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 1881 of file TraCIServer.cpp.
References tcpip::Storage::readDouble(), tcpip::Storage::readInt(), tcpip::Storage::readUnsignedByte(), and libsumo::TYPE_POLYGON.
Referenced by TraCIServerAPI_GUI::processSet(), and TraCIServerAPI_Polygon::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 1849 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_GUI::processSet(), and TraCIServerAPI_POI::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 1806 of file TraCIServer.cpp.
References tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), and libsumo::TYPE_STRING.
Referenced by TraCIServerAPI_Vehicle::insertReplaceStop(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_TrafficLight::processGet(), TraCIServerAPI_GUI::processSet(), TraCIServerAPI_OverheadWire::processSet(), TraCIServerAPI_ParkingArea::processSet(), TraCIServerAPI_Person::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_Rerouter::processSet(), TraCIServerAPI_Route::processSet(), TraCIServerAPI_RouteProbe::processSet(), TraCIServerAPI_Simulation::processSet(), TraCIServerAPI_TrafficLight::processSet(), TraCIServerAPI_VariableSpeedSign::processSet(), TraCIServerAPI_Vehicle::processSet(), 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 1816 of file TraCIServer.cpp.
References tcpip::Storage::readStringList(), tcpip::Storage::readUnsignedByte(), and libsumo::TYPE_STRINGLIST.
Referenced by dispatchCommand(), TraCIServerAPI_ParkingArea::processSet(), TraCIServerAPI_Person::processSet(), TraCIServerAPI_Route::processSet(), TraCIServerAPI_TrafficLight::processSet(), and TraCIServerAPI_Vehicle::processSet().
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 1871 of file TraCIServer.cpp.
References tcpip::Storage::readUnsignedByte(), and libsumo::TYPE_UBYTE.
Referenced by TraCIServerAPI_Simulation::commandPositionConversion(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_Polygon::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 967 of file TraCIServer.cpp.
References myCurrentSocket, and mySockets.
Referenced by dispatchCommand().
|
private |
Definition at line 1672 of file TraCIServer.cpp.
References libsumo::Subscription::activeFilters, myLastContextSubscription, and libsumo::SUBS_FILTER_NONE.
Referenced by addSubscriptionFilter().
|
private |
Definition at line 1356 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 804 of file TraCIServer.cpp.
References MSNet::getCurrentTimeStep(), MSNet::getInstance(), myOutputStorage, and mySockets.
Referenced by processCommands().
|
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 1262 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 157 of file Subscription.h.
Referenced by libsumo::Helper::handleSingleSubscription().
void TraCIServer::stateLoaded | ( | SUMOTime | targetTime | ) |
updates myTargetTime and resets vehicle state changes after loading a simulation state
Definition at line 1904 of file TraCIServer.cpp.
References mySockets, mySubscriptionCache, mySubscriptions, myTargetTime, and tcpip::Storage::reset().
Referenced by NLBuilder::build(), and TraCIServerAPI_Simulation::processSet().
|
virtual |
Called if a transportable changes its state.
[in] | transportable | The transportable which changed its state |
[in] | to | The state the transportable has changed to |
[in] | info | Additional information on the state change |
Implements MSNet::TransportableStateListener.
Definition at line 665 of file TraCIServer.cpp.
References Named::getID(), myDoCloseConnection, mySockets, and myTransportableStateChanges.
|
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 654 of file TraCIServer.cpp.
References Named::getID(), myDoCloseConnection, mySockets, and myVehicleStateChanges.
|
static |
check whether close was requested
Definition at line 645 of file TraCIServer.cpp.
References myDoCloseConnection.
Referenced by MSNet::adaptToState(), MSNet::simulationState(), and MSNet::simulationStep().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 409 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::StorageHelper::writeCompound(), libsumo::StorageHelper::writeTypedByte(), libsumo::StorageHelper::writeTypedDouble(), libsumo::StorageHelper::writeTypedInt(), libsumo::StorageHelper::writeTypedString(), libsumo::StorageHelper::writeTypedStringList(), and libsumo::StorageHelper::writeTypedUnsignedByte().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 210 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::TYPE_COLOR, and tcpip::Storage::writeUnsignedByte().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 122 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::StorageHelper::writeCompound(), libsumo::StorageHelper::writeTypedDouble(), libsumo::StorageHelper::writeTypedInt(), libsumo::StorageHelper::writeTypedString(), and libsumo::StorageHelper::writeTypedUnsignedByte().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 140 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::TYPE_DOUBLE, tcpip::Storage::writeDouble(), and tcpip::Storage::writeUnsignedByte().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 172 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::TYPE_DOUBLELIST, tcpip::Storage::writeDoubleList(), and tcpip::Storage::writeUnsignedByte().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 148 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::TYPE_INTEGER, tcpip::Storage::writeInt(), and tcpip::Storage::writeUnsignedByte().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 250 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::StorageHelper::writeCompound(), and libsumo::StorageHelper::writeTypedInt().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 345 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::StorageHelper::writeCompound(), libsumo::StorageHelper::writeTypedDouble(), libsumo::StorageHelper::writeTypedInt(), libsumo::StorageHelper::writeTypedString(), and libsumo::StorageHelper::writeTypedUnsignedByte().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 316 of file TraCIServer.cpp.
References myWrapperStorage, tcpip::Storage::size(), libsumo::StorageHelper::writeCompound(), libsumo::StorageHelper::writeTypedInt(), and libsumo::StorageHelper::writeTypedStringList().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 286 of file TraCIServer.cpp.
References myWrapperStorage, tcpip::Storage::size(), libsumo::StorageHelper::writeCompound(), libsumo::StorageHelper::writeTypedDouble(), libsumo::StorageHelper::writeTypedInt(), libsumo::StorageHelper::writeTypedString(), and libsumo::StorageHelper::writeTypedStringList().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 364 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::VAR_NEXT_STOPS2, libsumo::StorageHelper::writeCompound(), libsumo::StorageHelper::writeTypedDouble(), libsumo::StorageHelper::writeTypedInt(), and libsumo::StorageHelper::writeTypedString().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 425 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::StorageHelper::writeCompound(), libsumo::StorageHelper::writeTypedByte(), libsumo::StorageHelper::writeTypedDouble(), libsumo::StorageHelper::writeTypedInt(), and libsumo::StorageHelper::writeTypedString().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 180 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::POSITION_2D, libsumo::POSITION_3D, libsumo::VAR_POSITION3D, tcpip::Storage::writeDouble(), and tcpip::Storage::writeUnsignedByte().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 193 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::TYPE_POLYGON, libsumo::TraCIPositionVector::value, tcpip::Storage::writeDouble(), tcpip::Storage::writeInt(), and tcpip::Storage::writeUnsignedByte().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 266 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::StorageHelper::writeCompound(), libsumo::StorageHelper::writeTypedDouble(), libsumo::StorageHelper::writeTypedInt(), libsumo::StorageHelper::writeTypedString(), and libsumo::StorageHelper::writeTypedStringList().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 334 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::StorageHelper::writeCompound(), libsumo::StorageHelper::writeConstraint(), and libsumo::StorageHelper::writeTypedInt().
Referenced by TraCIServerAPI_TrafficLight::processGet().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 259 of file TraCIServer.cpp.
References myWrapperStorage, and libsumo::StorageHelper::writeStage().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 156 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::TYPE_STRING, tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 221 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::StorageHelper::writeCompound(), libsumo::StorageHelper::writeTypedDouble(), and libsumo::StorageHelper::writeTypedString().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 230 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::StorageHelper::writeCompound(), tcpip::Storage::writeDouble(), and tcpip::Storage::writeString().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 164 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::TYPE_STRINGLIST, tcpip::Storage::writeStringList(), and tcpip::Storage::writeUnsignedByte().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 241 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::StorageHelper::writeCompound(), and libsumo::StorageHelper::writeTypedString().
|
virtual |
Implements libsumo::VariableWrapper.
Definition at line 394 of file TraCIServer.cpp.
References myWrapperStorage, libsumo::StorageHelper::writeCompound(), libsumo::StorageHelper::writeTypedDouble(), libsumo::StorageHelper::writeTypedInt(), and libsumo::StorageHelper::writeTypedString().
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 1303 of file TraCIServer.cpp.
References libsumo::RTYPE_ERR, and writeStatusCmd().
Referenced by dispatchCommand(), TraCIServerAPI_Vehicle::insertReplaceStop(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_BusStop::processGet(), TraCIServerAPI_Calibrator::processGet(), TraCIServerAPI_ChargingStation::processGet(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_LaneArea::processGet(), TraCIServerAPI_MeanData::processGet(), TraCIServerAPI_MultiEntryExit::processGet(), TraCIServerAPI_OverheadWire::processGet(), TraCIServerAPI_ParkingArea::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Rerouter::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_RouteProbe::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_TrafficLight::processGet(), TraCIServerAPI_VariableSpeedSign::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_GUI::processSet(), TraCIServerAPI_BusStop::processSet(), TraCIServerAPI_Calibrator::processSet(), TraCIServerAPI_ChargingStation::processSet(), TraCIServerAPI_Edge::processSet(), TraCIServerAPI_InductionLoop::processSet(), TraCIServerAPI_Junction::processSet(), TraCIServerAPI_Lane::processSet(), TraCIServerAPI_LaneArea::processSet(), TraCIServerAPI_MultiEntryExit::processSet(), TraCIServerAPI_OverheadWire::processSet(), TraCIServerAPI_ParkingArea::processSet(), TraCIServerAPI_Person::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_Rerouter::processSet(), TraCIServerAPI_Route::processSet(), TraCIServerAPI_RouteProbe::processSet(), TraCIServerAPI_Simulation::processSet(), TraCIServerAPI_TrafficLight::processSet(), TraCIServerAPI_VariableSpeedSign::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_VehicleType::processSet(), and TraCIServerAPI_VehicleType::setVariable().
void TraCIServer::writePositionVector | ( | tcpip::Storage & | outputStorage, |
const libsumo::TraCIPositionVector & | shape | ||
) |
Definition at line 1780 of file TraCIServer.cpp.
References libsumo::TYPE_POLYGON, libsumo::TraCIPositionVector::value, tcpip::Storage::writeDouble(), tcpip::Storage::writeInt(), and tcpip::Storage::writeUnsignedByte().
void TraCIServer::writeResponseWithLength | ( | tcpip::Storage & | outputStorage, |
tcpip::Storage & | tempMsg | ||
) |
Definition at line 1768 of file TraCIServer.cpp.
References tcpip::Storage::size(), tcpip::Storage::writeInt(), tcpip::Storage::writeStorage(), and tcpip::Storage::writeUnsignedByte().
Referenced by TraCIServerAPI_GUI::processGet(), TraCIServerAPI_BusStop::processGet(), TraCIServerAPI_Calibrator::processGet(), TraCIServerAPI_ChargingStation::processGet(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_LaneArea::processGet(), TraCIServerAPI_MeanData::processGet(), TraCIServerAPI_MultiEntryExit::processGet(), TraCIServerAPI_OverheadWire::processGet(), TraCIServerAPI_ParkingArea::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Rerouter::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_RouteProbe::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_TrafficLight::processGet(), TraCIServerAPI_VariableSpeedSign::processGet(), TraCIServerAPI_Vehicle::processGet(), and TraCIServerAPI_VehicleType::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 1283 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 1289 of file TraCIServer.cpp.
References libsumo::RTYPE_ERR, libsumo::RTYPE_NOTIMPLEMENTED, toHex(), WRITE_ERROR, tcpip::Storage::writeString(), and tcpip::Storage::writeUnsignedByte().
Referenced by addObjectVariableSubscription(), addSubscriptionFilter(), TraCIServerAPI_Simulation::commandDistanceRequest(), commandGetVersion(), TraCIServerAPI_Simulation::commandPositionConversion(), dispatchCommand(), initialiseSubscription(), postProcessSimulationStep(), TraCIServerAPI_GUI::processGet(), TraCIServerAPI_BusStop::processGet(), TraCIServerAPI_Calibrator::processGet(), TraCIServerAPI_ChargingStation::processGet(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_LaneArea::processGet(), TraCIServerAPI_MeanData::processGet(), TraCIServerAPI_MultiEntryExit::processGet(), TraCIServerAPI_OverheadWire::processGet(), TraCIServerAPI_ParkingArea::processGet(), TraCIServerAPI_Person::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Rerouter::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_RouteProbe::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_TrafficLight::processGet(), TraCIServerAPI_VariableSpeedSign::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_GUI::processSet(), TraCIServerAPI_BusStop::processSet(), TraCIServerAPI_Calibrator::processSet(), TraCIServerAPI_ChargingStation::processSet(), TraCIServerAPI_Edge::processSet(), TraCIServerAPI_InductionLoop::processSet(), TraCIServerAPI_Junction::processSet(), TraCIServerAPI_Lane::processSet(), TraCIServerAPI_LaneArea::processSet(), TraCIServerAPI_MultiEntryExit::processSet(), TraCIServerAPI_OverheadWire::processSet(), TraCIServerAPI_ParkingArea::processSet(), TraCIServerAPI_Person::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_Rerouter::processSet(), TraCIServerAPI_Route::processSet(), TraCIServerAPI_RouteProbe::processSet(), TraCIServerAPI_Simulation::processSet(), TraCIServerAPI_TrafficLight::processSet(), TraCIServerAPI_VariableSpeedSign::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_VehicleType::processSet(), processSingleSubscription(), removeSubscription(), sendSingleSimStepResponse(), writeErrorStatusCmd(), and writeStatusCmd().
|
inherited |
Definition at line 156 of file Subscription.h.
|
private |
The currently active client socket.
Definition at line 375 of file TraCIServer.h.
Referenced by checkClientOrdering(), cleanup(), dispatchCommand(), getTransportableStateChanges(), getVehicleStateChanges(), processCommands(), removeCurrentSocket(), sendSingleSimStepResponse(), and TraCIServer().
|
staticprivate |
Whether the connection was set to be to close.
Definition at line 365 of file TraCIServer.h.
Referenced by close(), dispatchCommand(), openSocket(), processCommands(), TraCIServer(), transportableStateChanged(), vehicleStateChanged(), and wasClosed().
|
private |
Map of commandIds -> their executors; applicable if the executor applies to the method footprint.
Definition at line 393 of file TraCIServer.h.
Referenced by dispatchCommand(), openSocket(), processSingleSubscription(), and TraCIServer().
|
private |
The storage to read from.
Definition at line 381 of file TraCIServer.h.
Referenced by addObjectVariableSubscription(), addSubscriptionFilter(), checkClientOrdering(), cleanup(), dispatchCommand(), processCommands(), and readCommandID().
|
staticprivate |
Singleton instance of the server.
Definition at line 362 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 404 of file TraCIServer.h.
Referenced by addSubscriptionFilter(), addSubscriptionFilterDownstreamDistance(), addSubscriptionFilterFieldOfVision(), addSubscriptionFilterLanes(), addSubscriptionFilterLateralDistance(), addSubscriptionFilterLeadFollow(), addSubscriptionFilterNoOpposite(), addSubscriptionFilterTurn(), addSubscriptionFilterUpstreamDistance(), addSubscriptionFilterVClass(), addSubscriptionFilterVType(), initialiseSubscription(), removeFilters(), and removeSubscription().
|
private |
Definition at line 398 of file TraCIServer.h.
Referenced by dispatchCommand(), getLoadArgs(), and processCommands().
|
private |
The storage to write to.
Definition at line 384 of file TraCIServer.h.
Referenced by checkClientOrdering(), cleanup(), commandGetVersion(), dispatchCommand(), initialiseSubscription(), postProcessSimulationStep(), processCommands(), sendOutputToAll(), sendSingleSimStepResponse(), and writeStatusCmd().
|
private |
Set of variables which have parameters.
Definition at line 396 of file TraCIServer.h.
Referenced by addObjectVariableSubscription(), and TraCIServer().
|
private |
This stores the setOrder(int) requests of the clients.
Definition at line 372 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 369 of file TraCIServer.h.
Referenced by checkClientOrdering(), cleanup(), dispatchCommand(), getTransportableStateChanges(), getVehicleStateChanges(), nextTargetTime(), processCommands(), processReorderingRequests(), removeCurrentSocket(), sendOutputToAll(), stateLoaded(), TraCIServer(), transportableStateChanged(), vehicleStateChanged(), and ~TraCIServer().
|
private |
The last timestep's subscription results.
Definition at line 390 of file TraCIServer.h.
Referenced by cleanup(), initialiseSubscription(), openSocket(), postProcessSimulationStep(), sendSingleSimStepResponse(), and stateLoaded().
|
private |
The list of known, still valid subscriptions.
Definition at line 401 of file TraCIServer.h.
Referenced by cleanup(), initialiseSubscription(), postProcessSimulationStep(), removeSubscription(), and stateLoaded().
|
private |
The time step to reach until processing the next commands.
Definition at line 378 of file TraCIServer.h.
Referenced by cleanup(), getTargetTime(), processCommands(), and stateLoaded().
|
private |
Changes in the states of simulated transportables.
Definition at line 422 of file TraCIServer.h.
Referenced by cleanup(), getTransportableStateChanges(), processCommands(), TraCIServer(), and transportableStateChanged().
|
private |
Changes in the states of simulated vehicles.
Definition at line 413 of file TraCIServer.h.
Referenced by cleanup(), getVehicleStateChanges(), postProcessSimulationStep(), processCommands(), TraCIServer(), and vehicleStateChanged().
|
private |
A temporary storage to let the wrapper write to.
Definition at line 387 of file TraCIServer.h.
Referenced by getWrapperStorage(), initWrapper(), wrapBestLanesDataVector(), wrapColor(), wrapConnectionVector(), wrapDouble(), wrapDoubleList(), wrapInt(), wrapIntPair(), wrapJunctionFoeVector(), wrapLinkVectorVector(), wrapLogicVector(), wrapNextStopDataVector(), wrapNextTLSDataVector(), wrapPosition(), wrapPositionVector(), wrapReservationVector(), wrapSignalConstraintVector(), wrapStage(), wrapString(), wrapStringDoublePair(), wrapStringDoublePairList(), wrapStringList(), wrapStringPair(), and wrapVehicleDataVector().