INET Framework for OMNeT++/OMNEST
inet::IdealClock Class Reference

#include <IdealClock.h>

Inheritance diagram for inet::IdealClock:
inet::ClockBase inet::IClock inet::StringFormat::IDirectiveResolver

Public Member Functions

virtual clocktime_t computeClockTimeFromSimTime (simtime_t t) const override
 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 t) const override
 Returns the simulation time (first moment) for the specified future clock time according to the current state of the clock. More...
 
- Public Member Functions inherited from inet::ClockBase
virtual clocktime_t getClockTime () const override
 Returns the current clock time. More...
 
virtual void scheduleClockEventAt (clocktime_t time, ClockEvent *event) override
 Schedules an event to be delivered to the caller module (i.e. More...
 
virtual void scheduleClockEventAfter (clocktime_t time, ClockEvent *event) override
 Schedules an event to be delivered to the caller module (i.e. More...
 
virtual ClockEventcancelClockEvent (ClockEvent *event) override
 Cancels a previously scheduled clock event. More...
 
virtual void handleClockEvent (ClockEvent *event) override
 Called by the clock event to be executed in the context of this clock. More...
 
virtual const char * resolveDirective (char directive) const override
 
- Public Member Functions inherited from inet::IClock
virtual ~IClock ()
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual void finish () override
 
- Protected Member Functions inherited from inet::ClockBase
virtual int numInitStages () const override
 
virtual void refreshDisplay () const override
 
virtual void updateDisplayString () const
 
cSimpleModule * getTargetModule () const
 

Additional Inherited Members

- Static Public Attributes inherited from inet::ClockBase
static simsignal_t timeChangedSignal = cComponent::registerSignal("timeChanged")
 
- Protected Attributes inherited from inet::ClockBase
clocktime_t clockEventTime = -1
 
const char * displayStringTextFormat = nullptr
 

Member Function Documentation

◆ computeClockTimeFromSimTime()

clocktime_t inet::IdealClock::computeClockTimeFromSimTime ( simtime_t  time) const
overridevirtual

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.

Implements inet::IClock.

28 {
29  return ClockTime::from(t);
30 }

◆ computeSimTimeFromClockTime()

simtime_t inet::IdealClock::computeSimTimeFromClockTime ( clocktime_t  time) const
overridevirtual

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.

Implements inet::IClock.

33 {
34  return clock.asSimTime();
35 }

◆ finish()

void inet::IdealClock::finish ( )
overrideprotectedvirtual

Reimplemented from inet::ClockBase.

22 {
24  emit(timeChangedSignal, simTime());
25 }

◆ initialize()

void inet::IdealClock::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::ClockBase.

15 {
16  ClockBase::initialize(stage);
17  if (stage == INITSTAGE_LOCAL)
18  emit(timeChangedSignal, simTime());
19 }

The documentation for this class was generated from the following files:
inet::ClockTime::from
static ClockTime from(SimTime t)
Convert from SimTime.
Definition: common/ClockTime.h:185
inet::ClockBase::timeChangedSignal
static simsignal_t timeChangedSignal
Definition: ClockBase.h:21
inet::ClockBase::finish
virtual void finish() override
Definition: ClockBase.cc:24
inet::ClockBase::initialize
virtual void initialize(int stage) override
Definition: ClockBase.cc:14
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes: