|
SUMO - Simulation of Urban MObility
|
#include <TraCIServer.h>
Data Structures | |
| class | Subscription |
Public Types | |
| typedef bool(* | CmdExecutor )(traci::TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage) |
| Definition of a method to be called for serving an associated commandID. | |
Public Member Functions | |
| std::map< int, CmdExecutor > & | getExecutors () |
| Returns the list of (unified) command executors. | |
| const std::map < MSNet::VehicleState, std::vector< std::string > > & | getVehicleStateChanges () const |
| void | vehicleStateChanged (const SUMOVehicle *const vehicle, MSNet::VehicleState to) |
| Called if a vehicle changes its state. | |
| void | writeResponseWithLength (tcpip::Storage &outputStorage, tcpip::Storage &tempMsg) |
| void | writeStatusCmd (int commandId, int status, const std::string &description) |
| void | writeStatusCmd (int commandId, int status, const std::string &description, tcpip::Storage &outputStorage) |
Static Public Member Functions | |
| static void | close () |
| request termination of connection | |
| static void | openSocket (const std::map< int, CmdExecutor > &execs) |
| Initialises the server. | |
| static void | processCommandsUntilSimStep (SUMOTime step) |
| process all commands until a simulation step is wanted | |
| static bool | wasClosed () |
| check whether close was requested | |
Private Member Functions | |
| bool | addSubscription (int commandId) |
| bool | commandAddVehicle () |
| bool | commandCloseConnection () |
| bool | commandGetVersion () |
| int | dispatchCommand () |
| void | postProcessSimulationStep2 () |
| bool | processSingleSubscription (const TraCIServer::Subscription &s, tcpip::Storage &writeInto, std::string &errors) |
| TraCIServer (int port=0) | |
| virtual | ~TraCIServer () |
Private Attributes | |
| const bool | myAmEmbedded |
| bool | myDoingSimStep |
| std::map< int, CmdExecutor > | myExecutors |
| Map of commandIds -> their executors; applicable if the executor applies to the method footprint. | |
| bool | myHaveWarnedDeprecation |
| tcpip::Storage | myInputStorage |
| tcpip::Storage | myOutputStorage |
| tcpip::Socket * | mySocket |
| socket on which server is listening on | |
| std::vector< Subscription > | mySubscriptions |
| SUMOTime | myTargetTime |
| std::map< MSNet::VehicleState, std::vector< std::string > > | myVehicleStateChanges |
Static Private Attributes | |
| static bool | myDoCloseConnection = false |
| static TraCIServer * | myInstance = 0 |
| singleton instance of the server | |
Definition at line 76 of file TraCIServer.h.
| typedef bool(* traci::TraCIServer::CmdExecutor)(traci::TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage) |
Definition of a method to be called for serving an associated commandID.
Definition at line 79 of file TraCIServer.h.
| TraCIServer::TraCIServer | ( | int | port = 0 | ) | [private] |
Definition at line 139 of file TraCIServer.cpp.
References MsgHandler::getWarningInstance(), MsgHandler::inform(), and WRITE_WARNING.
| TraCIServer::~TraCIServer | ( | ) | [private, virtual] |
Definition at line 193 of file TraCIServer.cpp.
| bool TraCIServer::addSubscription | ( | int | commandId | ) | [private] |
Definition at line 656 of file TraCIServer.cpp.
References mySubscriptions.
| void TraCIServer::close | ( | ) | [static] |
request termination of connection
Definition at line 286 of file TraCIServer.cpp.
Referenced by MSNet::closeSimulation().
| bool TraCIServer::commandAddVehicle | ( | ) | [private] |
Definition at line 546 of file TraCIServer.cpp.
| bool TraCIServer::commandCloseConnection | ( | ) | [private] |
Definition at line 536 of file TraCIServer.cpp.
References CMD_ADDVEHICLE, RTYPE_ERR, and writeStatusCmd().
| bool TraCIServer::commandGetVersion | ( | ) | [private] |
Definition at line 511 of file TraCIServer.cpp.
| int TraCIServer::dispatchCommand | ( | ) | [private] |
Definition at line 373 of file TraCIServer.cpp.
| std::map<int, CmdExecutor>& traci::TraCIServer::getExecutors | ( | ) | [inline] |
Returns the list of (unified) command executors.
Not all command executor methods apply to the wanted footprint; other comments may be served internally (aka there are more commandIds recognized than within this container
Definition at line 120 of file TraCIServer.h.
References myExecutors.
| const std::map<MSNet::VehicleState, std::vector<std::string> >& traci::TraCIServer::getVehicleStateChanges | ( | ) | const [inline] |
Definition at line 109 of file TraCIServer.h.
References myVehicleStateChanges.
Referenced by TraCIServerAPI_Simulation::processGet().
| void TraCIServer::openSocket | ( | const std::map< int, CmdExecutor > & | execs | ) | [static] |
Initialises the server.
| [in] | execs | The (additional) command executors to use |
Definition at line 126 of file TraCIServer.cpp.
References MSNet::addVehicleStateListener(), CMD_GET_INDUCTIONLOOP_VARIABLE, CMD_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE, CMD_GET_TL_VARIABLE, CMD_SET_TL_VARIABLE, MSNet::getInstance(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_TLS::processSet(), MSNet::VEHICLE_STATE_ARRIVED, MSNet::VEHICLE_STATE_BUILT, MSNet::VEHICLE_STATE_DEPARTED, MSNet::VEHICLE_STATE_ENDING_TELEPORT, MSNet::VEHICLE_STATE_NEWROUTE, and MSNet::VEHICLE_STATE_STARTING_TELEPORT.
Referenced by GUIApplicationWindow::handleEvent_SimulationLoaded().
| void TraCIServer::postProcessSimulationStep2 | ( | ) | [private] |
Definition at line 478 of file TraCIServer.cpp.
Referenced by processCommandsUntilSimStep().
| void TraCIServer::processCommandsUntilSimStep | ( | SUMOTime | step | ) | [static] |
process all commands until a simulation step is wanted
Definition at line 213 of file TraCIServer.cpp.
References myDoingSimStep, myInstance, and postProcessSimulationStep2().
Referenced by MSNet::simulationStep().
| bool TraCIServer::processSingleSubscription | ( | const TraCIServer::Subscription & | s, |
| tcpip::Storage & | writeInto, | ||
| std::string & | errors | ||
| ) | [private] |
Definition at line 706 of file TraCIServer.cpp.
| void TraCIServer::vehicleStateChanged | ( | const SUMOVehicle *const | vehicle, |
| MSNet::VehicleState | to | ||
| ) | [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 |
Implements MSNet::VehicleStateListener.
Definition at line 204 of file TraCIServer.cpp.
| bool TraCIServer::wasClosed | ( | ) | [static] |
check whether close was requested
Definition at line 280 of file TraCIServer.cpp.
Referenced by GUIRunThread::makeStep(), MSNet::simulate(), and MSNet::simulationState().
| void TraCIServer::writeResponseWithLength | ( | tcpip::Storage & | outputStorage, |
| tcpip::Storage & | tempMsg | ||
| ) |
Definition at line 769 of file TraCIServer.cpp.
Referenced by TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_InductionLoop::processGet(), and TraCIServerAPI_Edge::processGet().
| void TraCIServer::writeStatusCmd | ( | int | commandId, |
| int | status, | ||
| const std::string & | description, | ||
| tcpip::Storage & | outputStorage | ||
| ) |
Definition at line 641 of file TraCIServer.cpp.
References myInputStorage.
| void TraCIServer::writeStatusCmd | ( | int | commandId, |
| int | status, | ||
| const std::string & | description | ||
| ) |
Definition at line 635 of file TraCIServer.cpp.
Referenced by commandCloseConnection(), TraCIServerAPI_Vehicle::commandDistanceRequest(), TraCIServerAPI_Simulation::commandDistanceRequest(), TraCIServerAPI_Simulation::commandPositionConversion(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_Simulation::processGet(), TraCIServerAPI_Route::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_VehicleType::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_TLS::processSet(), TraCIServerAPI_Route::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_Lane::processSet(), TraCIServerAPI_Edge::processSet(), and TraCIServerAPI_VehicleType::setVariable().
const bool traci::TraCIServer::myAmEmbedded [private] |
Definition at line 163 of file TraCIServer.h.
bool TraCIServer::myDoCloseConnection = false [static, private] |
Definition at line 150 of file TraCIServer.h.
bool traci::TraCIServer::myDoingSimStep [private] |
Definition at line 161 of file TraCIServer.h.
Referenced by processCommandsUntilSimStep().
std::map<int, CmdExecutor> traci::TraCIServer::myExecutors [private] |
Map of commandIds -> their executors; applicable if the executor applies to the method footprint.
Definition at line 166 of file TraCIServer.h.
Referenced by getExecutors().
Definition at line 162 of file TraCIServer.h.
tcpip::Storage traci::TraCIServer::myInputStorage [private] |
Definition at line 159 of file TraCIServer.h.
Referenced by writeStatusCmd().
home behr_mi sumo src traci server TraCIServer cpp home behr_mi sumo src traci server TraCIServer cpp home behr_mi sumo src traci server TraCIServer cpp home behr_mi sumo src traci server TraCIServer cpp home behr_mi sumo src traci server TraCIServer cpp home behr_mi sumo src traci server TraCIServer cpp home behr_mi sumo src traci server TraCIServer cpp home behr_mi sumo src traci server TraCIServer cpp home behr_mi sumo src traci server TraCIServer cpp home behr_mi sumo src traci server TraCIServer cpp home behr_mi sumo src traci server TraCIServer cpp home behr_mi sumo src traci server TraCIServer cpp home behr_mi sumo src traci server TraCIServer cpp home behr_mi sumo src traci server TraCIServer cpp TraCIServer * TraCIServer::myInstance = 0 [static, private] |
singleton instance of the server
Definition at line 149 of file TraCIServer.h.
Referenced by processCommandsUntilSimStep().
tcpip::Storage traci::TraCIServer::myOutputStorage [private] |
Definition at line 160 of file TraCIServer.h.
tcpip::Socket* traci::TraCIServer::mySocket [private] |
socket on which server is listening on
Definition at line 153 of file TraCIServer.h.
std::vector<Subscription> traci::TraCIServer::mySubscriptions [private] |
Definition at line 182 of file TraCIServer.h.
Referenced by addSubscription().
SUMOTime traci::TraCIServer::myTargetTime [private] |
Definition at line 156 of file TraCIServer.h.
std::map<MSNet::VehicleState, std::vector<std::string> > traci::TraCIServer::myVehicleStateChanges [private] |
Definition at line 187 of file TraCIServer.h.
Referenced by getVehicleStateChanges().