Async  0.18.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 
75 namespace Async
76 {
77 
78 /****************************************************************************
79  *
80  * Forward declarations of classes inside of the declared namespace
81  *
82  ****************************************************************************/
83 
84 class Timer;
85 class FdWatch;
86 class DnsLookupWorker;
87 
88 
89 /****************************************************************************
90  *
91  * Defines & typedefs
92  *
93  ****************************************************************************/
94 
95 
96 
97 /****************************************************************************
98  *
99  * Exported Global Variables
100  *
101  ****************************************************************************/
102 
103 
104 
105 /****************************************************************************
106  *
107  * Class definitions
108  *
109  ****************************************************************************/
110 
118 class Application : public SigC::Object
119 {
120  public:
129  static Application &app(void);
130 
134  Application(void);
135 
139  virtual ~Application(void);
140 
148  virtual void exec(void) = 0;
149 
155  virtual void quit(void) = 0;
156 
157  protected:
158 
159  private:
160  friend class FdWatch;
161  friend class Timer;
162  friend class DnsLookup;
163 
164  static Application *app_ptr;
165 
166  virtual void addFdWatch(FdWatch *fd_watch) = 0;
167  virtual void delFdWatch(FdWatch *fd_watch) = 0;
168  virtual void addTimer(Timer *timer) = 0;
169  virtual void delTimer(Timer *timer) = 0;
170  virtual DnsLookupWorker *newDnsLookupWorker(const std::string& label) = 0;
171 
172 }; /* class Application */
173 
174 
175 } /* namespace */
176 
177 #endif /* ASYNC_APPLICATION_INCLUDED */
178 
179 
180 
181 /*
182  * This file has not been truncated
183  */
184 
static Application & app(void)
Get the one and only application instance.
The base class for asynchronous applications.
Application(void)
Default constructor.
virtual ~Application(void)
Destructor.
virtual void quit(void)=0
Exit the application main loop.
A class that produces timer events.
Definition: AsyncTimer.h:116
A class for watching file descriptors.
Definition: AsyncFdWatch.h:119
A class for performing asynchronous DNS lookups.
virtual void exec(void)=0
Execute the application main loop.