sprint 1-alpha
sprint/thread/bind.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 *   sprint::bind
00003 *
00004 *   Copyright (C) 2005-2011  Paolo Medici <www.pmx.it>
00005 *
00006 *  This library is free software; you can redistribute it and/or
00007 *  modify it under the terms of the GNU Lesser General Public
00008 *  License as published by the Free Software Foundation; either
00009 *  version 2.1 of the License, or (at your option) any later version.
00010 *
00011 *  This library is distributed in the hope that it will be useful,
00012 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 *  Lesser General Public License for more details.
00015 *
00016 *  You should have received a copy of the GNU Lesser General Public
00017 *  License along with this library; if not, write to the Free Software
00018 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00019 *
00020 *******************************************************************************/
00021 
00022 #ifndef _SPRINT_THREAD_bind_H
00023 #define _SPRINT_THREAD_bind_H
00024 
00025 // $generated on Oct 31 2011 15:01:05$
00026 
00032 #include <sprint/thread/detail/function.h>
00033 #include <sprint/function/detail/invoker.h>
00034 
00035 namespace sprint {
00036 
00046   template<typename T, typename R, R (T::*F)(void)>
00047   inline thread_function thread_bind(T * obj)
00048   {
00049                 return thread_function( sprint::detail::embedded_mem_fun<R,T,F>, reinterpret_cast<LPVOID>(obj));
00050   }
00051 
00052 /* ptr function invoker */
00053 
00055 template<class R>
00056 inline thread_function thread_bind(R (*Proc)())
00057         {
00058         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_0<R> >, reinterpret_cast<LPVOID>( new_tuple(Proc) ));
00059         }
00060 
00061 template<>
00062 inline thread_function thread_bind(void (*Proc)())
00063         {
00064         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_0<void> >, reinterpret_cast<LPVOID>( new_tuple(Proc) ));
00065         }
00066 
00068 template<class R, class A1, class P1>
00069 inline thread_function thread_bind(R (*Proc)(A1), P1 p1)
00070         {
00071         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_1<R, P1> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1) ));
00072         }
00073 
00074 template<class A1, class P1>
00075 inline thread_function thread_bind(void (*Proc)(A1), P1 p1)
00076         {
00077         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_1<void, P1> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1) ));
00078         }
00079 
00081 template<class R, class A1, class A2, class P1, class P2>
00082 inline thread_function thread_bind(R (*Proc)(A1, A2), P1 p1, P2 p2)
00083         {
00084         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_2<R, P1, P2> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2) ));
00085         }
00086 
00087 template<class A1, class A2, class P1, class P2>
00088 inline thread_function thread_bind(void (*Proc)(A1, A2), P1 p1, P2 p2)
00089         {
00090         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_2<void, P1, P2> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2) ));
00091         }
00092 
00094 template<class R, class A1, class A2, class A3, class P1, class P2, class P3>
00095 inline thread_function thread_bind(R (*Proc)(A1, A2, A3), P1 p1, P2 p2, P3 p3)
00096         {
00097         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_3<R, P1, P2, P3> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3) ));
00098         }
00099 
00100 template<class A1, class A2, class A3, class P1, class P2, class P3>
00101 inline thread_function thread_bind(void (*Proc)(A1, A2, A3), P1 p1, P2 p2, P3 p3)
00102         {
00103         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_3<void, P1, P2, P3> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3) ));
00104         }
00105 
00107 template<class R, class A1, class A2, class A3, class A4, class P1, class P2, class P3, class P4>
00108 inline thread_function thread_bind(R (*Proc)(A1, A2, A3, A4), P1 p1, P2 p2, P3 p3, P4 p4)
00109         {
00110         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_4<R, P1, P2, P3, P4> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4) ));
00111         }
00112 
00113 template<class A1, class A2, class A3, class A4, class P1, class P2, class P3, class P4>
00114 inline thread_function thread_bind(void (*Proc)(A1, A2, A3, A4), P1 p1, P2 p2, P3 p3, P4 p4)
00115         {
00116         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_4<void, P1, P2, P3, P4> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4) ));
00117         }
00118 
00120 template<class R, class A1, class A2, class A3, class A4, class A5,
00121         class P1, class P2, class P3, class P4, class P5>
00122 inline thread_function thread_bind(R (*Proc)(A1, A2, A3, A4, A5), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
00123         {
00124         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_5<R, P1, P2, P3, P4, P5> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4, p5) ));
00125         }
00126 
00127 template<class A1, class A2, class A3, class A4, class A5, class P1, class P2, class P3, class P4, class P5>
00128 inline thread_function thread_bind(void (*Proc)(A1, A2, A3, A4, A5), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
00129         {
00130         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_5<void, P1, P2, P3, P4, P5> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4, p5) ));
00131         }
00132 
00134 template<class R, class A1, class A2, class A3, class A4, class A5, class A6,
00135         class P1, class P2, class P3, class P4, class P5, class P6>
00136 inline thread_function thread_bind(R (*Proc)(A1, A2, A3, A4, A5, A6), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
00137         {
00138         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_6<R, P1, P2, P3, P4, P5, P6> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4, p5, p6) ));
00139         }
00140 
00141 template<class A1, class A2, class A3, class A4, class A5, class A6, class P1, class P2, class P3, class P4, class P5, class P6>
00142 inline thread_function thread_bind(void (*Proc)(A1, A2, A3, A4, A5, A6), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
00143         {
00144         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_6<void, P1, P2, P3, P4, P5, P6> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4, p5, p6) ));
00145         }
00146 
00148 template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7,
00149         class P1, class P2, class P3, class P4, class P5, class P6, class P7>
00150 inline thread_function thread_bind(R (*Proc)(A1, A2, A3, A4, A5, A6, A7), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
00151         {
00152         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_7<R, P1, P2, P3, P4, P5, P6, P7> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4, p5, p6, p7) ));
00153         }
00154 
00155 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class P1, class P2, class P3, class P4, class P5, class P6, class P7>
00156 inline thread_function thread_bind(void (*Proc)(A1, A2, A3, A4, A5, A6, A7), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
00157         {
00158         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_7<void, P1, P2, P3, P4, P5, P6, P7> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4, p5, p6, p7) ));
00159         }
00160 
00162 template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8,
00163         class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>
00164 inline thread_function thread_bind(R (*Proc)(A1, A2, A3, A4, A5, A6, A7, A8), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
00165         {
00166         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_8<R, P1, P2, P3, P4, P5, P6, P7, P8> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4, p5, p6, p7, p8) ));
00167         }
00168 
00169 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>
00170 inline thread_function thread_bind(void (*Proc)(A1, A2, A3, A4, A5, A6, A7, A8), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
00171         {
00172         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_8<void, P1, P2, P3, P4, P5, P6, P7, P8> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4, p5, p6, p7, p8) ));
00173         }
00174 
00176 template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9,
00177         class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9>
00178 inline thread_function thread_bind(R (*Proc)(A1, A2, A3, A4, A5, A6, A7, A8, A9), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9)
00179         {
00180         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_9<R, P1, P2, P3, P4, P5, P6, P7, P8, P9> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4, p5, p6, p7, p8, p9) ));
00181         }
00182 
00183 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9>
00184 inline thread_function thread_bind(void (*Proc)(A1, A2, A3, A4, A5, A6, A7, A8, A9), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9)
00185         {
00186         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_9<void, P1, P2, P3, P4, P5, P6, P7, P8, P9> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4, p5, p6, p7, p8, p9) ));
00187         }
00188 
00190 template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10,
00191         class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10>
00192 inline thread_function thread_bind(R (*Proc)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10)
00193         {
00194         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_10<R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) ));
00195         }
00196 
00197 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10>
00198 inline thread_function thread_bind(void (*Proc)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10)
00199         {
00200         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_10<void, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) ));
00201         }
00202 
00204 template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10, class A11,
00205         class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10, class P11>
00206 inline thread_function thread_bind(R (*Proc)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11)
00207         {
00208         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_11<R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) ));
00209         }
00210 
00211 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10, class A11, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10, class P11>
00212 inline thread_function thread_bind(void (*Proc)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11), P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11)
00213         {
00214         return thread_function( sprint::detail::thread_fun< sprint::detail::ptr_fun_11<void, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11> >, reinterpret_cast<LPVOID>( new_tuple(Proc, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) ));
00215         }
00216 
00217 
00218 /* mem function invoker */
00219 
00221 template<class T, class R>
00222 inline thread_function thread_bind(R (T::*Proc)(), T *_this)
00223         {
00224         return thread_function( sprint::detail::thread_fun< sprint::detail::mem_fun_0<R, T> > , reinterpret_cast<LPVOID>(new_tuple(Proc, _this) ));
00225         }
00226 
00228 template<class T, class R, class A1, class P1>
00229 inline thread_function thread_bind(R (T::*Proc)(A1), T *_this, P1 p1)
00230         {
00231         return thread_function( sprint::detail::thread_fun< sprint::detail::mem_fun_1<R, T, P1> > , reinterpret_cast<LPVOID>(new_tuple(Proc, _this, p1) ));
00232         }
00233 
00235 template<class T, class R, class A1, class A2, class P1, class P2>
00236 inline thread_function thread_bind(R (T::*Proc)(A1, A2), T *_this, P1 p1, P2 p2)
00237         {
00238         return thread_function( sprint::detail::thread_fun< sprint::detail::mem_fun_2<R, T, P1, P2> > , reinterpret_cast<LPVOID>(new_tuple(Proc, _this, p1, p2) ));
00239         }
00240 
00242 template<class T, class R, class A1, class A2, class A3, class P1, class P2, class P3>
00243 inline thread_function thread_bind(R (T::*Proc)(A1, A2, A3), T *_this, P1 p1, P2 p2, P3 p3)
00244         {
00245         return thread_function( sprint::detail::thread_fun< sprint::detail::mem_fun_3<R, T, P1, P2, P3> > , reinterpret_cast<LPVOID>(new_tuple(Proc, _this, p1, p2, p3) ));
00246         }
00247 
00249 template<class T, class R, class A1, class A2, class A3, class A4, class P1, class P2, class P3, class P4>
00250 inline thread_function thread_bind(R (T::*Proc)(A1, A2, A3, A4), T *_this, P1 p1, P2 p2, P3 p3, P4 p4)
00251         {
00252         return thread_function( sprint::detail::thread_fun< sprint::detail::mem_fun_4<R, T, P1, P2, P3, P4> > , reinterpret_cast<LPVOID>(new_tuple(Proc, _this, p1, p2, p3, p4) ));
00253         }
00254 
00256 template<class T, class R, class A1, class A2, class A3, class A4, class A5,
00257         class P1, class P2, class P3, class P4, class P5>
00258 inline thread_function thread_bind(R (T::*Proc)(A1, A2, A3, A4, A5), T *_this, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
00259         {
00260         return thread_function( sprint::detail::thread_fun< sprint::detail::mem_fun_5<R, T, P1, P2, P3, P4, P5> > , reinterpret_cast<LPVOID>(new_tuple(Proc, _this, p1, p2, p3, p4, p5) ));
00261         }
00262 
00264 template<class T, class R, class A1, class A2, class A3, class A4, class A5, class A6,
00265         class P1, class P2, class P3, class P4, class P5, class P6>
00266 inline thread_function thread_bind(R (T::*Proc)(A1, A2, A3, A4, A5, A6), T *_this, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
00267         {
00268         return thread_function( sprint::detail::thread_fun< sprint::detail::mem_fun_6<R, T, P1, P2, P3, P4, P5, P6> > , reinterpret_cast<LPVOID>(new_tuple(Proc, _this, p1, p2, p3, p4, p5, p6) ));
00269         }
00270 
00272 template<class T, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7,
00273         class P1, class P2, class P3, class P4, class P5, class P6, class P7>
00274 inline thread_function thread_bind(R (T::*Proc)(A1, A2, A3, A4, A5, A6, A7), T *_this, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
00275         {
00276         return thread_function( sprint::detail::thread_fun< sprint::detail::mem_fun_7<R, T, P1, P2, P3, P4, P5, P6, P7> > , reinterpret_cast<LPVOID>(new_tuple(Proc, _this, p1, p2, p3, p4, p5, p6, p7) ));
00277         }
00278 
00280 template<class T, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8,
00281         class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8>
00282 inline thread_function thread_bind(R (T::*Proc)(A1, A2, A3, A4, A5, A6, A7, A8), T *_this, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
00283         {
00284         return thread_function( sprint::detail::thread_fun< sprint::detail::mem_fun_8<R, T, P1, P2, P3, P4, P5, P6, P7, P8> > , reinterpret_cast<LPVOID>(new_tuple(Proc, _this, p1, p2, p3, p4, p5, p6, p7, p8) ));
00285         }
00286 
00288 template<class T, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9,
00289         class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9>
00290 inline thread_function thread_bind(R (T::*Proc)(A1, A2, A3, A4, A5, A6, A7, A8, A9), T *_this, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9)
00291         {
00292         return thread_function( sprint::detail::thread_fun< sprint::detail::mem_fun_9<R, T, P1, P2, P3, P4, P5, P6, P7, P8, P9> > , reinterpret_cast<LPVOID>(new_tuple(Proc, _this, p1, p2, p3, p4, p5, p6, p7, p8, p9) ));
00293         }
00294 
00295 
00296 } //sprint
00297 
00298 #endif
00299 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines