Async 1.8.0
AsyncTimer.h
Go to the documentation of this file.
1
37#ifndef ASYNC_TIMER_INCLUDED
38#define ASYNC_TIMER_INCLUDED
39
40
41/****************************************************************************
42 *
43 * System Includes
44 *
45 ****************************************************************************/
46
47#include <sigc++/sigc++.h>
48
49
50
51/****************************************************************************
52 *
53 * Project Includes
54 *
55 ****************************************************************************/
56
57
58
59/****************************************************************************
60 *
61 * Local Includes
62 *
63 ****************************************************************************/
64
65
66
67/****************************************************************************
68 *
69 * Forward declarations
70 *
71 ****************************************************************************/
72
73
74
75/****************************************************************************
76 *
77 * Namespace
78 *
79 ****************************************************************************/
80
81namespace Async
82{
83
84/****************************************************************************
85 *
86 * Defines & typedefs
87 *
88 ****************************************************************************/
89
90
91
92/****************************************************************************
93 *
94 * Exported Global Variables
95 *
96 ****************************************************************************/
97
98
99
100/****************************************************************************
101 *
102 * Class definitions
103 *
104 ****************************************************************************/
105
116class Timer : public sigc::trackable
117{
118 public:
122 typedef enum
123 {
127
142 Timer(int timeout_ms = 0, Type type = TYPE_ONESHOT, bool enabled=true);
143
147 ~Timer(void);
148
153 Type type(void) const { return m_type; }
154
167 void setTimeout(int timeout_ms);
168
173 int timeout(void) const { return m_timeout_ms; }
174
183 void setEnable(bool do_enable);
184
190 bool isEnabled(void) const { return m_is_enabled; }
191
200 void reset(void);
201
210 sigc::signal<void, Timer *> expired;
211
212
213 protected:
214
215 private:
216 Type m_type;
217 int m_timeout_ms;
218 bool m_is_enabled;
219
220}; /* class Timer */
221
222
223} /* namespace */
224
225#endif /* ASYNC_TIMER_INCLUDED */
226
227
228
229/*
230 * This file has not been truncated
231 */
232
A class that produces timer events.
Definition AsyncTimer.h:117
Type
The type of the timer.
Definition AsyncTimer.h:123
@ TYPE_PERIODIC
A timer that restarts itself every time it expires.
Definition AsyncTimer.h:125
@ TYPE_ONESHOT
A timer that expires once.
Definition AsyncTimer.h:124
Timer(int timeout_ms=0, Type type=TYPE_ONESHOT, bool enabled=true)
Constructor.
int timeout(void) const
Return the setting of the timeout value.
Definition AsyncTimer.h:173
~Timer(void)
Destructor.
void setTimeout(int timeout_ms)
Set (change) the timeout value.
Type type(void) const
Return the type of this timer.
Definition AsyncTimer.h:153
bool isEnabled(void) const
Check if the timer is enabled.
Definition AsyncTimer.h:190
void reset(void)
Reset (restart) the timer.
void setEnable(bool do_enable)
Enable or disable the timer.
sigc::signal< void, Timer * > expired
A signal that is emitted when the timer expires.
Definition AsyncTimer.h:210
Namespace for the asynchronous programming classes.