Command Class Reference

#include <Command.h>

Inheritance diagram for Command:

Command_SaveTLSState Command_SaveTLSSwitches Command_SaveTLSSwitchStates CommandMock MSCalibrator::MSCalibrator_FileTriggeredChild MSEmitter::MSEmitter_FileTriggeredChild MSTLLogicControl::SwitchInitCommand MSTrafficLightLogic::SwitchCommand MSVTypeProbe StaticCommand< T > WrappingCommand< T >

Detailed Description

Base (microsim) event class.

Classes derived from Command may be added to MSEventControl instances in order to be executed at a certain time step.

As soon as the simulation reaches the desired time step, the command (event) is executed by calling "execute" with the current time step. The method must return either 0, if the event shall not be executed again or a positive value (in simulation seconds) that described when it shall be executed again. The method must not return a value below zero, the behaviour is undefined in this case.

Warning:
The EventControl the Command is added to gets responsible for this command's deletion.
See also:
Design Patterns, Gamma et al.

WrappingCommand

MSEventControl

Definition at line 59 of file Command.h.


Public Member Functions

 Command () throw ()
 Constructor.
virtual SUMOTime execute (SUMOTime currentTime)=0 throw (ProcessError)
 Executes the command.
virtual ~Command () throw ()
 Destructor.

Constructor & Destructor Documentation

Command::Command (  )  throw () [inline]

Constructor.

Definition at line 62 of file Command.h.

00062 { }

virtual Command::~Command (  )  throw () [inline, virtual]

Destructor.

Definition at line 66 of file Command.h.

00066 { }


Member Function Documentation

virtual SUMOTime Command::execute ( SUMOTime  currentTime  )  throw (ProcessError) [pure virtual]

Executes the command.

The implementations should return 0 if the command shall not be repeated, or a value larger than 0 that describe the time after which the command shall be executed again. Values below 0 must not be returned.

Parameters:
[in] currentTime The current simulation time
Returns:
The time after which the command shall be executed again, 0 if this command shall be descheduled.
Exceptions:
ProcessError Derived actions may throw this exception

Implemented in Command_SaveTLSState, Command_SaveTLSSwitches, Command_SaveTLSSwitchStates, MSVTypeProbe, MSTLLogicControl::SwitchInitCommand, MSTrafficLightLogic::SwitchCommand, MSCalibrator::MSCalibrator_FileTriggeredChild, MSEmitter::MSEmitter_FileTriggeredChild, StaticCommand< T >, WrappingCommand< T >, CommandMock, WrappingCommand< MSDevice_HBEFA >, and WrappingCommand< MSDevice_Routing >.

Referenced by MSEventControl::execute().


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

Generated on Wed May 5 00:06:40 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6