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 | * |
… | |
… | |
225 | void unref () throw () |
225 | void unref () throw () |
226 | { |
226 | { |
227 | ev_unref (EV_AX); |
227 | ev_unref (EV_AX); |
228 | } |
228 | } |
229 | |
229 | |
230 | #if EV_MINIMAL < 2 |
230 | #if EV_FEATURE_API |
231 | unsigned int count () const throw () |
231 | unsigned int count () const throw () |
232 | { |
232 | { |
233 | return ev_loop_count (EV_AX); |
233 | return ev_loop_count (EV_AX); |
234 | } |
234 | } |
235 | |
235 | |
… | |
… | |
642 | |
642 | |
643 | void again () throw () |
643 | void again () throw () |
644 | { |
644 | { |
645 | ev_timer_again (EV_A_ static_cast<ev_timer *>(this)); |
645 | ev_timer_again (EV_A_ static_cast<ev_timer *>(this)); |
646 | } |
646 | } |
|
|
647 | |
|
|
648 | ev_tstamp remaining () |
|
|
649 | { |
|
|
650 | return ev_timer_remaining (EV_A_ static_cast<ev_timer *>(this)); |
|
|
651 | } |
647 | EV_END_WATCHER (timer, timer) |
652 | EV_END_WATCHER (timer, timer) |
648 | |
653 | |
649 | #if EV_PERIODIC_ENABLE |
654 | #if EV_PERIODIC_ENABLE |
650 | EV_BEGIN_WATCHER (periodic, periodic) |
655 | EV_BEGIN_WATCHER (periodic, periodic) |
651 | void set (ev_tstamp at, ev_tstamp interval = 0.) throw () |
656 | void set (ev_tstamp at, ev_tstamp interval = 0.) throw () |
… | |
… | |
667 | ev_periodic_again (EV_A_ static_cast<ev_periodic *>(this)); |
672 | ev_periodic_again (EV_A_ static_cast<ev_periodic *>(this)); |
668 | } |
673 | } |
669 | EV_END_WATCHER (periodic, periodic) |
674 | EV_END_WATCHER (periodic, periodic) |
670 | #endif |
675 | #endif |
671 | |
676 | |
|
|
677 | #if EV_SIGNAL_ENABLE |
672 | EV_BEGIN_WATCHER (sig, signal) |
678 | EV_BEGIN_WATCHER (sig, signal) |
673 | void set (int signum) throw () |
679 | void set (int signum) throw () |
674 | { |
680 | { |
675 | int active = is_active (); |
681 | int active = is_active (); |
676 | if (active) stop (); |
682 | if (active) stop (); |
… | |
… | |
682 | { |
688 | { |
683 | set (signum); |
689 | set (signum); |
684 | start (); |
690 | start (); |
685 | } |
691 | } |
686 | EV_END_WATCHER (sig, signal) |
692 | EV_END_WATCHER (sig, signal) |
|
|
693 | #endif |
687 | |
694 | |
|
|
695 | #if EV_CHILD_ENABLE |
688 | EV_BEGIN_WATCHER (child, child) |
696 | EV_BEGIN_WATCHER (child, child) |
689 | void set (int pid, int trace = 0) throw () |
697 | void set (int pid, int trace = 0) throw () |
690 | { |
698 | { |
691 | int active = is_active (); |
699 | int active = is_active (); |
692 | if (active) stop (); |
700 | if (active) stop (); |
… | |
… | |
698 | { |
706 | { |
699 | set (pid, trace); |
707 | set (pid, trace); |
700 | start (); |
708 | start (); |
701 | } |
709 | } |
702 | EV_END_WATCHER (child, child) |
710 | EV_END_WATCHER (child, child) |
|
|
711 | #endif |
703 | |
712 | |
704 | #if EV_STAT_ENABLE |
713 | #if EV_STAT_ENABLE |
705 | EV_BEGIN_WATCHER (stat, stat) |
714 | EV_BEGIN_WATCHER (stat, stat) |
706 | void set (const char *path, ev_tstamp interval = 0.) throw () |
715 | void set (const char *path, ev_tstamp interval = 0.) throw () |
707 | { |
716 | { |
… | |
… | |
723 | ev_stat_stat (EV_A_ static_cast<ev_stat *>(this)); |
732 | ev_stat_stat (EV_A_ static_cast<ev_stat *>(this)); |
724 | } |
733 | } |
725 | EV_END_WATCHER (stat, stat) |
734 | EV_END_WATCHER (stat, stat) |
726 | #endif |
735 | #endif |
727 | |
736 | |
|
|
737 | #if EV_IDLE_ENABLE |
728 | EV_BEGIN_WATCHER (idle, idle) |
738 | EV_BEGIN_WATCHER (idle, idle) |
729 | void set () throw () { } |
739 | void set () throw () { } |
730 | EV_END_WATCHER (idle, idle) |
740 | EV_END_WATCHER (idle, idle) |
|
|
741 | #endif |
731 | |
742 | |
|
|
743 | #if EV_PREPARE_ENABLE |
732 | EV_BEGIN_WATCHER (prepare, prepare) |
744 | EV_BEGIN_WATCHER (prepare, prepare) |
733 | void set () throw () { } |
745 | void set () throw () { } |
734 | EV_END_WATCHER (prepare, prepare) |
746 | EV_END_WATCHER (prepare, prepare) |
|
|
747 | #endif |
735 | |
748 | |
|
|
749 | #if EV_CHECK_ENABLE |
736 | EV_BEGIN_WATCHER (check, check) |
750 | EV_BEGIN_WATCHER (check, check) |
737 | void set () throw () { } |
751 | void set () throw () { } |
738 | EV_END_WATCHER (check, check) |
752 | EV_END_WATCHER (check, check) |
|
|
753 | #endif |
739 | |
754 | |
740 | #if EV_EMBED_ENABLE |
755 | #if EV_EMBED_ENABLE |
741 | EV_BEGIN_WATCHER (embed, embed) |
756 | EV_BEGIN_WATCHER (embed, embed) |
742 | void set (struct ev_loop *embedded_loop) throw () |
757 | void set (struct ev_loop *embedded_loop) throw () |
743 | { |
758 | { |