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

Comparing libev/ev++.h (file contents):
Revision 1.44 by root, Wed Dec 3 15:23:44 2008 UTC vs.
Revision 1.49 by root, Tue Mar 16 00:43:22 2010 UTC

1/* 1/*
2 * libev simple C++ wrapper classes 2 * libev simple C++ wrapper classes
3 * 3 *
4 * Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de> 4 * Copyright (c) 2007,2008,2010 Marc Alexander Lehmann <libev@schmorp.de>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without modifica- 7 * Redistribution and use in source and binary forms, with or without modifica-
8 * tion, are permitted provided that the following conditions are met: 8 * tion, are permitted provided that the following conditions are met:
9 * 9 *
205#else 205#else
206 ev_default_fork (); 206 ev_default_fork ();
207#endif 207#endif
208 } 208 }
209 209
210 unsigned int backend () const throw ()
211 {
212 return ev_backend (EV_AX);
213 }
214
215 tstamp now () const throw ()
216 {
217 return ev_now (EV_AX);
218 }
219
220 void ref () throw ()
221 {
222 ev_ref (EV_AX);
223 }
224
225 void unref () throw ()
226 {
227 ev_unref (EV_AX);
228 }
229
230#if EV_FEATURE_API
210 unsigned int count () const throw () 231 unsigned int count () const throw ()
211 { 232 {
212 return ev_loop_count (EV_AX); 233 return ev_loop_count (EV_AX);
213 } 234 }
214 235
215 unsigned int backend () const throw () 236 unsigned int depth () const throw ()
216 {
217 return ev_backend (EV_AX);
218 } 237 {
219
220 tstamp now () const throw ()
221 {
222 return ev_now (EV_AX); 238 return ev_loop_depth (EV_AX);
223 }
224
225 void ref () throw ()
226 {
227 ev_ref (EV_AX);
228 }
229
230 void unref () throw ()
231 {
232 ev_unref (EV_AX);
233 } 239 }
234 240
235 void set_io_collect_interval (tstamp interval) throw () 241 void set_io_collect_interval (tstamp interval) throw ()
236 { 242 {
237 ev_set_io_collect_interval (EV_AX_ interval); 243 ev_set_io_collect_interval (EV_AX_ interval);
239 245
240 void set_timeout_collect_interval (tstamp interval) throw () 246 void set_timeout_collect_interval (tstamp interval) throw ()
241 { 247 {
242 ev_set_timeout_collect_interval (EV_AX_ interval); 248 ev_set_timeout_collect_interval (EV_AX_ interval);
243 } 249 }
250#endif
244 251
245 // function callback 252 // function callback
246 void once (int fd, int events, tstamp timeout, void (*cb)(int, void *), void *arg = 0) throw () 253 void once (int fd, int events, tstamp timeout, void (*cb)(int, void *), void *arg = 0) throw ()
247 { 254 {
248 ev_once (EV_AX_ fd, events, timeout, cb, arg); 255 ev_once (EV_AX_ fd, events, timeout, cb, arg);
635 642
636 void again () throw () 643 void again () throw ()
637 { 644 {
638 ev_timer_again (EV_A_ static_cast<ev_timer *>(this)); 645 ev_timer_again (EV_A_ static_cast<ev_timer *>(this));
639 } 646 }
647
648 ev_tstamp remaining ()
649 {
650 return ev_timer_remaining (EV_A_ static_cast<ev_timer *>(this));
651 }
640 EV_END_WATCHER (timer, timer) 652 EV_END_WATCHER (timer, timer)
641 653
642 #if EV_PERIODIC_ENABLE 654 #if EV_PERIODIC_ENABLE
643 EV_BEGIN_WATCHER (periodic, periodic) 655 EV_BEGIN_WATCHER (periodic, periodic)
644 void set (ev_tstamp at, ev_tstamp interval = 0.) throw () 656 void set (ev_tstamp at, ev_tstamp interval = 0.) throw ()
660 ev_periodic_again (EV_A_ static_cast<ev_periodic *>(this)); 672 ev_periodic_again (EV_A_ static_cast<ev_periodic *>(this));
661 } 673 }
662 EV_END_WATCHER (periodic, periodic) 674 EV_END_WATCHER (periodic, periodic)
663 #endif 675 #endif
664 676
677 #if EV_SIGNAL_ENABLE
665 EV_BEGIN_WATCHER (sig, signal) 678 EV_BEGIN_WATCHER (sig, signal)
666 void set (int signum) throw () 679 void set (int signum) throw ()
667 { 680 {
668 int active = is_active (); 681 int active = is_active ();
669 if (active) stop (); 682 if (active) stop ();
675 { 688 {
676 set (signum); 689 set (signum);
677 start (); 690 start ();
678 } 691 }
679 EV_END_WATCHER (sig, signal) 692 EV_END_WATCHER (sig, signal)
693 #endif
680 694
695 #if EV_CHILD_ENABLE
681 EV_BEGIN_WATCHER (child, child) 696 EV_BEGIN_WATCHER (child, child)
682 void set (int pid, int trace = 0) throw () 697 void set (int pid, int trace = 0) throw ()
683 { 698 {
684 int active = is_active (); 699 int active = is_active ();
685 if (active) stop (); 700 if (active) stop ();
691 { 706 {
692 set (pid, trace); 707 set (pid, trace);
693 start (); 708 start ();
694 } 709 }
695 EV_END_WATCHER (child, child) 710 EV_END_WATCHER (child, child)
711 #endif
696 712
697 #if EV_STAT_ENABLE 713 #if EV_STAT_ENABLE
698 EV_BEGIN_WATCHER (stat, stat) 714 EV_BEGIN_WATCHER (stat, stat)
699 void set (const char *path, ev_tstamp interval = 0.) throw () 715 void set (const char *path, ev_tstamp interval = 0.) throw ()
700 { 716 {
716 ev_stat_stat (EV_A_ static_cast<ev_stat *>(this)); 732 ev_stat_stat (EV_A_ static_cast<ev_stat *>(this));
717 } 733 }
718 EV_END_WATCHER (stat, stat) 734 EV_END_WATCHER (stat, stat)
719 #endif 735 #endif
720 736
737 #if EV_IDLE_ENABLE
721 EV_BEGIN_WATCHER (idle, idle) 738 EV_BEGIN_WATCHER (idle, idle)
722 void set () throw () { } 739 void set () throw () { }
723 EV_END_WATCHER (idle, idle) 740 EV_END_WATCHER (idle, idle)
741 #endif
724 742
743 #if EV_PREPARE_ENABLE
725 EV_BEGIN_WATCHER (prepare, prepare) 744 EV_BEGIN_WATCHER (prepare, prepare)
726 void set () throw () { } 745 void set () throw () { }
727 EV_END_WATCHER (prepare, prepare) 746 EV_END_WATCHER (prepare, prepare)
747 #endif
728 748
749 #if EV_CHECK_ENABLE
729 EV_BEGIN_WATCHER (check, check) 750 EV_BEGIN_WATCHER (check, check)
730 void set () throw () { } 751 void set () throw () { }
731 EV_END_WATCHER (check, check) 752 EV_END_WATCHER (check, check)
753 #endif
732 754
733 #if EV_EMBED_ENABLE 755 #if EV_EMBED_ENABLE
734 EV_BEGIN_WATCHER (embed, embed) 756 EV_BEGIN_WATCHER (embed, embed)
735 void set (struct ev_loop *embedded_loop) throw () 757 void set (struct ev_loop *embedded_loop) throw ()
736 { 758 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines