--- gvpe/src/callback.h 2003/04/02 03:06:22 1.1 +++ gvpe/src/callback.h 2003/04/02 05:14:59 1.2 @@ -1,3 +1,10 @@ +// THIS IS A GENERATED FILE, RUN callback.pl to regenerate it +// THIS IS A GENERATED FILE, RUN callback.pl to regenerate it +// THIS IS A GENERATED FILE, RUN callback.pl to regenerate it +// THIS IS A GENERATED FILE, RUN callback.pl to regenerate it +// THIS IS A GENERATED FILE, RUN callback.pl to regenerate it +// THIS IS A GENERATED FILE, RUN callback.pl to regenerate it + /* callback.h -- C++ callback mechanism @@ -19,23 +26,23 @@ #ifndef VPE_CALLBACK_H__ #define VPE_CALLBACK_H__ -template -class callback { +template +class callback0 { struct object { }; void *obj; - R (object::*meth)(A arg); + R (object::*meth)(); - // a proxy is a kind of recipe on how to call a specific class method + /* a proxy is a kind of recipe on how to call a specific class method */ struct proxy_base { - virtual R call (void *obj, R (object::*meth)(A), A arg) = 0; + virtual R call (void *obj, R (object::*meth)()) = 0; }; template struct proxy : proxy_base { - virtual R call (void *obj, R (object::*meth)(A), A arg) + virtual R call (void *obj, R (object::*meth)()) { - ((reinterpret_cast(obj)) ->* (reinterpret_cast(meth))) - (arg); + ((reinterpret_cast(obj)) ->* (reinterpret_cast(meth))) + (); } }; @@ -43,24 +50,324 @@ public: template - callback (O1 *object, R (O2::*method)(A)) + callback0 (O1 *object, R (O2::*method)()) { static proxy p; obj = reinterpret_cast(object); - meth = reinterpret_cast(method); + meth = reinterpret_cast(method); prxy = &p; } - R call(A arg) const + R call() const { - return prxy->call (obj, meth, arg); + return prxy->call (obj, meth); } - R operator ()(A arg) const + R operator ()() const { - return call (arg); + return call (); } }; -#endif +template +class callback1 { + struct object { }; + + void *obj; + R (object::*meth)(A1); + + /* a proxy is a kind of recipe on how to call a specific class method */ + struct proxy_base { + virtual R call (void *obj, R (object::*meth)(A1), A1 a1) = 0; + }; + template + struct proxy : proxy_base { + virtual R call (void *obj, R (object::*meth)(A1), A1 a1) + { + ((reinterpret_cast(obj)) ->* (reinterpret_cast(meth))) + (a1); + } + }; + + proxy_base *prxy; + +public: + template + callback1 (O1 *object, R (O2::*method)(A1)) + { + static proxy p; + obj = reinterpret_cast(object); + meth = reinterpret_cast(method); + prxy = &p; + } + + R call(A1 a1) const + { + return prxy->call (obj, meth, a1); + } + + R operator ()(A1 a1) const + { + return call (a1); + } +}; + +template +class callback2 { + struct object { }; + + void *obj; + R (object::*meth)(A1, A2); + + /* a proxy is a kind of recipe on how to call a specific class method */ + struct proxy_base { + virtual R call (void *obj, R (object::*meth)(A1, A2), A1 a1, A2 a2) = 0; + }; + template + struct proxy : proxy_base { + virtual R call (void *obj, R (object::*meth)(A1, A2), A1 a1, A2 a2) + { + ((reinterpret_cast(obj)) ->* (reinterpret_cast(meth))) + (a1, a2); + } + }; + + proxy_base *prxy; + +public: + template + callback2 (O1 *object, R (O2::*method)(A1, A2)) + { + static proxy p; + obj = reinterpret_cast(object); + meth = reinterpret_cast(method); + prxy = &p; + } + R call(A1 a1, A2 a2) const + { + return prxy->call (obj, meth, a1, a2); + } + + R operator ()(A1 a1, A2 a2) const + { + return call (a1, a2); + } +}; + +template +class callback3 { + struct object { }; + + void *obj; + R (object::*meth)(A1, A2, A3); + + /* a proxy is a kind of recipe on how to call a specific class method */ + struct proxy_base { + virtual R call (void *obj, R (object::*meth)(A1, A2, A3), A1 a1, A2 a2, A3 a3) = 0; + }; + template + struct proxy : proxy_base { + virtual R call (void *obj, R (object::*meth)(A1, A2, A3), A1 a1, A2 a2, A3 a3) + { + ((reinterpret_cast(obj)) ->* (reinterpret_cast(meth))) + (a1, a2, a3); + } + }; + + proxy_base *prxy; + +public: + template + callback3 (O1 *object, R (O2::*method)(A1, A2, A3)) + { + static proxy p; + obj = reinterpret_cast(object); + meth = reinterpret_cast(method); + prxy = &p; + } + + R call(A1 a1, A2 a2, A3 a3) const + { + return prxy->call (obj, meth, a1, a2, a3); + } + + R operator ()(A1 a1, A2 a2, A3 a3) const + { + return call (a1, a2, a3); + } +}; + +template +class callback4 { + struct object { }; + + void *obj; + R (object::*meth)(A1, A2, A3, A4); + + /* a proxy is a kind of recipe on how to call a specific class method */ + struct proxy_base { + virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4) = 0; + }; + template + struct proxy : proxy_base { + virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4) + { + ((reinterpret_cast(obj)) ->* (reinterpret_cast(meth))) + (a1, a2, a3, a4); + } + }; + + proxy_base *prxy; + +public: + template + callback4 (O1 *object, R (O2::*method)(A1, A2, A3, A4)) + { + static proxy p; + obj = reinterpret_cast(object); + meth = reinterpret_cast(method); + prxy = &p; + } + + R call(A1 a1, A2 a2, A3 a3, A4 a4) const + { + return prxy->call (obj, meth, a1, a2, a3, a4); + } + + R operator ()(A1 a1, A2 a2, A3 a3, A4 a4) const + { + return call (a1, a2, a3, a4); + } +}; + +template +class callback5 { + struct object { }; + + void *obj; + R (object::*meth)(A1, A2, A3, A4, A5); + + /* a proxy is a kind of recipe on how to call a specific class method */ + struct proxy_base { + virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) = 0; + }; + template + struct proxy : proxy_base { + virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) + { + ((reinterpret_cast(obj)) ->* (reinterpret_cast(meth))) + (a1, a2, a3, a4, a5); + } + }; + + proxy_base *prxy; + +public: + template + callback5 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5)) + { + static proxy p; + obj = reinterpret_cast(object); + meth = reinterpret_cast(method); + prxy = &p; + } + + R call(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + return prxy->call (obj, meth, a1, a2, a3, a4, a5); + } + + R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + return call (a1, a2, a3, a4, a5); + } +}; + +template +class callback6 { + struct object { }; + + void *obj; + R (object::*meth)(A1, A2, A3, A4, A5, A6); + + /* a proxy is a kind of recipe on how to call a specific class method */ + struct proxy_base { + 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; + }; + template + struct proxy : proxy_base { + 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) + { + ((reinterpret_cast(obj)) ->* (reinterpret_cast(meth))) + (a1, a2, a3, a4, a5, a6); + } + }; + + proxy_base *prxy; + +public: + template + callback6 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5, A6)) + { + static proxy p; + obj = reinterpret_cast(object); + meth = reinterpret_cast(method); + prxy = &p; + } + + R call(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + return prxy->call (obj, meth, a1, a2, a3, a4, a5, a6); + } + + R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + return call (a1, a2, a3, a4, a5, a6); + } +}; + +template +class callback7 { + struct object { }; + + void *obj; + R (object::*meth)(A1, A2, A3, A4, A5, A6, A7); + + /* a proxy is a kind of recipe on how to call a specific class method */ + struct proxy_base { + 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; + }; + template + struct proxy : proxy_base { + 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) + { + ((reinterpret_cast(obj)) ->* (reinterpret_cast(meth))) + (a1, a2, a3, a4, a5, a6, a7); + } + }; + + proxy_base *prxy; + +public: + template + callback7 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5, A6, A7)) + { + static proxy p; + obj = reinterpret_cast(object); + meth = reinterpret_cast(method); + prxy = &p; + } + + R call(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + return prxy->call (obj, meth, a1, a2, a3, a4, a5, a6, a7); + } + + R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + return call (a1, a2, a3, a4, a5, a6, a7); + } +}; + +#endif