Class: TClock

Declaration: LowLevelClock.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

TDateTimeClock TSyncableClock TSystemClock

Purpose:

An abstract base class that provides a common interface for basic clock functionality such as: adding and removing alarms, delaying, and getting the time. TClock is used by TSystemClock and TSyncableClock, and should be used by any clock derived classes that need this functionality or any new clock designs. TClock provides a Clone operator to help support polymorphic use of clocks. TClock provides the interface to support TDelay.

Instantiation:

Abstract base class; do not instantiate directly. Allocate on the heap or the stack.

Deriving Classes:

Use this class (or other derived class) when providing a clock interface. The API for all functions must be supported by all derived classes, and overridden functions. Clocks are not necessarily streamable, and when copied, they provide the same time representation of the clock. (Alarms added on one clock cannot be removed by a copy of that clock.) All functions must be overridden except TClock::DelayFor.

Concurrency:

Multithread safe.

Resource Use:

No special requirements.

Member Function: TClock::~TClock

virtual ~ TClock ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TClock::Now

virtual void Now (TTime & theTime) const

Interface Category:

API.

Purpose:

Gets the current time.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TClock::DelayFor

virtual void DelayFor (const TTime & amountOfTime)

Interface Category:

API.

Purpose:

Delays the calling thread for the amountOfTime. It actually delays the calling thread until the amountOfTime + the current time.

Calling Context:

Called directly by the thread that wants to delay.

Parameters:

Return Value:

None.

Exceptions:

Throws TClockException::kTTimeIsNaN if the pointInTime is a NaN.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TClock::DelayUntil

virtual void DelayUntil (const TTime & pointInTime)

Interface Category:

API.

Purpose:

Delays the calling thread until the pointInTime is current or in the past.

Calling Context:

Called directly by the thread that wants to delay.

Parameters:

Return Value:

None.

Exceptions:

Derived classes should throw TClockException::kTTimeIsNaN if the pointInTime is a NaN.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TClock::operator=

TClock & operator =(const TClock & aClock)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

Derived classes should provide an assignment operator for their class.

Member Function: TClock::TClock

  1. TClock ()
  2. TClock (const TClock &)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.

Calling Context:

  1. Always called unless being copied.
  2. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TClock::GetClockSurrogate

virtual void GetClockSurrogate (TSyncableClockSurrogate & sur) const

Interface Category:

API.

Purpose:

Gets a TSyncableClockSurrogate to sync a TSyncableClock to the time source that represents this clock.

Calling Context:

Called to sync a TSyncableClock to the time source for this clock.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.