Eclipse SUMO - Simulation of Urban MObility
MSEventControl Class Reference

Stores time-dependant events and executes them at the proper time. More...

#include <MSEventControl.h>

Inheritance diagram for MSEventControl:
[legend]

Public Types

typedef std::pair< Command *, SUMOTimeEvent
 Combination of an event and the time it shall be executed at. More...
 

Public Member Functions

virtual void addEvent (Command *operation, SUMOTime execTimeStep=-1)
 Adds an Event. More...
 
void clearState (SUMOTime currentTime, SUMOTime newTime)
 Remove all events before quick-loading state. More...
 
virtual void execute (SUMOTime time)
 Executes time-dependant commands. More...
 
SUMOTime getEventTime (Command *cmd) const
 get the next scheduled event time for the given command, -2 if it is not scheduled More...
 
bool isEmpty ()
 Returns whether events are in the que. More...
 
 MSEventControl ()
 Default constructor. More...
 
virtual ~MSEventControl ()
 Destructor. More...
 

Static Protected Member Functions

static bool eventCompare (const Event &e1, const Event &e2)
 compares two events More...
 

Private Member Functions

 MSEventControl (const MSEventControl &)
 invalid copy constructor. More...
 
MSEventControloperator= (const MSEventControl &)
 invalid assignment operator. More...
 

Private Attributes

std::vector< EventmyEvents
 Event-container, holds executable events. More...
 

Detailed Description

Stores time-dependant events and executes them at the proper time.

Definition at line 47 of file MSEventControl.h.

Member Typedef Documentation

◆ Event

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.

Constructor & Destructor Documentation

◆ MSEventControl() [1/2]

MSEventControl::MSEventControl ( )

Default constructor.

Definition at line 36 of file MSEventControl.cpp.

◆ ~MSEventControl()

MSEventControl::~MSEventControl ( )
virtual

Destructor.

Definition at line 40 of file MSEventControl.cpp.

References myEvents.

◆ MSEventControl() [2/2]

MSEventControl::MSEventControl ( const MSEventControl )
private

invalid copy constructor.

Member Function Documentation

◆ addEvent()

void MSEventControl::addEvent ( Command operation,
SUMOTime  execTimeStep = -1 
)
virtual

Adds an Event.

Parameters
[in]operationThe event to add
[in]execTimeStepThe time the event shall be executed at (-1 means at sim start)
See also
Command

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::addSolvingCirucitToEndOfTimestepEvents(), 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(), MSParkingArea::enter(), execute(), 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().

Here is the caller graph for this function:

◆ clearState()

void MSEventControl::clearState ( SUMOTime  currentTime,
SUMOTime  newTime 
)

Remove all events before quick-loading state.

Definition at line 103 of file MSEventControl.cpp.

References eventCompare(), and myEvents.

Referenced by MSNet::clearState().

Here is the caller graph for this function:

◆ eventCompare()

bool MSEventControl::eventCompare ( const Event e1,
const Event e2 
)
staticprotected

compares two events

Definition at line 98 of file MSEventControl.cpp.

Referenced by addEvent(), clearState(), and execute().

Here is the caller graph for this function:

◆ execute()

void MSEventControl::execute ( SUMOTime  time)
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.

Parameters
[in]timeThe current simulation time
Exceptions
ProcessErrorFrom 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().

Here is the caller graph for this function:

◆ getEventTime()

SUMOTime MSEventControl::getEventTime ( Command cmd) const

get the next scheduled event time for the given command, -2 if it is not scheduled

◆ isEmpty()

bool MSEventControl::isEmpty ( )

Returns whether events are in the que.

Returns
whether events are in the que

Definition at line 93 of file MSEventControl.cpp.

References myEvents.

◆ operator=()

MSEventControl& MSEventControl::operator= ( const MSEventControl )
private

invalid assignment operator.

Field Documentation

◆ myEvents

std::vector<Event> MSEventControl::myEvents
private

Event-container, holds executable events.

Definition at line 110 of file MSEventControl.h.

Referenced by addEvent(), clearState(), execute(), isEmpty(), and ~MSEventControl().


The documentation for this class was generated from the following files: