AsyncCppApplication.h
Go to the documentation of this file.00001
00031 #ifndef ASYNC_CPP_APPLICATION_INCLUDED
00032 #define ASYNC_CPP_APPLICATION_INCLUDED
00033
00034
00035
00036
00037
00038
00039
00040
00041 #include <sys/types.h>
00042 #include <sys/select.h>
00043 #include <sys/time.h>
00044 #include <sigc++/sigc++.h>
00045
00046 #include <map>
00047 #include <utility>
00048
00049
00050
00051
00052
00053
00054
00055
00056 #include <AsyncApplication.h>
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 namespace Async
00082 {
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00135 class CppApplication : public Application
00136 {
00137 public:
00141 CppApplication(void);
00142
00146 ~CppApplication(void);
00147
00155 void exec(void);
00156
00162 void quit(void);
00163
00164 protected:
00165
00166 private:
00167 struct lttimeval
00168 {
00169 bool operator()(const struct timeval& t1, const struct timeval& t2) const
00170 {
00171 return timercmp(&t1, &t2, <);
00172 }
00173 };
00174 typedef std::map<int, FdWatch*> WatchMap;
00175 typedef std::multimap<struct timeval, Timer *, lttimeval> TimerMap;
00176
00177 bool do_quit;
00178 int max_desc;
00179 fd_set rd_set;
00180 fd_set wr_set;
00181 WatchMap rd_watch_map;
00182 WatchMap wr_watch_map;
00183 TimerMap timer_map;
00184
00185 void addFdWatch(FdWatch *fd_watch);
00186 void delFdWatch(FdWatch *fd_watch);
00187 void addTimer(Timer *timer);
00188 void addTimerP(Timer *timer, const struct timeval& current);
00189 void delTimer(Timer *timer);
00190 DnsLookupWorker *newDnsLookupWorker(const std::string& label);
00191
00192 };
00193
00194
00195 }
00196
00197 #endif
00198
00199
00200
00201
00202
00203
00204