ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/callback.h
(Generate patch)

Comparing gvpe/src/callback.h (file contents):
Revision 1.3 by pcg, Thu Oct 16 02:41:21 2003 UTC vs.
Revision 1.9 by pcg, Sat Jan 14 11:21:12 2006 UTC

1// THIS IS A GENERATED FILE, RUN callback.pl to regenerate it 1// THIS IS A GENERATED FILE: RUN callback.pl to regenerate it
2// THIS IS A GENERATED FILE, RUN callback.pl to regenerate it 2// THIS IS A GENERATED FILE: callback.pl is part of the GVPE
3// THIS IS A GENERATED FILE, RUN callback.pl to regenerate it 3// THIS IS A GENERATED FILE: distribution.
4// THIS IS A GENERATED FILE, RUN callback.pl to regenerate it
5// THIS IS A GENERATED FILE, RUN callback.pl to regenerate it
6// THIS IS A GENERATED FILE, RUN callback.pl to regenerate it
7 4
8/* 5/*
9 callback.h -- C++ callback mechanism 6 callback.h -- C++ callback mechanism
10 Copyright (C) 2003 Marc Lehmann <pcg@goof.com> 7 Copyright (C) 2003-2006 Marc Lehmann <pcg@goof.com>
11 8
9 This file is part of GVPE.
10
12 This program is free software; you can redistribute it and/or modify 11 GVPE is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by 12 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or 13 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version. 14 (at your option) any later version.
16 15
17 This program is distributed in the hope that it will be useful, 16 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details. 19 GNU General Public License for more details.
21 20
22 You should have received a copy of the GNU General Public License 21 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software 22 along with gvpe; if not, write to the Free Software
24 Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25*/ 24*/
26 25
27#ifndef VPE_CALLBACK_H__ 26#ifndef CALLBACK_H__
28#define VPE_CALLBACK_H__ 27#define CALLBACK_H__
29 28
30template<class R> 29template<class R>
31class callback0 { 30class callback0 {
32 struct object { }; 31 struct object { };
33 32
34 void *obj; 33 void *obj;
35 R (object::*meth)(); 34 R (object::*meth)();
36 35
37 /* a proxy is a kind of recipe on how to call a specific class method */ 36 /* a proxy is a kind of recipe on how to call a specific class method */
38 struct proxy_base { 37 struct proxy_base {
39 virtual R call (void *obj, R (object::*meth)()) = 0; 38 virtual R call (void *obj, R (object::*meth)()) const = 0;
40 }; 39 };
41 template<class O1, class O2> 40 template<class O1, class O2>
42 struct proxy : proxy_base { 41 struct proxy : proxy_base {
43 virtual R call (void *obj, R (object::*meth)()) 42 virtual R call (void *obj, R (object::*meth)()) const
44 { 43 {
45 ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)()>(meth))) 44 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)()>(meth)))
46 (); 45 ();
47 } 46 }
48 }; 47 };
49 48
50 proxy_base *prxy; 49 proxy_base *prxy;
51 50
52public: 51public:
53 template<class O1, class O2> 52 template<class O1, class O2>
54 callback0 (O1 *object, R (O2::*method)()) 53 explicit callback0 (O1 *object, R (O2::*method)())
55 { 54 {
56 static proxy<O1,O2> p; 55 static proxy<O1,O2> p;
57 obj = reinterpret_cast<void *>(object); 56 obj = reinterpret_cast<void *>(object);
58 meth = reinterpret_cast<R (object::*)()>(method); 57 meth = reinterpret_cast<R (object::*)()>(method);
59 prxy = &p; 58 prxy = &p;
77 void *obj; 76 void *obj;
78 R (object::*meth)(A1); 77 R (object::*meth)(A1);
79 78
80 /* a proxy is a kind of recipe on how to call a specific class method */ 79 /* a proxy is a kind of recipe on how to call a specific class method */
81 struct proxy_base { 80 struct proxy_base {
82 virtual R call (void *obj, R (object::*meth)(A1), A1 a1) = 0; 81 virtual R call (void *obj, R (object::*meth)(A1), A1 a1) const = 0;
83 }; 82 };
84 template<class O1, class O2> 83 template<class O1, class O2>
85 struct proxy : proxy_base { 84 struct proxy : proxy_base {
86 virtual R call (void *obj, R (object::*meth)(A1), A1 a1) 85 virtual R call (void *obj, R (object::*meth)(A1), A1 a1) const
87 { 86 {
88 ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1)>(meth))) 87 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1)>(meth)))
89 (a1); 88 (a1);
90 } 89 }
91 }; 90 };
92 91
93 proxy_base *prxy; 92 proxy_base *prxy;
94 93
95public: 94public:
96 template<class O1, class O2> 95 template<class O1, class O2>
97 callback1 (O1 *object, R (O2::*method)(A1)) 96 explicit callback1 (O1 *object, R (O2::*method)(A1))
98 { 97 {
99 static proxy<O1,O2> p; 98 static proxy<O1,O2> p;
100 obj = reinterpret_cast<void *>(object); 99 obj = reinterpret_cast<void *>(object);
101 meth = reinterpret_cast<R (object::*)(A1)>(method); 100 meth = reinterpret_cast<R (object::*)(A1)>(method);
102 prxy = &p; 101 prxy = &p;
120 void *obj; 119 void *obj;
121 R (object::*meth)(A1, A2); 120 R (object::*meth)(A1, A2);
122 121
123 /* a proxy is a kind of recipe on how to call a specific class method */ 122 /* a proxy is a kind of recipe on how to call a specific class method */
124 struct proxy_base { 123 struct proxy_base {
125 virtual R call (void *obj, R (object::*meth)(A1, A2), A1 a1, A2 a2) = 0; 124 virtual R call (void *obj, R (object::*meth)(A1, A2), A1 a1, A2 a2) const = 0;
126 }; 125 };
127 template<class O1, class O2> 126 template<class O1, class O2>
128 struct proxy : proxy_base { 127 struct proxy : proxy_base {
129 virtual R call (void *obj, R (object::*meth)(A1, A2), A1 a1, A2 a2) 128 virtual R call (void *obj, R (object::*meth)(A1, A2), A1 a1, A2 a2) const
130 { 129 {
131 ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2)>(meth))) 130 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2)>(meth)))
132 (a1, a2); 131 (a1, a2);
133 } 132 }
134 }; 133 };
135 134
136 proxy_base *prxy; 135 proxy_base *prxy;
137 136
138public: 137public:
139 template<class O1, class O2> 138 template<class O1, class O2>
140 callback2 (O1 *object, R (O2::*method)(A1, A2)) 139 explicit callback2 (O1 *object, R (O2::*method)(A1, A2))
141 { 140 {
142 static proxy<O1,O2> p; 141 static proxy<O1,O2> p;
143 obj = reinterpret_cast<void *>(object); 142 obj = reinterpret_cast<void *>(object);
144 meth = reinterpret_cast<R (object::*)(A1, A2)>(method); 143 meth = reinterpret_cast<R (object::*)(A1, A2)>(method);
145 prxy = &p; 144 prxy = &p;
163 void *obj; 162 void *obj;
164 R (object::*meth)(A1, A2, A3); 163 R (object::*meth)(A1, A2, A3);
165 164
166 /* a proxy is a kind of recipe on how to call a specific class method */ 165 /* a proxy is a kind of recipe on how to call a specific class method */
167 struct proxy_base { 166 struct proxy_base {
168 virtual R call (void *obj, R (object::*meth)(A1, A2, A3), A1 a1, A2 a2, A3 a3) = 0; 167 virtual R call (void *obj, R (object::*meth)(A1, A2, A3), A1 a1, A2 a2, A3 a3) const = 0;
169 }; 168 };
170 template<class O1, class O2> 169 template<class O1, class O2>
171 struct proxy : proxy_base { 170 struct proxy : proxy_base {
172 virtual R call (void *obj, R (object::*meth)(A1, A2, A3), A1 a1, A2 a2, A3 a3) 171 virtual R call (void *obj, R (object::*meth)(A1, A2, A3), A1 a1, A2 a2, A3 a3) const
173 { 172 {
174 ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3)>(meth))) 173 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3)>(meth)))
175 (a1, a2, a3); 174 (a1, a2, a3);
176 } 175 }
177 }; 176 };
178 177
179 proxy_base *prxy; 178 proxy_base *prxy;
180 179
181public: 180public:
182 template<class O1, class O2> 181 template<class O1, class O2>
183 callback3 (O1 *object, R (O2::*method)(A1, A2, A3)) 182 explicit callback3 (O1 *object, R (O2::*method)(A1, A2, A3))
184 { 183 {
185 static proxy<O1,O2> p; 184 static proxy<O1,O2> p;
186 obj = reinterpret_cast<void *>(object); 185 obj = reinterpret_cast<void *>(object);
187 meth = reinterpret_cast<R (object::*)(A1, A2, A3)>(method); 186 meth = reinterpret_cast<R (object::*)(A1, A2, A3)>(method);
188 prxy = &p; 187 prxy = &p;
206 void *obj; 205 void *obj;
207 R (object::*meth)(A1, A2, A3, A4); 206 R (object::*meth)(A1, A2, A3, A4);
208 207
209 /* a proxy is a kind of recipe on how to call a specific class method */ 208 /* a proxy is a kind of recipe on how to call a specific class method */
210 struct proxy_base { 209 struct proxy_base {
211 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4) = 0; 210 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4) const = 0;
212 }; 211 };
213 template<class O1, class O2> 212 template<class O1, class O2>
214 struct proxy : proxy_base { 213 struct proxy : proxy_base {
215 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4) 214 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4) const
216 { 215 {
217 ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4)>(meth))) 216 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4)>(meth)))
218 (a1, a2, a3, a4); 217 (a1, a2, a3, a4);
219 } 218 }
220 }; 219 };
221 220
222 proxy_base *prxy; 221 proxy_base *prxy;
223 222
224public: 223public:
225 template<class O1, class O2> 224 template<class O1, class O2>
226 callback4 (O1 *object, R (O2::*method)(A1, A2, A3, A4)) 225 explicit callback4 (O1 *object, R (O2::*method)(A1, A2, A3, A4))
227 { 226 {
228 static proxy<O1,O2> p; 227 static proxy<O1,O2> p;
229 obj = reinterpret_cast<void *>(object); 228 obj = reinterpret_cast<void *>(object);
230 meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4)>(method); 229 meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4)>(method);
231 prxy = &p; 230 prxy = &p;
249 void *obj; 248 void *obj;
250 R (object::*meth)(A1, A2, A3, A4, A5); 249 R (object::*meth)(A1, A2, A3, A4, A5);
251 250
252 /* a proxy is a kind of recipe on how to call a specific class method */ 251 /* a proxy is a kind of recipe on how to call a specific class method */
253 struct proxy_base { 252 struct proxy_base {
254 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) = 0; 253 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const = 0;
255 }; 254 };
256 template<class O1, class O2> 255 template<class O1, class O2>
257 struct proxy : proxy_base { 256 struct proxy : proxy_base {
258 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) 257 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
259 { 258 {
260 ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4, A5)>(meth))) 259 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4, A5)>(meth)))
261 (a1, a2, a3, a4, a5); 260 (a1, a2, a3, a4, a5);
262 } 261 }
263 }; 262 };
264 263
265 proxy_base *prxy; 264 proxy_base *prxy;
266 265
267public: 266public:
268 template<class O1, class O2> 267 template<class O1, class O2>
269 callback5 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5)) 268 explicit callback5 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5))
270 { 269 {
271 static proxy<O1,O2> p; 270 static proxy<O1,O2> p;
272 obj = reinterpret_cast<void *>(object); 271 obj = reinterpret_cast<void *>(object);
273 meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4, A5)>(method); 272 meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4, A5)>(method);
274 prxy = &p; 273 prxy = &p;
292 void *obj; 291 void *obj;
293 R (object::*meth)(A1, A2, A3, A4, A5, A6); 292 R (object::*meth)(A1, A2, A3, A4, A5, A6);
294 293
295 /* a proxy is a kind of recipe on how to call a specific class method */ 294 /* a proxy is a kind of recipe on how to call a specific class method */
296 struct proxy_base { 295 struct proxy_base {
297 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) = 0; 296 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const = 0;
298 }; 297 };
299 template<class O1, class O2> 298 template<class O1, class O2>
300 struct proxy : proxy_base { 299 struct proxy : proxy_base {
301 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) 300 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
302 { 301 {
303 ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4, A5, A6)>(meth))) 302 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4, A5, A6)>(meth)))
304 (a1, a2, a3, a4, a5, a6); 303 (a1, a2, a3, a4, a5, a6);
305 } 304 }
306 }; 305 };
307 306
308 proxy_base *prxy; 307 proxy_base *prxy;
309 308
310public: 309public:
311 template<class O1, class O2> 310 template<class O1, class O2>
312 callback6 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5, A6)) 311 explicit callback6 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5, A6))
313 { 312 {
314 static proxy<O1,O2> p; 313 static proxy<O1,O2> p;
315 obj = reinterpret_cast<void *>(object); 314 obj = reinterpret_cast<void *>(object);
316 meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4, A5, A6)>(method); 315 meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4, A5, A6)>(method);
317 prxy = &p; 316 prxy = &p;
335 void *obj; 334 void *obj;
336 R (object::*meth)(A1, A2, A3, A4, A5, A6, A7); 335 R (object::*meth)(A1, A2, A3, A4, A5, A6, A7);
337 336
338 /* a proxy is a kind of recipe on how to call a specific class method */ 337 /* a proxy is a kind of recipe on how to call a specific class method */
339 struct proxy_base { 338 struct proxy_base {
340 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6, A7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) = 0; 339 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6, A7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const = 0;
341 }; 340 };
342 template<class O1, class O2> 341 template<class O1, class O2>
343 struct proxy : proxy_base { 342 struct proxy : proxy_base {
344 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6, A7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) 343 virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6, A7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
345 { 344 {
346 ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4, A5, A6, A7)>(meth))) 345 return (R)((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4, A5, A6, A7)>(meth)))
347 (a1, a2, a3, a4, a5, a6, a7); 346 (a1, a2, a3, a4, a5, a6, a7);
348 } 347 }
349 }; 348 };
350 349
351 proxy_base *prxy; 350 proxy_base *prxy;
352 351
353public: 352public:
354 template<class O1, class O2> 353 template<class O1, class O2>
355 callback7 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5, A6, A7)) 354 explicit callback7 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5, A6, A7))
356 { 355 {
357 static proxy<O1,O2> p; 356 static proxy<O1,O2> p;
358 obj = reinterpret_cast<void *>(object); 357 obj = reinterpret_cast<void *>(object);
359 meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4, A5, A6, A7)>(method); 358 meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4, A5, A6, A7)>(method);
360 prxy = &p; 359 prxy = &p;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines