Eclipse SUMO - Simulation of Urban MObility
|
Stores time-dependant events and executes them at the proper time (guisim) More...
#include <GUIEventControl.h>
Public Types | |
typedef std::pair< Command *, SUMOTime > | Event |
Combination of an event and the time it shall be executed at. | |
Public Member Functions | |
void | addEvent (Command *operation, SUMOTime execTimeStep=-1) |
Adds an Event. | |
void | clearState (SUMOTime currentTime, SUMOTime newTime) |
Remove all events before quick-loading state. | |
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 | |
GUIEventControl () | |
Default constructor. | |
bool | isEmpty () |
Returns whether events are in the que. | |
~GUIEventControl () | |
Destructor. | |
Static Protected Member Functions | |
static bool | eventCompare (const Event &e1, const Event &e2) |
compares two events | |
Private Member Functions | |
GUIEventControl (const GUIEventControl &) | |
invalid copy constructor. | |
GUIEventControl & | operator= (const GUIEventControl &) |
invalid assignment operator. | |
Private Attributes | |
std::vector< Event > | myEvents |
Event-container, holds executable events. | |
FXMutex | myLock |
The lock used to prohibit parallel addition and processing of events. | |
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 38 of file GUIEventControl.h.
|
inherited |
Combination of an event and the time it shall be executed at.
Definition at line 50 of file MSEventControl.h.
GUIEventControl::GUIEventControl | ( | ) |
Default constructor.
Definition at line 31 of file GUIEventControl.cpp.
GUIEventControl::~GUIEventControl | ( | ) |
Destructor.
Definition at line 36 of file GUIEventControl.cpp.
|
private |
invalid copy constructor.
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 (-1 means at sim start) |
Reimplemented from MSEventControl.
Definition at line 41 of file GUIEventControl.cpp.
References MSEventControl::addEvent(), and myLock.
Remove all events before quick-loading state.
Definition at line 103 of file MSEventControl.cpp.
References MSEventControl::eventCompare(), and MSEventControl::myEvents.
Referenced by MSNet::clearState().
compares two events
Definition at line 98 of file MSEventControl.cpp.
Referenced by MSEventControl::addEvent(), MSEventControl::clearState(), and MSEventControl::execute().
|
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 48 of file GUIEventControl.cpp.
References MSEventControl::execute(), and myLock.
get the next scheduled event time for the given command, -2 if it is not scheduled
|
inherited |
Returns whether events are in the que.
Definition at line 93 of file MSEventControl.cpp.
References MSEventControl::myEvents.
|
private |
invalid assignment operator.
|
privateinherited |
Event-container, holds executable events.
Definition at line 110 of file MSEventControl.h.
Referenced by MSEventControl::addEvent(), MSEventControl::clearState(), MSEventControl::execute(), MSEventControl::isEmpty(), and MSEventControl::~MSEventControl().
|
private |
The lock used to prohibit parallel addition and processing of events.
Definition at line 74 of file GUIEventControl.h.
Referenced by addEvent(), and execute().