Async 1.8.0
AsyncAtTimer.h
Go to the documentation of this file.
1
36#ifndef ASYNC_AT_TIMER_INCLUDED
37#define ASYNC_AT_TIMER_INCLUDED
38
39
40/****************************************************************************
41 *
42 * System Includes
43 *
44 ****************************************************************************/
45
46#include <time.h>
47#include <sys/time.h>
48#include <sigc++/sigc++.h>
49
50
51/****************************************************************************
52 *
53 * Project Includes
54 *
55 ****************************************************************************/
56
57#include <AsyncTimer.h>
58
59
60/****************************************************************************
61 *
62 * Local Includes
63 *
64 ****************************************************************************/
65
66
67
68/****************************************************************************
69 *
70 * Forward declarations
71 *
72 ****************************************************************************/
73
74
75
76/****************************************************************************
77 *
78 * Namespace
79 *
80 ****************************************************************************/
81
82namespace Async
83{
84
85
86/****************************************************************************
87 *
88 * Forward declarations of classes inside of the declared namespace
89 *
90 ****************************************************************************/
91
92
93
94/****************************************************************************
95 *
96 * Defines & typedefs
97 *
98 ****************************************************************************/
99
100
101
102/****************************************************************************
103 *
104 * Exported Global Variables
105 *
106 ****************************************************************************/
107
108
109
110/****************************************************************************
111 *
112 * Class definitions
113 *
114 ****************************************************************************/
115
136class AtTimer : public sigc::trackable
137{
138 public:
144 AtTimer(void);
145
152 explicit AtTimer(struct tm &tm, bool do_start=true);
153
157 ~AtTimer(void);
158
164 bool setTimeout(time_t t);
165
171 bool setTimeout(struct tm &tm);
172
182 void setExpireOffset(int offset_ms);
183
188 bool start(void);
189
193 void stop(void);
194
203 sigc::signal<void, AtTimer *> expired;
204
205 protected:
206
207 private:
208 Timer m_timer {-1};
209 struct timeval m_expire_at;
210 int m_expire_offset {0};
211
212 AtTimer(const AtTimer&);
213 AtTimer& operator=(const AtTimer&);
214 int msecToTimeout(void);
215 void onTimerExpired(Timer *t);
216
217}; /* class AtTimer */
218
219
220} /* namespace */
221
222#endif /* ASYNC_AT_TIMER_INCLUDED */
223
224
225
226/*
227 * This file has not been truncated
228 */
229
Contains a single shot or periodic timer that emits a signal on timeout.
A timer that times out at a specified absolute time.
AtTimer(struct tm &tm, bool do_start=true)
Constuctor.
~AtTimer(void)
Destructor.
sigc::signal< void, AtTimer * > expired
A signal that is emitted when the timer expires.
bool start(void)
Start the timer.
bool setTimeout(struct tm &tm)
Set the timeout time.
void setExpireOffset(int offset_ms)
Set the expire offset.
void stop(void)
Stop the timer.
bool setTimeout(time_t t)
Set the timeout time.
AtTimer(void)
Default constructor.
A class that produces timer events.
Definition AsyncTimer.h:117
Namespace for the asynchronous programming classes.