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 | |
6 | namespace ev { |
6 | namespace 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, |
… | |
… | |
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) |
219 | EV_BEGIN_WATCHER (idle, idle) |
|
|
220 | void set () { } |
222 | EV_END_WATCHER (idle, idle) |
221 | EV_END_WATCHER (idle, idle) |
223 | |
222 | |
224 | EV_BEGIN_WATCHER (prepare, prepare) |
223 | EV_BEGIN_WATCHER (prepare, prepare) |
|
|
224 | void set () { } |
225 | EV_END_WATCHER (prepare, prepare) |
225 | EV_END_WATCHER (prepare, prepare) |
226 | |
226 | |
227 | EV_BEGIN_WATCHER (check, check) |
227 | EV_BEGIN_WATCHER (check, check) |
|
|
228 | void set () { } |
228 | EV_END_WATCHER (check, check) |
229 | EV_END_WATCHER (check, check) |
229 | |
230 | |
230 | EV_BEGIN_WATCHER (sig, signal) |
231 | EV_BEGIN_WATCHER (sig, signal) |
231 | void set (int signum) |
232 | void set (int signum) |
232 | { |
233 | { |
… | |
… | |
257 | set (pid); |
258 | set (pid); |
258 | start (); |
259 | start (); |
259 | } |
260 | } |
260 | EV_END_WATCHER (child, child) |
261 | EV_END_WATCHER (child, child) |
261 | |
262 | |
|
|
263 | #if EV_MULTIPLICITY |
|
|
264 | |
|
|
265 | EV_BEGIN_WATCHER (embed, embed) |
|
|
266 | void set (struct ev_loop *loop) |
|
|
267 | { |
|
|
268 | int active = is_active (); |
|
|
269 | if (active) stop (); |
|
|
270 | ev_embed_set (static_cast<ev_embed *>(this), loop); |
|
|
271 | if (active) start (); |
|
|
272 | } |
|
|
273 | |
|
|
274 | void start (struct ev_loop *embedded_loop) |
|
|
275 | { |
|
|
276 | set (embedded_loop); |
|
|
277 | start (); |
|
|
278 | } |
|
|
279 | |
|
|
280 | void sweep () |
|
|
281 | { |
|
|
282 | ev_embed_sweep (EV_A_ static_cast<ev_embed *>(this)); |
|
|
283 | } |
|
|
284 | EV_END_WATCHER (embed, embed) |
|
|
285 | |
|
|
286 | #endif |
|
|
287 | |
262 | #undef EV_CONSTRUCT |
288 | #undef EV_CONSTRUCT |
263 | #undef EV_BEGIN_WATCHER |
289 | #undef EV_BEGIN_WATCHER |
|
|
290 | #undef EV_END_WATCHER |
264 | } |
291 | } |
265 | |
292 | |
266 | #endif |
293 | #endif |
267 | |
294 | |