SUMO - Simulation of Urban MObility
|
Stores time-dependant events and executes them at the proper time (guisim) More...
#include <GUIEventControl.h>
Public Types | |
enum | AdaptType { ADAPT_AFTER_EXECUTION = 1, NO_CHANGE = 2 } |
Defines what to do if the insertion time lies before the current simulation time. More... | |
typedef std::pair< Command *, SUMOTime > | Event |
Combination of an event and the time it shall be executed at. More... | |
Public Member Functions | |
SUMOTime | addEvent (Command *operation, SUMOTime execTimeStep, AdaptType type) |
Adds an Event. More... | |
void | execute (SUMOTime time) |
Executes time-dependant commands. More... | |
GUIEventControl () | |
Default constructor. More... | |
bool | isEmpty () |
Returns whether events are in the que. More... | |
void | setCurrentTimeStep (SUMOTime time) |
Set the current Time. More... | |
~GUIEventControl () | |
Destructor. More... | |
Private Member Functions | |
GUIEventControl (const GUIEventControl &) | |
invalid copy constructor. More... | |
GUIEventControl & | operator= (const GUIEventControl &) |
invalid assignment operator. More... | |
Private Attributes | |
MFXMutex | myLock |
The lock used to prohibit parallel addition and processing of events. More... | |
Stores time-dependant events and executes them at the proper time (guisim)
Encapsulates MSEventControl-methods using a lock, prohibiting parallel addition / processing of events what may yield in application break due to broken containers.
Definition at line 53 of file GUIEventControl.h.
|
inherited |
Combination of an event and the time it shall be executed at.
Definition at line 60 of file MSEventControl.h.
|
inherited |
Defines what to do if the insertion time lies before the current simulation time.
Enumerator | |
---|---|
ADAPT_AFTER_EXECUTION |
Patch the time in a way that it is at least as high as the simulation begin time. |
NO_CHANGE |
Do nothing. |
Definition at line 67 of file MSEventControl.h.
GUIEventControl::GUIEventControl | ( | ) |
Default constructor.
Definition at line 44 of file GUIEventControl.cpp.
GUIEventControl::~GUIEventControl | ( | ) |
Destructor.
Definition at line 47 of file GUIEventControl.cpp.
|
private |
invalid copy constructor.
|
virtual |
Adds an Event.
Locks itself before calling MSEventControl::addEvent. Unlock itself after the call.
[in] | operation | The event to add |
[in] | execTimeStep | The time the event shall be executed at |
[in] | type | The adaptation type |
Reimplemented from MSEventControl.
Definition at line 52 of file GUIEventControl.cpp.
References MSEventControl::addEvent(), and myLock.
|
virtual |
Executes time-dependant commands.
Locks itself before calling MSEventControl::execute. Unlock itself after the call.
[in] | time | The current simulation time |
ProcessError | From an executed Command |
Reimplemented from MSEventControl.
Definition at line 61 of file GUIEventControl.cpp.
References MSEventControl::execute(), and myLock.
|
inherited |
Returns whether events are in the que.
Definition at line 119 of file MSEventControl.cpp.
References MSEventControl::myEvents.
Referenced by MSNet::simulationState().
|
private |
invalid assignment operator.
|
inherited |
Set the current Time.
This method is only for Unit Testing. Set the current TimeStep used in addEvent. Normally the time is set automatically from an instance of MSNet.
Definition at line 124 of file MSEventControl.cpp.
References MSEventControl::currentTimeStep.
|
private |
The lock used to prohibit parallel addition and processing of events.
Definition at line 91 of file GUIEventControl.h.
Referenced by addEvent(), and execute().