X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Ftimerqueuemanager.hh;fp=otk%2Ftimerqueuemanager.hh;h=48e15e5b2cf283ef1ebe7c4dcd712a565f924ce9;hb=b0a532db8adeb909fa2cd8e518ca6917a2d7df0a;hp=0000000000000000000000000000000000000000;hpb=d4d89ce0bbd3dd0c556a593accb5e48f7ae09d9e;p=chaz%2Fopenbox diff --git a/otk/timerqueuemanager.hh b/otk/timerqueuemanager.hh new file mode 100644 index 00000000..48e15e5b --- /dev/null +++ b/otk/timerqueuemanager.hh @@ -0,0 +1,45 @@ +// -*- mode: C++; indent-tabs-mode: nil; -*- +#ifndef __timerqueuemanager_hh +#define __timerqueuemanager_hh + +#include "timerqueue.hh" + +namespace otk { + +//! Manages a queue of OBTimer objects +/*! + All OBTimer objects add themself to an OBTimerQueueManager. The manager is + what fires the timers when their time has elapsed. This is done by having the + application call the OBTimerQueueManager::fire class in its main event loop. +*/ +class OBTimerQueueManager { +private: + //! A priority queue of all timers being managed by this class. + TimerQueue timerList; +public: + //! Constructs a new OBTimerQueueManager + OBTimerQueueManager() {} + //! Destroys the OBTimerQueueManager + virtual ~OBTimerQueueManager() {} + + //! Will wait for and fire the next timer in the queue. + /*! + The function will stop waiting if an event is received from the X server. + */ + virtual void fire(); + + //! Adds a new timer to the queue + /*! + @param timer An OBTimer to add to the queue + */ + virtual void addTimer(OBTimer* timer); + //! Removes a timer from the queue + /*! + @param timer An OBTimer already in the queue to remove + */ + virtual void removeTimer(OBTimer* timer); +}; + +} + +#endif // __timerqueuemanager_hh