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

Comparing libev/ev++.h (file contents):
Revision 1.5 by root, Wed Nov 14 04:45:07 2007 UTC vs.
Revision 1.6 by root, Wed Nov 14 06:08:13 2007 UTC

93 93
94 /* using a template here would require quite a bit more lines, 94 /* using a template here would require quite a bit more lines,
95 * so a macro solution was chosen */ 95 * so a macro solution was chosen */
96 #define EV_BEGIN_WATCHER(cppstem,cstem) \ 96 #define EV_BEGIN_WATCHER(cppstem,cstem) \
97 \ 97 \
98 static void cb_ ## cppstem (EV_P_ struct ev_ ## cstem *w, int revents); \
99 \
100 struct cppstem : ev_ ## cstem, callback<cppstem> \ 98 struct cppstem : ev_ ## cstem, callback<cppstem> \
101 { \ 99 { \
102 EV_CONSTRUCT (cppstem) \ 100 EV_CONSTRUCT (cppstem) \
103 { \ 101 { \
104 ev_init (static_cast<ev_ ## cstem *>(this), cb_ ## cppstem); \ 102 ev_init (static_cast<ev_ ## cstem *>(this), thunk); \
105 } \ 103 } \
106 \ 104 \
107 bool is_active () const \ 105 bool is_active () const \
108 { \ 106 { \
109 return ev_is_active (static_cast<const ev_ ## cstem *>(this)); \ 107 return ev_is_active (static_cast<const ev_ ## cstem *>(this)); \
137 private: \ 135 private: \
138 \ 136 \
139 cppstem (const cppstem &o) \ 137 cppstem (const cppstem &o) \
140 : callback<cppstem> (this, (void (cppstem::*)(cppstem &, int))0) \ 138 : callback<cppstem> (this, (void (cppstem::*)(cppstem &, int))0) \
141 { /* disabled */ } \ 139 { /* disabled */ } \
140 \
142 void operator =(const cppstem &o) { /* disabled */ } \ 141 void operator =(const cppstem &o) { /* disabled */ } \
143 \ 142 \
143 static void thunk (EV_P_ struct ev_ ## cstem *w, int revents) \
144 { \
145 (*static_cast<cppstem *>(w))(revents); \
146 } \
147 \
144 public: 148 public:
145 149
146 #define EV_END_WATCHER(cppstem,cstem) \ 150 #define EV_END_WATCHER(cppstem,cstem) \
147 }; \
148 \
149 static void cb_ ## cppstem (EV_P_ struct ev_ ## cstem *w, int revents) \
150 { \
151 (*static_cast<cppstem *>(w))(revents); \
152 } 151 };
153 152
154 EV_BEGIN_WATCHER (io, io) 153 EV_BEGIN_WATCHER (io, io)
155 void set (int fd, int events) 154 void set (int fd, int events)
156 { 155 {
157 int active = is_active (); 156 int active = is_active ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines