39 : currentTimeStep(-1), myEvents() {}
63 if (currEvent.second < 0) {
64 currEvent.second = execTime;
66 if (currEvent.second < execTime +
DELTA_T) {
67 Command* command = currEvent.first;
71 time = command->
execute(execTime);
81 WRITE_WARNING(
"Command returned negative repeat number; will be deleted.");
83 delete currEvent.first;
85 currEvent.second += time;
MSEventControl()
Default constructor.
virtual void execute(SUMOTime time)
Executes time-dependant commands.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Base (microsim) event class.
#define WRITE_WARNING(msg)
SUMOTime currentTimeStep
The current TimeStep.
virtual SUMOTime execute(SUMOTime currentTime)=0
Executes the command.
void setCurrentTimeStep(SUMOTime time)
Set the current Time.
std::pair< Command *, SUMOTime > Event
Combination of an event and the time it shall be executed at.
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
EventCont myEvents
Event-container, holds executable events.
SUMOTime getCurrentTimeStep()
get the Current TimeStep used in addEvent.
virtual ~MSEventControl()
Destructor.
bool isEmpty()
Returns whether events are in the que.