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

strmod::unievent::TimerEventTracker Class Reference

Tracks Timer events, can be used to implement Timer. More...

#include <UniEvent/TimerEventTracker.h>

Inheritance diagram for strmod::unievent::TimerEventTracker:

Inheritance graph
[legend]
List of all members.

Public Methods

 TimerEventTracker ()
 Construct using the ANSI C time function to provide an initial base.

 TimerEventTracker (const absolute_t &now)
 Construct using now as an initial base.

virtual ~TimerEventTracker ()
 Nothing special or unexpected.

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)
 Post an event at a particular time.

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

unsigned int postExpired (const absolute_t &now, Dispatcher *postto)
 Post all expired timer events.

interval_t nextExpirationIn (const absolute_t &now, const interval_t &maxtime) const
 Return the time of the next timer expiration, or maxtime.

virtual bool invariant () const
 This should ALWAYS return true. It says whether the class invariant holds or not.

virtual void printState (::std::ostream &os) const
 This should print out as much of the internal state of a class as would be needed to debug it properly.


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

Tracks Timer events, can be used to implement Timer.

Definition at line 41 of file TimerEventTracker.h.


Member Function Documentation

virtual int strmod::unievent::TimerEventTracker::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::Debugable.

Reimplemented in strmod::unievent::UnixEventPoll.

Definition at line 55 of file TimerEventTracker.h.

virtual const lcore::ClassIdent* strmod::unievent::TimerEventTracker::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::Debugable.

Reimplemented in strmod::unievent::UnixEventPoll.

Definition at line 93 of file TimerEventTracker.h.

virtual bool strmod::unievent::TimerEventTracker::invariant   const [inline, virtual]
 

This should ALWAYS return true. It says whether the class invariant holds or not.

Your class invariant should be as strict as possible. The class invariant is used to detect when the class goes into a bad state, so all possible bad states should be caught by the invariant.

Implements strmod::lcore::Debugable.

Reimplemented in strmod::unievent::UnixEventPoll.

Definition at line 89 of file TimerEventTracker.h.

Timer::interval_t strmod::unievent::TimerEventTracker::nextExpirationIn const absolute_t   now,
const interval_t   maxtime
const
 

Return the time of the next timer expiration, or maxtime.

Parameters:
now What time to calculate the next expiration from.
maxtime The maximum interval to return.
Returns:
The internval from now until the next expiration. If there is no timer scheduled to expire, or it's farther than maxtime into the future, maxtime is returned.

Definition at line 158 of file TimerEventTracker.cxx.

unsigned int strmod::unievent::TimerEventTracker::postExpired const absolute_t   now,
Dispatcher   postto
 

Post all expired timer events.

Parameters:
now What you want the current time to be for the purposes of expiration
postto The Dispatcher to post the events to.
Returns:
The number of events posted.
Each call of this function must have a now parameter that is >= the now parameter given in the previous call. In other words, the now parameter must monotonically increase in subsequent calls.

Also, the first now must be >= the now you gave in the constructor, or the value returned by the time() ANSI C call at construction time if you didn't give a value in the constructor.

Definition at line 95 of file TimerEventTracker.cxx.


Member Data Documentation

const UNEVT_ClassIdent strmod::unievent::TimerEventTracker::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::Debugable.

Reimplemented in 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