Async 1.7.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 <sigc++/sigc++.h>
48
49
50/****************************************************************************
51 *
52 * Project Includes
53 *
54 ****************************************************************************/
55
56#include <AsyncTimer.h>
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 *
87 * Forward declarations of classes inside of the declared namespace
88 *
89 ****************************************************************************/
90
91
92
93/****************************************************************************
94 *
95 * Defines & typedefs
96 *
97 ****************************************************************************/
98
99
100
101/****************************************************************************
102 *
103 * Exported Global Variables
104 *
105 ****************************************************************************/
106
107
108
109/****************************************************************************
110 *
111 * Class definitions
112 *
113 ****************************************************************************/
114
135class AtTimer : public sigc::trackable
136{
137 public:
143 AtTimer(void);
144
151 explicit AtTimer(struct tm &tm, bool do_start=true);
152
156 ~AtTimer(void);
157
163 bool setTimeout(time_t t);
164
170 bool setTimeout(struct tm &tm);
171
181 void setExpireOffset(int offset_ms);
182
187 bool start(void);
188
192 void stop(void);
193
202 sigc::signal<void, AtTimer *> expired;
203
204 protected:
205
206 private:
207 Timer m_timer {-1};
208 struct timeval m_expire_at;
209 int m_expire_offset {0};
210
211 AtTimer(const AtTimer&);
212 AtTimer& operator=(const AtTimer&);
213 int msecToTimeout(void);
214 void onTimerExpired(Timer *t);
215
216}; /* class AtTimer */
217
218
219} /* namespace */
220
221#endif /* ASYNC_AT_TIMER_INCLUDED */
222
223
224
225/*
226 * This file has not been truncated
227 */
228
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.