Async 1.8.0
AsyncApplication.h
Go to the documentation of this file.
1
30#ifndef ASYNC_APPLICATION_INCLUDED
31#define ASYNC_APPLICATION_INCLUDED
32
33
34/****************************************************************************
35 *
36 * System Includes
37 *
38 ****************************************************************************/
39
40#include <sigc++/sigc++.h>
41
42#include <string>
43
44
45/****************************************************************************
46 *
47 * Project Includes
48 *
49 ****************************************************************************/
50
51
52
53/****************************************************************************
54 *
55 * Local Includes
56 *
57 ****************************************************************************/
58
59
60
61/****************************************************************************
62 *
63 * Forward declarations
64 *
65 ****************************************************************************/
66
67
68
69/****************************************************************************
70 *
71 * Namespace
72 *
73 ****************************************************************************/
74
75namespace Async
76{
77
78/****************************************************************************
79 *
80 * Forward declarations of classes inside of the declared namespace
81 *
82 ****************************************************************************/
83
84class Timer;
85class FdWatch;
86class DnsLookup;
87class DnsLookupWorker;
88
89
90/****************************************************************************
91 *
92 * Defines & typedefs
93 *
94 ****************************************************************************/
95
96
97
98/****************************************************************************
99 *
100 * Exported Global Variables
101 *
102 ****************************************************************************/
103
104
105
106/****************************************************************************
107 *
108 * Class definitions
109 *
110 ****************************************************************************/
111
119class Application : public sigc::trackable
120{
121 public:
130 static Application &app(void);
131
136
140 virtual ~Application(void);
141
149 virtual void exec(void) = 0;
150
156 virtual void quit(void) = 0;
157
179 void runTask(sigc::slot<void> task);
180
181 protected:
182 void clearTasks(void);
183
184 private:
185 friend class FdWatch;
186 friend class Timer;
187 friend class DnsLookup;
188
189 typedef std::list<sigc::slot<void> > SlotList;
190
191 static Application *app_ptr;
192
193 SlotList task_list;
194 Timer *task_timer;
195
196 void taskTimerExpired(void);
197 virtual void addFdWatch(FdWatch *fd_watch) = 0;
198 virtual void delFdWatch(FdWatch *fd_watch) = 0;
199 virtual void addTimer(Timer *timer) = 0;
200 virtual void delTimer(Timer *timer) = 0;
201 virtual DnsLookupWorker *newDnsLookupWorker(const DnsLookup& lookup) = 0;
202
203}; /* class Application */
204
205
206} /* namespace */
207
208#endif /* ASYNC_APPLICATION_INCLUDED */
209
210
211
212/*
213 * This file has not been truncated
214 */
215
The base class for asynchronous applications.
static Application & app(void)
Get the one and only application instance.
void runTask(sigc::slot< void > task)
Run a task from the Async main loop.
virtual ~Application(void)
Destructor.
void clearTasks(void)
Application(void)
Default constructor.
virtual void exec(void)=0
Execute the application main loop.
virtual void quit(void)=0
Exit the application main loop.
A class for performing asynchronous DNS lookups.
A class for watching file descriptors.
A class that produces timer events.
Definition AsyncTimer.h:117
Namespace for the asynchronous programming classes.