--- gvpe/src/callback.h 2007/12/04 15:01:12 1.12 +++ gvpe/src/callback.h 2008/08/07 17:54:26 1.15 @@ -3,24 +3,34 @@ // THIS IS A GENERATED FILE: distribution. /* - callback.h -- C++ callback mechanism - Copyright (C) 2003-2007 Marc Lehmann - - This file is part of GVPE. - - GVPE is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with gvpe; if not, write to the Free Software - Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * callback.h -- C++ callback mechanism + * Copyright (C) 2003-2008 Marc Lehmann + * + * This file is part of GVPE. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + * + * Additional permission under GNU GPL version 3 section 7 + * + * If you modify this Program, or any covered work, by linking or + * combining it with the OpenSSL project's OpenSSL library (or a modified + * version of that library), containing parts covered by the terms of the + * OpenSSL or SSLeay licenses, the licensors of this Program grant you + * additional permission to convey the resulting work. Corresponding + * Source for a non-source form of such a combination shall include the + * source code for the parts of OpenSSL used as well as that of the + * covered work. */ #ifndef CALLBACK_H__ @@ -31,37 +41,11 @@ template struct callback; -#define callback_set(callback,obj,klass,method) callback.set (obj) - template struct callback { typedef R (*ptr_type)(void *self); -private: - - void *self; - ptr_type func; - -protected: - - template - struct thunktype; - - template - struct thunktype - { - typedef klass K; - }; - - template - static R thunk (void *self) - { - klass *obj = static_cast(self); - return (obj->*method) (); - } - -public: template void set (K *object) { @@ -78,37 +62,25 @@ { return call (); } -}; - -template -struct callback -{ - typedef R (*ptr_type)(void *self, A1); private: void *self; ptr_type func; -protected: - - template - struct thunktype; - - template - struct thunktype - { - typedef klass K; - }; - - template - static R thunk (void *self, A1 a1) + template + static R thunk (void *self) { klass *obj = static_cast(self); - return (obj->*method) (a1); + return (obj->*method) (); } +}; + +template +struct callback +{ + typedef R (*ptr_type)(void *self, A1); -public: template void set (K *object) { @@ -125,37 +97,25 @@ { return call (a1); } -}; - -template -struct callback -{ - typedef R (*ptr_type)(void *self, A1, A2); private: void *self; ptr_type func; -protected: - - template - struct thunktype; - - template - struct thunktype - { - typedef klass K; - }; - - template - static R thunk (void *self, A1 a1, A2 a2) + template + static R thunk (void *self, A1 a1) { klass *obj = static_cast(self); - return (obj->*method) (a1, a2); + return (obj->*method) (a1); } +}; + +template +struct callback +{ + typedef R (*ptr_type)(void *self, A1, A2); -public: template void set (K *object) { @@ -172,37 +132,25 @@ { return call (a1, a2); } -}; - -template -struct callback -{ - typedef R (*ptr_type)(void *self, A1, A2, A3); private: void *self; ptr_type func; -protected: - - template - struct thunktype; - - template - struct thunktype - { - typedef klass K; - }; - - template - static R thunk (void *self, A1 a1, A2 a2, A3 a3) + template + static R thunk (void *self, A1 a1, A2 a2) { klass *obj = static_cast(self); - return (obj->*method) (a1, a2, a3); + return (obj->*method) (a1, a2); } +}; + +template +struct callback +{ + typedef R (*ptr_type)(void *self, A1, A2, A3); -public: template void set (K *object) { @@ -219,37 +167,25 @@ { return call (a1, a2, a3); } -}; - -template -struct callback -{ - typedef R (*ptr_type)(void *self, A1, A2, A3, A4); private: void *self; ptr_type func; -protected: - - template - struct thunktype; - - template - struct thunktype - { - typedef klass K; - }; - - template - static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4) + template + static R thunk (void *self, A1 a1, A2 a2, A3 a3) { klass *obj = static_cast(self); - return (obj->*method) (a1, a2, a3, a4); + return (obj->*method) (a1, a2, a3); } +}; + +template +struct callback +{ + typedef R (*ptr_type)(void *self, A1, A2, A3, A4); -public: template void set (K *object) { @@ -266,37 +202,25 @@ { return call (a1, a2, a3, a4); } -}; - -template -struct callback -{ - typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5); private: void *self; ptr_type func; -protected: - - template - struct thunktype; - - template - struct thunktype - { - typedef klass K; - }; - - template - static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) + template + static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4) { klass *obj = static_cast(self); - return (obj->*method) (a1, a2, a3, a4, a5); + return (obj->*method) (a1, a2, a3, a4); } +}; + +template +struct callback +{ + typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5); -public: template void set (K *object) { @@ -313,37 +237,25 @@ { return call (a1, a2, a3, a4, a5); } -}; - -template -struct callback -{ - typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6); private: void *self; ptr_type func; -protected: - - template - struct thunktype; - - template - struct thunktype - { - typedef klass K; - }; - - template - static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) + template + static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { klass *obj = static_cast(self); - return (obj->*method) (a1, a2, a3, a4, a5, a6); + return (obj->*method) (a1, a2, a3, a4, a5); } +}; + +template +struct callback +{ + typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6); -public: template void set (K *object) { @@ -360,37 +272,25 @@ { return call (a1, a2, a3, a4, a5, a6); } -}; - -template -struct callback -{ - typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7); private: void *self; ptr_type func; -protected: - - template - struct thunktype; - - template - struct thunktype - { - typedef klass K; - }; - - template - static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) + template + static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { klass *obj = static_cast(self); - return (obj->*method) (a1, a2, a3, a4, a5, a6, a7); + return (obj->*method) (a1, a2, a3, a4, a5, a6); } +}; + +template +struct callback +{ + typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7); -public: template void set (K *object) { @@ -407,37 +307,25 @@ { return call (a1, a2, a3, a4, a5, a6, a7); } -}; - -template -struct callback -{ - typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7, A8); private: void *self; ptr_type func; -protected: - - template - struct thunktype; - - template - struct thunktype - { - typedef klass K; - }; - - template - static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) + template + static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { klass *obj = static_cast(self); - return (obj->*method) (a1, a2, a3, a4, a5, a6, a7, a8); + return (obj->*method) (a1, a2, a3, a4, a5, a6, a7); } +}; + +template +struct callback +{ + typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7, A8); -public: template void set (K *object) { @@ -454,37 +342,25 @@ { return call (a1, a2, a3, a4, a5, a6, a7, a8); } -}; - -template -struct callback -{ - typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7, A8, A9); private: void *self; ptr_type func; -protected: - - template - struct thunktype; - - template - struct thunktype - { - typedef klass K; - }; - - template - static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) + template + static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { klass *obj = static_cast(self); - return (obj->*method) (a1, a2, a3, a4, a5, a6, a7, a8, a9); + return (obj->*method) (a1, a2, a3, a4, a5, a6, a7, a8); } +}; + +template +struct callback +{ + typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7, A8, A9); -public: template void set (K *object) { @@ -501,37 +377,25 @@ { return call (a1, a2, a3, a4, a5, a6, a7, a8, a9); } -}; - -template -struct callback -{ - typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); private: void *self; ptr_type func; -protected: - - template - struct thunktype; - - template - struct thunktype - { - typedef klass K; - }; - - template - static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) + template + static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { klass *obj = static_cast(self); - return (obj->*method) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + return (obj->*method) (a1, a2, a3, a4, a5, a6, a7, a8, a9); } +}; + +template +struct callback +{ + typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10); -public: template void set (K *object) { @@ -548,6 +412,18 @@ { return call (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } + +private: + + void *self; + ptr_type func; + + template + static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) + { + klass *obj = static_cast(self); + return (obj->*method) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } };