Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

Phx::Clock Class Reference

The Clock entity that keeps track of simulated time. More...

#include <PhxClock.h>

Inheritance diagram for Phx::Clock:

Phx::NamedInterface Phx::LockedPtrInterface< NamedInterface > Phx::FrameClock Phx::WallClock List of all members.

Public Member Functions

virtual Ptr< TasknewTask (const String &name)=0
 Creates a new Task subinterface that allows the client to install a listener to be invoked at a scheduled time.
virtual Ptr< TimernewTimer (void)=0
 Creates a new Timer whose sense of time is governed by this Clock.
virtual double time (void) const =0
 Read the current time.
virtual void time (double time)=0
 Sets the current reported time to time.
virtual double rate (void) const =0
 Gets the current rate of this Clock.
virtual void rate (double rate)=0
 Sets the current rate of this Clock.

Classes

class  Task
 A Task is an interface to a Clock that allows you to schedule a callback based on the Clock. More...
class  Timer
 The Timer is a sub-interface to a clock that keeps track of elapsed time relative to the clock. More...

Detailed Description

The Clock entity that keeps track of simulated time.

In addition to reporting its current recorded time, it also allows clients to obtain their own clock based on it, and also schedule Tasks for execution at a particular time.

Every Clock has a "reference time", relative to which it measures its "reported time" (the time shown via the time() attribute to the client). As a client, you may increase the rate at which the reported time advances, and you may explicitly change the current reported time. Most Clock types will define what their reference time is, and this will generally determine the rest of the Clock's behavior.

Todo:
Define requirements for the behavior of time. Requiring that time be non-decreasing feels a little strong, but allowing it to be otherwise makes things very difficult for clients -- most, I suspect, will just crash if time ever goes backward.


Member Function Documentation

virtual Ptr<Task> Phx::Clock::newTask const String &  name  )  [pure virtual]
 

Creates a new Task subinterface that allows the client to install a listener to be invoked at a scheduled time.

Returns:
A pointer to a new Clock::Task attached to this Clock.

virtual Ptr<Timer> Phx::Clock::newTimer void   )  [pure virtual]
 

Creates a new Timer whose sense of time is governed by this Clock.

The Timer's initial time is 0 and changes (initially) at the same rate as this Clock. As this Clock changes (either by the client changing it or by its internal clock advancing), the Timer will change by a corresponding amount, adjusted for the rate of the timer.

Note:
If the client of the reference clock explicitly changes the time, it will change the time of all of the timers attached to it. This may lead to discontinuous changes in the reported time during the simulation. You should not use such a clock as your reference if this is problematic. Instead, select one of the recognized system clocks stored in the Core that are guaranteed not to make such jumps.
Returns:
A new Timer that measures time with respect to this clock.

virtual void Phx::Clock::rate double  rate  )  [pure virtual]
 

Sets the current rate of this Clock.

Parameters:
rate The new rate at which this Clock's time will advance relative to its reference time.

virtual double Phx::Clock::rate void   )  const [pure virtual]
 

Gets the current rate of this Clock.

Returns:
The current rate at which this Clock's reported time will advance relative to its reference time.

virtual void Phx::Clock::time double  time  )  [pure virtual]
 

Sets the current reported time to time.

Parameters:
time The new current measured time.

virtual double Phx::Clock::time void   )  const [pure virtual]
 

Read the current time.

Returns:
The time measured by this Clock.


The documentation for this class was generated from the following file:
Generated on Mon Jul 10 19:45:29 2006 for Phoenix OSFS by  doxygen 1.4.2