Eclipse SUMO - Simulation of Urban MObility
|
Stores time-dependant events and executes them at the proper time. More...
#include <MSEventControl.h>
Public Types | |
typedef std::pair< Command *, SUMOTime > | Event |
Combination of an event and the time it shall be executed at. | |
Public Member Functions | |
virtual void | addEvent (Command *operation, SUMOTime execTimeStep=-1) |
Adds an Event. | |
void | clearState (SUMOTime currentTime, SUMOTime newTime) |
Remove all events before quick-loading state. | |
virtual void | execute (SUMOTime time) |
Executes time-dependant commands. | |
SUMOTime | getEventTime (Command *cmd) const |
get the next scheduled event time for the given command, -2 if it is not scheduled | |
bool | isEmpty () |
Returns whether events are in the que. | |
MSEventControl () | |
Default constructor. | |
virtual | ~MSEventControl () |
Destructor. | |
Static Protected Member Functions | |
static bool | eventCompare (const Event &e1, const Event &e2) |
compares two events | |
Private Member Functions | |
MSEventControl (const MSEventControl &) | |
invalid copy constructor. | |
MSEventControl & | operator= (const MSEventControl &) |
invalid assignment operator. | |
Private Attributes | |
std::vector< Event > | myEvents |
Event-container, holds executable events. | |
Stores time-dependant events and executes them at the proper time.
Definition at line 47 of file MSEventControl.h.
typedef std::pair< Command*, SUMOTime > MSEventControl::Event |
Combination of an event and the time it shall be executed at.
Definition at line 50 of file MSEventControl.h.
MSEventControl::MSEventControl | ( | ) |
Default constructor.
Definition at line 36 of file MSEventControl.cpp.
|
virtual |
|
private |
invalid copy constructor.
Adds an Event.
[in] | operation | The event to add |
[in] | execTimeStep | The time the event shall be executed at (-1 means at sim start) |
Reimplemented in GUIEventControl.
Definition at line 49 of file MSEventControl.cpp.
References eventCompare(), and myEvents.
Referenced by MSPModel_NonInteracting::add(), MSPModel_Striping::add(), LIBSUMO_NAMESPACE::Polygon::addDynamics(), GUIEventControl::addEvent(), MSTractionSubstation::addSolvingCircuitToEndOfTimestepEvents(), MSDevice_BTreceiver::BTreceiverUpdate::BTreceiverUpdate(), MSTransportableDevice_FCDReplay::buildDevices(), NLTriggerBuilder::buildVaporizer(), MSActuatedTrafficLightLogic::changeStepAndDuration(), MSSimpleTrafficLightLogic::changeStepAndDuration(), MSRouteHandler::closeVehicle(), MSTLLogicControl::closeWAUT(), Command_SaveTLSProgram::Command_SaveTLSProgram(), Command_SaveTLSState::Command_SaveTLSState(), Command_SaveTLSSwitches::Command_SaveTLSSwitches(), Command_SaveTLSSwitchStates::Command_SaveTLSSwitchStates(), MSVehicleControl::deleteKeptVehicle(), MSParkingArea::enter(), execute(), MSDevice_StationFinder::implementChargingStrategy(), MSDevice_FCDReplay::init(), MSCalibrator::init(), MSLaneSpeedTrigger::init(), MSStageDriving::init(), MSDevice_Taxi::initDispatch(), MSRoutingEngine::initWeightUpdate(), MSParkingArea::leaveFrom(), MSActuatedTrafficLightLogic::loadState(), MSPModel_NonInteracting::loadState(), MSPModel_Striping::loadState(), MSDevice_Routing::MSDevice_Routing(), MSPModel_JuPedSim::MSPModel_JuPedSim(), MSSimpleTrafficLightLogic::MSSimpleTrafficLightLogic(), MSTrafficLightLogic::MSTrafficLightLogic(), MSTransportableDevice_Routing::MSTransportableDevice_Routing(), MSVTypeProbe::MSVTypeProbe(), MSTriggeredRerouter::myEndElement(), MSDevice_StationFinder::notifyMove(), MSPerson::MSPersonStage_Access::proceed(), MSDevice_Routing::rebuildRerouteCommand(), MSDevice_ToC::requestToC(), MSTransportable::setAbortWaiting(), MSTransportableDevice_Routing::setParameter(), MSTriggeredRerouter::setPermissions(), MSDevice_ToC::triggerDownwardToC(), and MSDevice_ToC::triggerMRM().
Remove all events before quick-loading state.
Definition at line 103 of file MSEventControl.cpp.
References eventCompare(), and myEvents.
Referenced by MSNet::clearState().
compares two events
Definition at line 98 of file MSEventControl.cpp.
Referenced by addEvent(), clearState(), and execute().
|
virtual |
Executes time-dependant commands.
Loops over all stored events, continuing until the first event which execution time lies beyond the given time + deltaT. If the event had to be executed before the given time, a warning is generated and the event deleted. Otherwise (the event is valid), the event is executed.
Each executed event must return the time that has to pass until it shall be executed again. If the returned time is 0, the event is deleted. Otherwise it is readded, after the new execution time (returned + current) is computed.
ProcessErrors thrown by executed commands are rethrown.
[in] | time | The current simulation time |
ProcessError | From an executed Command |
Reimplemented in GUIEventControl.
Definition at line 56 of file MSEventControl.cpp.
References addEvent(), DELTA_T, eventCompare(), Command::execute(), myEvents, and WRITE_WARNING.
Referenced by GUIEventControl::execute(), and MSNet::simulationStep().
get the next scheduled event time for the given command, -2 if it is not scheduled
bool MSEventControl::isEmpty | ( | ) |
Returns whether events are in the que.
Definition at line 93 of file MSEventControl.cpp.
References myEvents.
|
private |
invalid assignment operator.
|
private |
Event-container, holds executable events.
Definition at line 110 of file MSEventControl.h.
Referenced by addEvent(), clearState(), execute(), isEmpty(), and ~MSEventControl().