Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

strmod::unievent::Timer Class Reference

Posts events that happen based on time. More...

#include <UniEvent/Timer.h>

Inheritance diagram for strmod::unievent::Timer:

Inheritance graph
[legend]
List of all members.

Public Types

typedef ::time_t time_t
 The system time type.


Public Methods

 Timer ()
 Construct a Timer.

virtual ~Timer ()
 Destroy a Timer. All events and the times they were supposed to happen are forgotten.

virtual int AreYouA (const lcore::ClassIdent &cid) const
 Asks if a class is of a particular type, or publicly derived from that type.

virtual void postAt (const absolute_t &t, const EventPtr &ev)=0
 Post an event at a particular time.

virtual void postIn (const interval_t &off, const EventPtr &ev)
 Post an event after a certain amount of time has expired.

virtual absolute_t currentTime () const=0
 What time is it now?!


Static Public Attributes

const UNEVT_ClassIdent identifier
 Globally unique identifier for this class.


Protected Methods

virtual const lcore::ClassIdent * i_GetIdent () const
 Returns the class identifier for the class the object actually is.


Detailed Description

Posts events that happen based on time.

The ANSI C standard defines a rather anemic set of types for dealing with time. Worse, the exact values in most of the types are OS specific. You cannot count on time_t representing a value in the unit of seconds, for example.

Since this is supposed to a generic, OS agnostic interface, this leaves us in something of a quandry. The ANSI things _do_ tend to be focused on calendar time though, so using our own interval type is perfectly reasonable.

Given an interval type, it's reasonable to use the interval as an offset from a time_t without encoding any knowledge of what a time_t actually represents into the interface.

It's tempting to use the rather well defined struct tm type until you examine it closely and realize that it contains no provision for representing the timezone. Since it actually contains time information that would be different in different timezones, this is a fatal lack. A time_t is sufficiently ambiguous that the questions of whether or not it is UTC or a local time zone, and whether or not this can even be determined in the environment are not important to the interface.

Definition at line 67 of file Timer.h.


Member Function Documentation

virtual int strmod::unievent::Timer::AreYouA const lcore::ClassIdent &    cid const [inline, virtual]
 

Asks if a class is of a particular type, or publicly derived from that type.

Overriden in every derived class (with a static identifier member) to compare against the identifier, then call the AreYouA methods of all the superclasses.

Parameters:
cid Usually <class>::identifier for the class you want to ask if the object is an instance of.

Reimplemented from strmod::lcore::Protocol.

Reimplemented in strmod::unievent::TimerEventTracker, and strmod::unievent::UnixEventPoll.

Definition at line 125 of file Timer.h.

virtual const lcore::ClassIdent* strmod::unievent::Timer::i_GetIdent   const [inline, protected, virtual]
 

Returns the class identifier for the class the object actually is.

Should always be overridden in any class that has a static identifier member.

Reimplemented from strmod::lcore::Protocol.

Reimplemented in strmod::unievent::TimerEventTracker, and strmod::unievent::UnixEventPoll.

Definition at line 137 of file Timer.h.


Member Data Documentation

const UNEVT_ClassIdent strmod::unievent::Timer::identifier [static]
 

Globally unique identifier for this class.

Every class that might need to be identified should have a public static const identifier object in it.

Reimplemented from strmod::lcore::Protocol.

Reimplemented in strmod::unievent::TimerEventTracker, and strmod::unievent::UnixEventPoll.


The documentation for this class was generated from the following files:
Generated on Wed Jan 29 00:32:57 2003 for libNet by doxygen1.3-rc1