| Class: | class MpTimerQueue, class MpTimerInterface |
| Include: | #include "mptimerqueue.h" |
| Examples: | MpTimerQueue-demo.cpp |
| Description: | supply versatile interval timer queue |
Class MpTimerQueue is the base class for general purpose interval timers. It manages the timer queue and supplies functions for adding and removing timers, starting timer event processing and getting the time until the next timer expires.
Class MpTimerInterface supplies an abstract interface for the callback that is called when a timer is exhausted. You have to overload it's method virtual void MpTimerInterface::TimerEvent(MpTimerInfo *info).
The structure "struct timeval" as defined in "sys/time.h" is used for
time arguments. Use the convenience inline functions for calculations
with time values defined in
mptimeval.h.
The description can be found here.
The graphical user interface of Matpack contains a class MpTimer which is implemented using this base class.
timeval MpTimerQueue::GetTime(void); |
MpTimerInfo* MpTimerQueue::StartTimer (MpTimerInterface *receiver, int sec, int usec); |
virtual void MpTimerInterface::TimerEvent(MpTimerInfo *info);
to receive the timer events. A pointer to a timer info structure is returned to identify the timer, e.g. for destroying it (via StopTimer, see below).
void MpTimerQueue::StopTimer (MpTimerInfo* info);
|
void MpTimerQueue::StopAllTimers (void);
|
int MpTimerQueue::EvaluateTimers (void);
|
timeval* MpTimerQueue::NextTimer (void);
|
void MpTimerQueue::SleepTime(const timeval& sleep);
|
MpTimerQueue::~MpTimerQueue();
|
| © B.M.Gammel, last change 13 Jan 2001 |