aboutsummaryrefslogtreecommitdiff
path: root/src/Timer.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-08-04 15:55:13 (GMT)
committerfluxgen <fluxgen>2002-08-04 15:55:13 (GMT)
commit56a41b23f9b5ecdef5e9536c2e6eeed0db32e623 (patch)
tree8b6fd3a735918278d54f1d108042d90df696169f /src/Timer.hh
parent380d50ba274c0ceb0a2f973ea464792847a80e6d (diff)
downloadfluxbox-56a41b23f9b5ecdef5e9536c2e6eeed0db32e623.zip
fluxbox-56a41b23f9b5ecdef5e9536c2e6eeed0db32e623.tar.bz2
doxygen comments
Diffstat (limited to 'src/Timer.hh')
-rw-r--r--src/Timer.hh72
1 files changed, 44 insertions, 28 deletions
diff --git a/src/Timer.hh b/src/Timer.hh
index 9b48754..2c7f2c8 100644
--- a/src/Timer.hh
+++ b/src/Timer.hh
@@ -29,61 +29,77 @@
29#include "../config.h" 29#include "../config.h"
30#endif //HAVE_CONFIG_H 30#endif //HAVE_CONFIG_H
31 31
32#ifdef TIME_WITH_SYS_TIME 32#ifdef TIME_WITH_SYS_TIME
33# include <sys/time.h>
34# include <time.h>
35#else // !TIME_WITH_SYS_TIME
36# ifdef HAVE_SYS_TIME_H
37#include <sys/time.h> 33#include <sys/time.h>
38# else // !HAVE_SYS_TIME_H 34#include <time.h>
39# include <time.h> 35#else //!TIME_WITH_SYS_TIME
40# endif // HAVE_SYS_TIME_H 36#ifdef HAVE_SYS_TIME_H
37#include <sys/time.h>
38#else // !HAVE_SYS_TIME_H
39#include <time.h>
40#endif // HAVE_SYS_TIME_H
41#endif // TIME_WITH_SYS_TIME 41#endif // TIME_WITH_SYS_TIME
42 42
43#include <list> 43#include <list>
44 44
45/**
46 Inherit this to have a timed object, that calls
47 timeout function when the time is out
48*/
45class TimeoutHandler { 49class TimeoutHandler {
46public: 50public:
47 virtual void timeout(void) = 0; 51 /// called when the time is out
52 virtual void timeout() = 0;
48}; 53};
49 54
50 55/**
56 Handles TimeoutHandles
57*/
51class BTimer { 58class BTimer {
52public: 59public:
53 explicit BTimer(TimeoutHandler *); 60 explicit BTimer(TimeoutHandler *handler);
54 virtual ~BTimer(void); 61 virtual ~BTimer();
55 62
56 inline int isTiming(void) const { return m_timing; } 63 inline int isTiming() const { return m_timing; }
57 inline int doOnce(void) const { return m_once; } 64 inline int doOnce() const { return m_once; }
58 65
59 inline const timeval &getTimeout(void) const { return m_timeout; } 66 inline const timeval &getTimeout() const { return m_timeout; }
60 inline const timeval &getStartTime(void) const { return m_start; } 67 inline const timeval &getStartTime() const { return m_start; }
61 68
62 inline void fireOnce(bool once) { m_once = once; } 69 inline void fireOnce(bool once) { m_once = once; }
70 /// set timeout
71 void setTimeout(long val);
72 /// set timeout
73 void setTimeout(timeval val);
74 /// start timing
75 void start();
76 /// stop timing
77 void stop();
78 /// update all timers
79 static void updateTimers(int file_descriptor);
63 80
64 void setTimeout(long);
65 void setTimeout(timeval);
66 void start(void);
67 void stop(void);
68 static void updateTimers(int fd);
69protected: 81protected:
70 void fireTimeout(void); 82 /// force a timeout
83 void fireTimeout();
71 84
72private: 85private:
86 /// add a timer to the static list
73 static void addTimer(BTimer *timer); 87 static void addTimer(BTimer *timer);
88 /// remove a timer from the static list
74 static void removeTimer(BTimer *timer); 89 static void removeTimer(BTimer *timer);
75 90
76 typedef std::list<BTimer *> TimerList; 91 typedef std::list<BTimer *> TimerList;
77 static TimerList m_timerlist; 92 static TimerList m_timerlist; ///< list of all timers
78 93
79 TimeoutHandler *m_handler; 94 TimeoutHandler *m_handler; ///< handler
80 95
81 bool m_timing, m_once; 96 bool m_timing; ///< clock running?
97 bool m_once; ///< do timeout only once?
82 98
83 timeval m_start, m_timeout; 99 timeval m_start; ///< start time
100 timeval m_timeout; ///< time length
84 101
85}; 102};
86 103
87 104#endif // TIMER_HH
88#endif // _TIMER_HH_
89 105