ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev++.h
(Generate patch)

Comparing libev/ev++.h (file contents):
Revision 1.6 by root, Wed Nov 14 06:08:13 2007 UTC vs.
Revision 1.8 by root, Tue Nov 27 08:20:41 2007 UTC

1#ifndef EVPP_H__ 1#ifndef EVPP_H__
2#define EVPP_H__ 2#define EVPP_H__
3 3
4/* work in progress, don't use unless you know what you are doing */ 4#include "ev.h"
5 5
6namespace ev { 6namespace ev {
7 7
8 template<class watcher> 8 template<class watcher>
9 class callback 9 class callback
41 void call (watcher *w, int e) const 41 void call (watcher *w, int e) const
42 { 42 {
43 return prxy->call (obj, meth, *w, e); 43 return prxy->call (obj, meth, *w, e);
44 } 44 }
45 }; 45 };
46
47 #include "ev.h"
48 46
49 enum { 47 enum {
50 UNDEF = EV_UNDEF, 48 UNDEF = EV_UNDEF,
51 NONE = EV_NONE, 49 NONE = EV_NONE,
52 READ = EV_READ, 50 READ = EV_READ,
193 { 191 {
194 ev_timer_again (EV_A_ static_cast<ev_timer *>(this)); 192 ev_timer_again (EV_A_ static_cast<ev_timer *>(this));
195 } 193 }
196 EV_END_WATCHER (timer, timer) 194 EV_END_WATCHER (timer, timer)
197 195
198 #if EV_PERIODICS 196 #if EV_PERIODIC_ENABLE
199 EV_BEGIN_WATCHER (periodic, periodic) 197 EV_BEGIN_WATCHER (periodic, periodic)
200 void set (ev_tstamp at, ev_tstamp interval = 0.) 198 void set (ev_tstamp at, ev_tstamp interval = 0.)
201 { 199 {
202 int active = is_active (); 200 int active = is_active ();
203 if (active) stop (); 201 if (active) stop ();
216 ev_periodic_again (EV_A_ static_cast<ev_periodic *>(this)); 214 ev_periodic_again (EV_A_ static_cast<ev_periodic *>(this));
217 } 215 }
218 EV_END_WATCHER (periodic, periodic) 216 EV_END_WATCHER (periodic, periodic)
219 #endif 217 #endif
220 218
221 EV_BEGIN_WATCHER (idle, idle)
222 EV_END_WATCHER (idle, idle)
223
224 EV_BEGIN_WATCHER (prepare, prepare)
225 EV_END_WATCHER (prepare, prepare)
226
227 EV_BEGIN_WATCHER (check, check)
228 EV_END_WATCHER (check, check)
229
230 EV_BEGIN_WATCHER (sig, signal) 219 EV_BEGIN_WATCHER (sig, signal)
231 void set (int signum) 220 void set (int signum)
232 { 221 {
233 int active = is_active (); 222 int active = is_active ();
234 if (active) stop (); 223 if (active) stop ();
257 set (pid); 246 set (pid);
258 start (); 247 start ();
259 } 248 }
260 EV_END_WATCHER (child, child) 249 EV_END_WATCHER (child, child)
261 250
251 #if EV_STAT_ENABLE
252 EV_BEGIN_WATCHER (stat, stat)
253 void set (const char *path, ev_tstamp interval = 0.)
254 {
255 int active = is_active ();
256 if (active) stop ();
257 ev_stat_set (static_cast<ev_stat *>(this), path, interval);
258 if (active) start ();
259 }
260
261 void start (const char *path, ev_tstamp interval = 0.)
262 {
263 set (path, interval);
264 start ();
265 }
266
267 void update ()
268 {
269 ev_stat_stat (EV_A_ static_cast<ev_stat *>(this));
270 }
271 EV_END_WATCHER (stat, stat)
272 #endif
273
274 EV_BEGIN_WATCHER (idle, idle)
275 void set () { }
276 EV_END_WATCHER (idle, idle)
277
278 EV_BEGIN_WATCHER (prepare, prepare)
279 void set () { }
280 EV_END_WATCHER (prepare, prepare)
281
282 EV_BEGIN_WATCHER (check, check)
283 void set () { }
284 EV_END_WATCHER (check, check)
285
286 #if EV_EMBED_ENABLE
287 EV_BEGIN_WATCHER (embed, embed)
288 void set (struct ev_loop *loop)
289 {
290 int active = is_active ();
291 if (active) stop ();
292 ev_embed_set (static_cast<ev_embed *>(this), loop);
293 if (active) start ();
294 }
295
296 void start (struct ev_loop *embedded_loop)
297 {
298 set (embedded_loop);
299 start ();
300 }
301
302 void sweep ()
303 {
304 ev_embed_sweep (EV_A_ static_cast<ev_embed *>(this));
305 }
306 EV_END_WATCHER (embed, embed)
307 #endif
308
262 #undef EV_CONSTRUCT 309 #undef EV_CONSTRUCT
263 #undef EV_BEGIN_WATCHER 310 #undef EV_BEGIN_WATCHER
311 #undef EV_END_WATCHER
264} 312}
265 313
266#endif 314#endif
267 315

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines