SUMO - Simulation of Urban MObility

traci::TraCIServer Class Reference

#include <TraCIServer.h>

Inheritance diagram for traci::TraCIServer:
MSNet::VehicleStateListener

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

Detailed Description

Definition at line 76 of file TraCIServer.h.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

TraCIServer::TraCIServer ( int  port = 0) [private]
TraCIServer::~TraCIServer ( ) [private, virtual]

Definition at line 193 of file TraCIServer.cpp.


Member Function Documentation

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

Returns:
Mapped command executors

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::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.

Parameters:
[in]vehicleThe vehicle which changed its state
[in]toThe 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::writeStatusCmd ( int  commandId,
int  status,
const std::string &  description,
tcpip::Storage &  outputStorage 
)

Definition at line 641 of file TraCIServer.cpp.

References myInputStorage.


Field Documentation

Definition at line 163 of file TraCIServer.h.

bool TraCIServer::myDoCloseConnection = false [static, private]

Definition at line 150 of file TraCIServer.h.

Definition at line 161 of file TraCIServer.h.

Referenced by processCommandsUntilSimStep().

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.

socket on which server is listening on

Definition at line 153 of file TraCIServer.h.

Definition at line 182 of file TraCIServer.h.

Referenced by addSubscription().

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().


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines