|
INET Framework for OMNeT++/OMNEST
|
This class defines the interface for clocks. More...
#include <IClock.h>
Public Member Functions | |
| virtual | ~IClock () |
| virtual clocktime_t | getClockTime () const =0 |
| Returns the current clock time. More... | |
| virtual clocktime_t | computeClockTimeFromSimTime (simtime_t time) const =0 |
| Returns the clock time for the specified future simulation time according to the current state of the clock. More... | |
| virtual simtime_t | computeSimTimeFromClockTime (clocktime_t time) const =0 |
| Returns the simulation time (first moment) for the specified future clock time according to the current state of the clock. More... | |
| virtual void | scheduleClockEventAt (clocktime_t time, ClockEvent *event)=0 |
| Schedules an event to be delivered to the caller module (i.e. More... | |
| virtual void | scheduleClockEventAfter (clocktime_t delay, ClockEvent *event)=0 |
| Schedules an event to be delivered to the caller module (i.e. More... | |
| virtual ClockEvent * | cancelClockEvent (ClockEvent *event)=0 |
| Cancels a previously scheduled clock event. More... | |
| virtual void | handleClockEvent (ClockEvent *event)=0 |
| Called by the clock event to be executed in the context of this clock. More... | |
This class defines the interface for clocks.
See the corresponding NED file for details.
The typical way to use a clock is to derive your class or module from either ClockUserModuleBase or ClockUserModuleMixin. Then you can use the inherited clock related methods or the methods of this interface on the inherited clock field.
The clock interface requires the following properties.
|
pure virtual |
Cancels a previously scheduled clock event.
The clock event ownership is transferred to the caller.
Implemented in inet::ClockBase, inet::OscillatorBasedClock, and inet::MultiClock.
Referenced by inet::MultiClock::cancelClockEvent().
|
pure virtual |
Returns the clock time for the specified future simulation time according to the current state of the clock.
This method implements a monotonic function with respect to the simulation time argument. It's allowed to return a different value for the same argument value if the clock is set between calls. The time argument must be greater than or equal to the current simulation time, otherwise an error is raised. See SIMTIME_AS_CLOCKTIME macro for simple type conversion.
Implemented in inet::MultiClock, inet::OscillatorBasedClock, and inet::IdealClock.
Referenced by inet::MultiClock::computeClockTimeFromSimTime(), and inet::ClockBase::getClockTime().
|
pure virtual |
Returns the simulation time (first moment) for the specified future clock time according to the current state of the clock.
This method implements a monotonic function with respect to the clock time argument. It's allowed to return a different value for the same argument value if the clock is set between calls. The time argument must be greater or than equal to the current clock time, otherwise an error is raised. See CLOCKTIME_AS_SIMTIME macro for simple type conversion.
Implemented in inet::MultiClock, inet::OscillatorBasedClock, and inet::IdealClock.
Referenced by inet::MultiClock::computeSimTimeFromClockTime(), inet::ClockBase::scheduleClockEventAfter(), and inet::ClockBase::scheduleClockEventAt().
|
pure virtual |
Returns the current clock time.
Note that the clock time is not necessarily monotonous in execution order. For example, the clock time may decrease even at the same simulation time.
Implemented in inet::ClockBase, and inet::MultiClock.
Referenced by inet::MultiClock::getClockTime().
|
pure virtual |
Called by the clock event to be executed in the context of this clock.
This method is primarily useful for clock implementations to update their internal data structures related to individual clock events.
Implemented in inet::ClockBase, inet::OscillatorBasedClock, and inet::MultiClock.
Referenced by inet::MultiClock::handleClockEvent(), and inet::Register_Class().
|
pure virtual |
Schedules an event to be delivered to the caller module (i.e.
the context module) after the given clock time delay has elapsed. The event is anchored to a specific clock time duration, so the actual simulation time when this event is executed is not affected if the clock time is set later. On the other hand, setting the clock drift still affects the simulation time of the event execution.
Implemented in inet::ClockBase, inet::OscillatorBasedClock, and inet::MultiClock.
Referenced by inet::MultiClock::scheduleClockEventAfter().
|
pure virtual |
Schedules an event to be delivered to the caller module (i.e.
the context module) at the specified clock time. The event is anchored to a specific clock time value, so the actual simulation time when this event is executed will be affected if the clock time is set later.
Implemented in inet::ClockBase, inet::MultiClock, and inet::OscillatorBasedClock.
Referenced by inet::MultiClock::scheduleClockEventAt().