Async  1.3.1
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 
81 namespace 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 
116 class Timer : public sigc::trackable
117 {
118  public:
122  typedef enum
123  {
126  } Type;
127 
138  Timer(int timeout_ms = 0, Type type = TYPE_ONESHOT);
139 
143  ~Timer(void);
144 
149  Type type(void) const { return m_type; }
150 
160  void setTimeout(int timeout_ms);
161 
166  int timeout(void) const { return m_timeout_ms; }
167 
173  void setEnable(bool do_enable);
174 
180  bool isEnabled(void) const { return m_is_enabled; }
181 
190  void reset(void);
191 
200  sigc::signal<void, Timer *> expired;
201 
202 
203  protected:
204 
205  private:
206  Type m_type;
207  int m_timeout_ms;
208  bool m_is_enabled;
209 
210 }; /* class Timer */
211 
212 
213 } /* namespace */
214 
215 #endif /* ASYNC_TIMER_INCLUDED */
216 
217 
218 
219 /*
220  * This file has not been truncated
221  */
222 
~Timer(void)
Destructor.
sigc::signal< void, Timer * > expired
A signal that is emitted when the timer expires.
Definition: AsyncTimer.h:200
void reset(void)
Reset (restart) the timer.
void setEnable(bool do_enable)
Enable or disable the timer.
int timeout(void) const
Return the setting of the timeout value.
Definition: AsyncTimer.h:166
A timer that restarts itself every time it expires.
Definition: AsyncTimer.h:125
A class that produces timer events.
Definition: AsyncTimer.h:116
bool isEnabled(void) const
Check if the timer is enabled.
Definition: AsyncTimer.h:180
Timer(int timeout_ms=0, Type type=TYPE_ONESHOT)
Constructor.
A timer that expires once.
Definition: AsyncTimer.h:124
Namespace for the asynchronous programming classes.
Type
The type of the timer.
Definition: AsyncTimer.h:122
void setTimeout(int timeout_ms)
Set (change) the timeout value.
Type type(void) const
Return the type of this timer.
Definition: AsyncTimer.h:149