next up previous contents index
Next: 10.1.1 Definition of a Up: 10. Timers Previous: 10. Timers

   
10.1 C++ abstract base class TimerHandler

The abstract base class TimerHandler contains the following public member functions:


\begin{tabularx}{\linewidth}{rX}
\fcn[double delay]{void sched} & schedule a ti...
...tus
(either TIMER\_IDLE, TIMER\_PENDING, or TIMER\_HANDLING) \\
\end{tabularx}

The abstract base class TimerHandler contains the following protected members:


\begin{tabularx}{\linewidth}{rlX}
\fcn[Event* e]{virtual void expire} & {\tt =0}...
...vent event\\ _} & & event to be consumed upon timer expiration\\
\end{tabularx}

The pure virtual functions must be defined by the timer classes deriving from this abstract base class.

Finally, two private inline functions are defined:

        inline void _sched(double delay) {
            (void)Scheduler::instance().schedule(this, &event_, delay);
        }
        inline void _cancel() {
            (void)Scheduler::instance().cancel(&event_);
        }

From this code we can see that timers make use of methods of the Scheduler class.



 


2000-08-24