Async  0.18.0
AsyncCppApplication.h
Go to the documentation of this file.
1 
31 #ifndef ASYNC_CPP_APPLICATION_INCLUDED
32 #define ASYNC_CPP_APPLICATION_INCLUDED
33 
34 
35 /****************************************************************************
36  *
37  * System Includes
38  *
39  ****************************************************************************/
40 
41 #include <sys/types.h>
42 #include <sys/select.h>
43 #include <sys/time.h>
44 #include <sigc++/sigc++.h>
45 
46 #include <map>
47 #include <utility>
48 
49 
50 /****************************************************************************
51  *
52  * Project Includes
53  *
54  ****************************************************************************/
55 
56 #include <AsyncApplication.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 
81 namespace Async
82 {
83 
84 /****************************************************************************
85  *
86  * Defines & typedefs
87  *
88  ****************************************************************************/
89 
90 /*
91  *----------------------------------------------------------------------------
92  * Macro:
93  * Purpose:
94  * Input:
95  * Output:
96  * Author:
97  * Created:
98  * Remarks:
99  * Bugs:
100  *----------------------------------------------------------------------------
101  */
102 
103 
104 /*
105  *----------------------------------------------------------------------------
106  * Type:
107  * Purpose:
108  * Members:
109  * Input:
110  * Output:
111  * Author:
112  * Created:
113  * Remarks:
114  *----------------------------------------------------------------------------
115  */
116 
117 
118 /****************************************************************************
119  *
120  * Exported Global Variables
121  *
122  ****************************************************************************/
123 
124 
125 
126 /****************************************************************************
127  *
128  * Class definitions
129  *
130  ****************************************************************************/
131 
136 {
137  public:
141  CppApplication(void);
142 
146  ~CppApplication(void);
147 
155  void exec(void);
156 
162  void quit(void);
163 
164  protected:
165 
166  private:
167  struct lttimeval
168  {
169  bool operator()(const struct timeval& t1, const struct timeval& t2) const
170  {
171  return timercmp(&t1, &t2, <);
172  }
173  };
174  typedef std::map<int, FdWatch*> WatchMap;
175  typedef std::multimap<struct timeval, Timer *, lttimeval> TimerMap;
176 
177  bool do_quit;
178  int max_desc;
179  fd_set rd_set;
180  fd_set wr_set;
181  WatchMap rd_watch_map;
182  WatchMap wr_watch_map;
183  TimerMap timer_map;
184 
185  void addFdWatch(FdWatch *fd_watch);
186  void delFdWatch(FdWatch *fd_watch);
187  void addTimer(Timer *timer);
188  void addTimerP(Timer *timer, const struct timeval& current);
189  void delTimer(Timer *timer);
190  DnsLookupWorker *newDnsLookupWorker(const std::string& label);
191 
192 }; /* class CppApplication */
193 
194 
195 } /* namespace */
196 
197 #endif /* ASYNC_CPP_APPLICATION_INCLUDED */
198 
199 
200 
201 /*
202  * This file has not been truncated
203  */
204