csutil/threadevent.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

csutil/threadevent.h

    00001 /*
    00002   Copyright (C) 2008 by Michael Gist
    00003
    00004   This library is free software; you can redistribute it and/or
    00005   modify it under the terms of the GNU Lesser General Public
    00006   License as published by the Free Software Foundation; either
    00007   version 2 of the License, or (at your option) any later version.
    00008
    00009   This library is distributed in the hope that it will be useful,
    00010   but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012   Library General Public License for more details.
    00013
    00014   You should have received a copy of the GNU Library General Public
    00015   License along with this library; if not, write to the Free
    00016   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00017 */
    00018
    00019 #ifndef __CS_CSUTIL_THREADEVENT_H__
    00020 #define __CS_CSUTIL_THREADEVENT_H__
    00021
    00022 #include "csutil/array.h"
    00023 #include "csutil/mempool.h"
    00024 #include "csutil/scf_implementation.h"
    00025 #include "csutil/scf_interface.h"
    00026 #include "csutil/weakref.h"
    00027 #include "iutil/job.h"
    00028
    00029 class TEventMemPool;
    00030
    00031 template<class T>
    00032 class ThreadedCallable
    00033 {
    00034 public:
    00035   ThreadedCallable() {}
    00036   virtual ~ThreadedCallable() {}
    00037
    00038   virtual iObjectRegistry* GetObjectRegistry() const = 0;
    00039
    00040   template<typename A1>
    00041   struct Args1 { A1* a1; };
    00042   template<typename A1, typename A2>
    00043   struct Args2 : public Args1<A1> { A2* a2; };
    00044   template<typename A1, typename A2, typename A3>
    00045   struct Args3 : public Args2<A1, A2> { A3* a3; };
    00046   template<typename A1, typename A2, typename A3, typename A4>
    00047   struct Args4 : public Args3<A1, A2, A3> { A4* a4; };
    00048   template<typename A1, typename A2, typename A3, typename A4, typename A5>
    00049   struct Args5 : public Args4<A1, A2, A3, A4> { A5* a5; };
    00050   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
    00051   struct Args6 : public Args5<A1, A2, A3, A4, A5> { A6* a6; };
    00052   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
    00053   struct Args7 : public Args6<A1, A2, A3, A4, A5, A6> { A7* a7; };
    00054   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
    00055   struct Args8 : public Args7<A1, A2, A3, A4, A5, A6, A7> { A8* a8; };
    00056   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9>
    00057   struct Args9 : public Args8<A1, A2, A3, A4, A5, A6, A7, A8> { A9* a9; };
    00058   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10>
    00059   struct Args10 : public Args9<A1, A2, A3, A4, A5, A6, A7, A8, A9> { A10* a10; };
    00060   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11>
    00061   struct Args11 : public Args10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> { A11* a11; };
    00062   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12>
    00063   struct Args12 : public Args11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> { A12* a12; };
    00064   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13>
    00065   struct Args13 : public Args12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12> { A13* a13; };
    00066   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13, typename A14>
    00067   struct Args14 : public Args13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> { A14* a14; };
    00068   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13, typename A14, typename A15>
    00069   struct Args15 : public Args14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14> { A15* a15; };
    00070
    00071   template<typename A1>
    00072   static void FetchArgs1 (void const** inArgs, Args1<A1>& outArgs)
    00073   {
    00074     outArgs.a1 = (A1*)(inArgs[1]);
    00075   }
    00076   template<typename A1, typename A2>
    00077   static void FetchArgs2 (void const** inArgs, Args2<A1, A2>& outArgs)
    00078   {
    00079     outArgs.a2 = (A2*)(inArgs[2]);
    00080     FetchArgs1<A1> (inArgs, outArgs);
    00081   }
    00082   template<typename A1, typename A2, typename A3>
    00083   static void FetchArgs3 (void const** inArgs, Args3<A1, A2, A3>& outArgs)
    00084   {
    00085     outArgs.a3 = (A3*)(inArgs[3]);
    00086     FetchArgs2<A1, A2> (inArgs, outArgs);
    00087   }
    00088   template<typename A1, typename A2, typename A3, typename A4>
    00089   static void FetchArgs4 (void const** inArgs, Args4<A1, A2, A3, A4>& outArgs)
    00090   {
    00091     outArgs.a4 = (A4*)(inArgs[4]);
    00092     FetchArgs3<A1, A2, A3> (inArgs, outArgs);
    00093   }
    00094   template<typename A1, typename A2, typename A3, typename A4, typename A5>
    00095   static void FetchArgs5 (void const** inArgs, Args5<A1, A2, A3, A4, A5>& outArgs)
    00096   {
    00097     outArgs.a5 = (A5*)(inArgs[5]);
    00098     FetchArgs4<A1, A2, A3, A4> (inArgs, outArgs);
    00099   }
    00100   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
    00101   static void FetchArgs6 (void const** inArgs, Args6<A1, A2, A3, A4, A5, A6>& outArgs)
    00102   {
    00103     outArgs.a6 = (A6*)(inArgs[6]);
    00104     FetchArgs5<A1, A2, A3, A4, A5> (inArgs, outArgs);
    00105   }
    00106   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
    00107   static void FetchArgs7 (void const** inArgs, Args7<A1, A2, A3, A4, A5, A6, A7>& outArgs)
    00108   {
    00109     outArgs.a7 = (A7*)(inArgs[7]);
    00110     FetchArgs6<A1, A2, A3, A4, A5, A6> (inArgs, outArgs);
    00111   }
    00112   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
    00113   static void FetchArgs8 (void const** inArgs, Args8<A1, A2, A3, A4, A5, A6, A7, A8>& outArgs)
    00114   {
    00115     outArgs.a8 = (A8*)(inArgs[8]);
    00116     FetchArgs7<A1, A2, A3, A4, A5, A6, A7> (inArgs, outArgs);
    00117   }
    00118   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9>
    00119   static void FetchArgs9 (void const** inArgs, Args9<A1, A2, A3, A4, A5, A6, A7, A8, A9>& outArgs)
    00120   {
    00121     outArgs.a9 = (A9*)(inArgs[9]);
    00122     FetchArgs8<A1, A2, A3, A4, A5, A6, A7, A8> (inArgs, outArgs);
    00123   }
    00124   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10>
    00125   static void FetchArgs10 (void const** inArgs, Args10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>& outArgs)
    00126   {
    00127     outArgs.a10 = (A10*)(inArgs[10]);
    00128     FetchArgs9<A1, A2, A3, A4, A5, A6, A7, A8, A9> (inArgs, outArgs);
    00129   }
    00130   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11>
    00131   static void FetchArgs11 (void const** inArgs, Args11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>& outArgs)
    00132   {
    00133     outArgs.a11 = (A11*)(inArgs[11]);
    00134     FetchArgs10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> (inArgs, outArgs);
    00135   }
    00136   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12>
    00137   static void FetchArgs12 (void const** inArgs, Args12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>& outArgs)
    00138   {
    00139     outArgs.a12 = (A12*)(inArgs[12]);
    00140     FetchArgs11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> (inArgs, outArgs);
    00141   }
    00142   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13>
    00143   static void FetchArgs13 (void const** inArgs, Args13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>& outArgs)
    00144   {
    00145     outArgs.a13 = (A13*)(inArgs[13]);
    00146     FetchArgs12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12> (inArgs, outArgs);
    00147   }
    00148   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13, typename A14>
    00149   static void FetchArgs14 (void const** inArgs, Args14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>& outArgs)
    00150   {
    00151     outArgs.a14 = (A14*)(inArgs[14]);
    00152     FetchArgs13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> (inArgs, outArgs);
    00153   }
    00154   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13, typename A14, typename A15>
    00155   static void FetchArgs15 (void const** inArgs, Args15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>& outArgs)
    00156   {
    00157     outArgs.a15 = (A15*)(inArgs[15]);
    00158     FetchArgs14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14> (inArgs, outArgs);
    00159   }
    00160
    00161   template<typename A1>
    00162   static void FreeArgs1 (void const** args, const Args1<A1>& A)
    00163   {
    00164     TEventMemPool* mempool = (TEventMemPool*)args[0];
    00165     A.a1->Invalidate();
    00166     delete mempool;
    00167     delete[] args;
    00168   }
    00169   template<typename A1, typename A2>
    00170   static void FreeArgs2 (void const** args, const Args2<A1, A2>& A)
    00171   {
    00172     A.a2->~A2();
    00173     FreeArgs1<A1> (args, A);
    00174   }
    00175   template<typename A1, typename A2, typename A3>
    00176   static void FreeArgs3 (void const** args, const Args3<A1, A2, A3>& A)
    00177   {
    00178     A.a3->~A3();
    00179     FreeArgs2<A1, A2> (args, A);
    00180   }
    00181   template<typename A1, typename A2, typename A3, typename A4>
    00182   static void FreeArgs4 (void const** args, const Args4<A1, A2, A3, A4>& A)
    00183   {
    00184     A.a4->~A4();
    00185     FreeArgs3<A1, A2, A3> (args, A);
    00186   }
    00187   template<typename A1, typename A2, typename A3, typename A4, typename A5>
    00188   static void FreeArgs5 (void const** args, const Args5<A1, A2, A3, A4, A5>& A)
    00189   {
    00190     A.a5->~A5();
    00191     FreeArgs4<A1, A2, A3, A4> (args, A);
    00192   }
    00193   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
    00194   static void FreeArgs6 (void const** args, const Args6<A1, A2, A3, A4, A5, A6>& A)
    00195   {
    00196     A.a6->~A6();
    00197     FreeArgs5<A1, A2, A3, A4, A5> (args, A);
    00198   }
    00199   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
    00200   static void FreeArgs7 (void const** args, const Args7<A1, A2, A3, A4, A5, A6, A7>& A)
    00201   {
    00202     A.a7->~A7();
    00203     FreeArgs6<A1, A2, A3, A4, A5, A6> (args, A);
    00204   }
    00205   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
    00206   static void FreeArgs8 (void const** args, const Args8<A1, A2, A3, A4, A5, A6, A7, A8>& A)
    00207   {
    00208     A.a8->~A8();
    00209     FreeArgs7<A1, A2, A3, A4, A5, A6, A7> (args, A);
    00210   }
    00211   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9>
    00212   static void FreeArgs9 (void const** args, const Args9<A1, A2, A3, A4, A5, A6, A7, A8, A9>& A)
    00213   {
    00214     A.a9->~A9();
    00215     FreeArgs8<A1, A2, A3, A4, A5, A6, A7, A8> (args, A);
    00216   }
    00217   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10>
    00218   static void FreeArgs10 (void const** args, const Args10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>& A)
    00219   {
    00220     A.a10->~A10();
    00221     FreeArgs9<A1, A2, A3, A4, A5, A6, A7, A8, A9> (args, A);
    00222   }
    00223   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11>
    00224   static void FreeArgs11 (void const** args, const Args11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>& A)
    00225   {
    00226     A.a11->~A11();
    00227     FreeArgs10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> (args, A);
    00228   }
    00229   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12>
    00230   static void FreeArgs12 (void const** args, const Args12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>& A)
    00231   {
    00232     A.a12->~A12();
    00233     FreeArgs11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> (args, A);
    00234   }
    00235   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13>
    00236   static void FreeArgs13 (void const** args, const Args13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>& A)
    00237   {
    00238     A.a13->~A13();
    00239     FreeArgs12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12> (args, A);
    00240   }
    00241   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13, typename A14>
    00242   static void FreeArgs14 (void const** args, const Args14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>& A)
    00243   {
    00244     A.a14->~A14();
    00245     FreeArgs13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> (args, A);
    00246   }
    00247   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13, typename A14, typename A15>
    00248   static void FreeArgs15 (void const** args, const Args15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>& A)
    00249   {
    00250     A.a15->~A15();
    00251     FreeArgs14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14> (args, A);
    00252   }
    00253
    00254   template<typename A1, typename A2>
    00255   void RunMethod (bool (T::*method)(A1, A2), const Args2<A1, A2>& A)
    00256   {
    00257       T* mySelf = (T*)this;
    00258       if((mySelf->*method)(*A.a1, *A.a2))
    00259       {
    00260         (*A.a1)->MarkSuccessful();
    00261       }
    00262       (*A.a1)->MarkFinished();
    00263   }
    00264
    00265   template<typename A1, typename A2, typename A3>
    00266   void RunMethod (bool (T::*method)(A1, A2, A3), const Args3<A1, A2, A3>& A)
    00267   {
    00268       T* mySelf = (T*)this;
    00269       if((mySelf->*method)(*A.a1, *A.a2, *A.a3))
    00270       {
    00271         (*A.a1)->MarkSuccessful();
    00272       }
    00273       (*A.a1)->MarkFinished();
    00274   }
    00275
    00276   template<typename A1, typename A2, typename A3, typename A4>
    00277   void RunMethod (bool (T::*method)(A1, A2, A3, A4), const Args4<A1, A2, A3, A4>& A)
    00278   {
    00279       T* mySelf = (T*)this;
    00280       if((mySelf->*method)(*A.a1, *A.a2, *A.a3, *A.a4))
    00281       {
    00282         (*A.a1)->MarkSuccessful();
    00283       }
    00284       (*A.a1)->MarkFinished();
    00285   }
    00286
    00287   template<typename A1, typename A2, typename A3, typename A4, typename A5>
    00288   void RunMethod (bool (T::*method)(A1, A2, A3, A4, A5), const Args5<A1, A2, A3, A4, A5>& A)
    00289   {
    00290       T* mySelf = (T*)this;
    00291       if((mySelf->*method)(*A.a1, *A.a2, *A.a3, *A.a4, *A.a5))
    00292       {
    00293         (*A.a1)->MarkSuccessful();
    00294       }
    00295       (*A.a1)->MarkFinished();
    00296   }
    00297
    00298   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
    00299   void RunMethod (bool (T::*method)(A1, A2, A3, A4, A5, A6), const Args6<A1, A2, A3, A4, A5, A6>& A)
    00300   {
    00301       T* mySelf = (T*)this;
    00302       if((mySelf->*method)(*A.a1, *A.a2, *A.a3, *A.a4, *A.a5, *A.a6))
    00303       {
    00304         (*A.a1)->MarkSuccessful();
    00305       }
    00306       (*A.a1)->MarkFinished();
    00307   }
    00308
    00309   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
    00310   void RunMethod (bool (T::*method)(A1, A2, A3, A4, A5, A6, A7), const Args7<A1, A2, A3, A4, A5, A6, A7>& A)
    00311   {
    00312       T* mySelf = (T*)this;
    00313       if((mySelf->*method)(*A.a1, *A.a2, *A.a3, *A.a4, *A.a5, *A.a6, *A.a7))
    00314       {
    00315         (*A.a1)->MarkSuccessful();
    00316       }
    00317       (*A.a1)->MarkFinished();
    00318   }
    00319
    00320   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
    00321   void RunMethod (bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8), const Args8<A1, A2, A3, A4, A5, A6, A7, A8>& A)
    00322   {
    00323       T* mySelf = (T*)this;
    00324       if((mySelf->*method)(*A.a1, *A.a2, *A.a3, *A.a4, *A.a5, *A.a6, *A.a7, *A.a8))
    00325       {
    00326         (*A.a1)->MarkSuccessful();
    00327       }
    00328       (*A.a1)->MarkFinished();
    00329   }
    00330
    00331   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9>
    00332   void RunMethod (bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9), const Args9<A1, A2, A3, A4, A5, A6, A7, A8, A9>& A)
    00333   {
    00334       T* mySelf = (T*)this;
    00335       if((mySelf->*method)(*A.a1, *A.a2, *A.a3, *A.a4, *A.a5, *A.a6, *A.a7, *A.a8, *A.a9))
    00336       {
    00337         (*A.a1)->MarkSuccessful();
    00338       }
    00339       (*A.a1)->MarkFinished();
    00340   }
    00341
    00342   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10>
    00343   void RunMethod (bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10), const Args10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>& A)
    00344   {
    00345       T* mySelf = (T*)this;
    00346       if((mySelf->*method)(*A.a1, *A.a2, *A.a3, *A.a4, *A.a5, *A.a6, *A.a7, *A.a8, *A.a9, *A.a10))
    00347       {
    00348         (*A.a1)->MarkSuccessful();
    00349       }
    00350       (*A.a1)->MarkFinished();
    00351   }
    00352
    00353   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11>
    00354   void RunMethod (bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11), const Args11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>& A)
    00355   {
    00356       T* mySelf = (T*)this;
    00357       if((mySelf->*method)(*A.a1, *A.a2, *A.a3, *A.a4, *A.a5, *A.a6, *A.a7, *A.a8, *A.a9, *A.a10, *A.a11))
    00358       {
    00359         (*A.a1)->MarkSuccessful();
    00360       }
    00361       (*A.a1)->MarkFinished();
    00362   }
    00363
    00364   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12>
    00365   void RunMethod (bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12), const Args12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>& A)
    00366   {
    00367       T* mySelf = (T*)this;
    00368       if((mySelf->*method)(*A.a1, *A.a2, *A.a3, *A.a4, *A.a5, *A.a6, *A.a7, *A.a8, *A.a9, *A.a10, *A.a11, *A.a12))
    00369       {
    00370         (*A.a1)->MarkSuccessful();
    00371       }
    00372       (*A.a1)->MarkFinished();
    00373   }
    00374
    00375   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13>
    00376   void RunMethod (bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13), const Args13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>& A)
    00377   {
    00378       T* mySelf = (T*)this;
    00379       if((mySelf->*method)(*A.a1, *A.a2, *A.a3, *A.a4, *A.a5, *A.a6, *A.a7, *A.a8, *A.a9, *A.a10, *A.a11, *A.a12, *A.a13))
    00380       {
    00381         (*A.a1)->MarkSuccessful();
    00382       }
    00383       (*A.a1)->MarkFinished();
    00384   }
    00385
    00386   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13, typename A14>
    00387   void RunMethod (bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14), const Args14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>& A)
    00388   {
    00389       T* mySelf = (T*)this;
    00390       if((mySelf->*method)(*A.a1, *A.a2, *A.a3, *A.a4, *A.a5, *A.a6, *A.a7, *A.a8, *A.a9, *A.a10, *A.a11, *A.a12, *A.a13, *A.a14))
    00391       {
    00392         (*A.a1)->MarkSuccessful();
    00393       }
    00394       (*A.a1)->MarkFinished();
    00395   }
    00396
    00397   template<typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13, typename A14, typename A15>
    00398   void RunMethod (bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15), const Args15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>& A)
    00399   {
    00400       T* mySelf = (T*)this;
    00401       if((mySelf->*method)(*A.a1, *A.a2, *A.a3, *A.a4, *A.a5, *A.a6, *A.a7, *A.a8, *A.a9, *A.a10, *A.a11, *A.a12, *A.a13, *A.a14, *A.a15))
    00402       {
    00403         (*A.a1)->MarkSuccessful();
    00404       }
    00405       (*A.a1)->MarkFinished();
    00406   }
    00407 };
    00408
    00409 template<class T, typename A1>
    00410 class ThreadEvent1 : public scfImplementation1<ThreadEvent1<T, A1>, iJob>
    00411 {
    00412 public:
    00413   ThreadEvent1(ThreadedCallable<T>* &object, bool (T::*method)(A1), void const** &args)
    00414     : scfImplementation1<ThreadEvent1<T, A1>, iJob> (this), object(object), method(method), args(args)
    00415   {
    00416   }
    00417   ~ThreadEvent1()
    00418   {
    00419     if (args)
    00420     {
    00421       typename ThreadedCallable<T>::template Args1<A1> A;
    00422       ThreadedCallable<T>::FetchArgs1 (args, A);
    00423       ThreadedCallable<T>::FreeArgs1 (args, A);
    00424     }
    00425   }
    00426
    00427   void Run()
    00428   {
    00429     typename ThreadedCallable<T>::template Args1<A1> A;
    00430     ThreadedCallable<T>::FetchArgs1 (args, A);
    00431     object->RunMethod (method, A);
    00432     ThreadedCallable<T>::FreeArgs1 (args, A);
    00433     args = nullptr;
    00434   }
    00435
    00436 private:
    00437   ThreadedCallable<T>* object;
    00438   bool (T::*method)(A1);
    00439   void const** args;
    00440 };
    00441
    00442 template<class T, typename A1, typename A2>
    00443 class ThreadEvent2 : public scfImplementation1<ThreadEvent2<T, A1, A2>, iJob>
    00444 {
    00445 public:
    00446   ThreadEvent2(ThreadedCallable<T>* &object, bool (T::*method)(A1, A2), void const** &args)
    00447     : scfImplementation1<ThreadEvent2<T, A1, A2>, iJob> (this),
    00448       object(object), method(method), args(args)
    00449   {
    00450   }
    00451   ~ThreadEvent2()
    00452   {
    00453     if (args)
    00454     {
    00455       typename ThreadedCallable<T>::template Args2<A1, A2> A;
    00456       ThreadedCallable<T>::FetchArgs2 (args, A);
    00457       ThreadedCallable<T>::FreeArgs2 (args, A);
    00458     }
    00459   }
    00460
    00461   void Run()
    00462   {
    00463     typename ThreadedCallable<T>::template Args2<A1, A2> A;
    00464     ThreadedCallable<T>::FetchArgs2 (args, A);
    00465     object->RunMethod (method, A);
    00466     ThreadedCallable<T>::FreeArgs2 (args, A);
    00467     args = nullptr;
    00468   }
    00469
    00470 private:
    00471   ThreadedCallable<T>* object;
    00472   bool (T::*method)(A1, A2);
    00473   void const** args;
    00474 };
    00475
    00476 template<class T, typename A1, typename A2, typename A3>
    00477 class ThreadEvent3 : public scfImplementation1<ThreadEvent3<T, A1, A2, A3>, iJob>
    00478 {
    00479 public:
    00480   ThreadEvent3(ThreadedCallable<T>* &object, bool (T::*method)(A1, A2, A3), void const** &args)
    00481     : scfImplementation1<ThreadEvent3<T, A1, A2, A3>, iJob> (this),
    00482       object(object), method(method), args(args)
    00483   {
    00484   }
    00485   ~ThreadEvent3()
    00486   {
    00487     if (args)
    00488     {
    00489       typename ThreadedCallable<T>::template Args3<A1, A2, A3> A;
    00490       ThreadedCallable<T>::FetchArgs3 (args, A);
    00491       ThreadedCallable<T>::FreeArgs3 (args, A);
    00492     }
    00493   }
    00494
    00495   void Run()
    00496   {
    00497     typename ThreadedCallable<T>::template Args3<A1, A2, A3> A;
    00498     ThreadedCallable<T>::FetchArgs3 (args, A);
    00499     object->RunMethod (method, A);
    00500     ThreadedCallable<T>::FreeArgs3 (args, A);
    00501     args = nullptr;
    00502   }
    00503
    00504 private:
    00505   ThreadedCallable<T>* object;
    00506   bool (T::*method)(A1, A2, A3);
    00507   void const** args;
    00508 };
    00509
    00510 template<class T, typename A1, typename A2, typename A3, typename A4>
    00511 class ThreadEvent4 : public scfImplementation1<ThreadEvent4<T, A1, A2, A3, A4>, iJob>
    00512 {
    00513 public:
    00514   ThreadEvent4(ThreadedCallable<T>* &object, bool (T::*method)(A1, A2, A3, A4), void const** &args)
    00515     : scfImplementation1<ThreadEvent4<T, A1, A2, A3, A4>, iJob> (this),
    00516       object(object), method(method), args(args)
    00517   {
    00518   }
    00519   ~ThreadEvent4()
    00520   {
    00521     if (args)
    00522     {
    00523       typename ThreadedCallable<T>::template Args4<A1, A2, A3, A4> A;
    00524       ThreadedCallable<T>::FetchArgs4 (args, A);
    00525       ThreadedCallable<T>::FreeArgs4 (args, A);
    00526     }
    00527   }
    00528
    00529   void Run()
    00530   {
    00531     typename ThreadedCallable<T>::template Args4<A1, A2, A3, A4> A;
    00532     ThreadedCallable<T>::FetchArgs4 (args, A);
    00533     object->RunMethod (method, A);
    00534     ThreadedCallable<T>::FreeArgs4 (args, A);
    00535     args = nullptr;
    00536   }
    00537
    00538 private:
    00539   ThreadedCallable<T>* object;
    00540   bool (T::*method)(A1, A2, A3, A4);
    00541   void const** args;
    00542 };
    00543
    00544 template<class T, typename A1, typename A2, typename A3, typename A4, typename A5>
    00545 class ThreadEvent5 : public scfImplementation1<ThreadEvent5<T, A1, A2, A3, A4, A5>, iJob>
    00546 {
    00547 public:
    00548   ThreadEvent5(ThreadedCallable<T>* &object, bool (T::*method)(A1, A2, A3, A4, A5), void const** &args)
    00549     : scfImplementation1<ThreadEvent5<T, A1, A2, A3, A4, A5>, iJob> (this),
    00550       object(object), method(method), args(args)
    00551   {
    00552   }
    00553   ~ThreadEvent5()
    00554   {
    00555     if (args)
    00556     {
    00557       typename ThreadedCallable<T>::template Args5<A1, A2, A3, A4, A5> A;
    00558       ThreadedCallable<T>::FetchArgs5 (args, A);
    00559       ThreadedCallable<T>::FreeArgs5 (args, A);
    00560     }
    00561   }
    00562
    00563   void Run()
    00564   {
    00565     typename ThreadedCallable<T>::template Args5<A1, A2, A3, A4, A5> A;
    00566     ThreadedCallable<T>::FetchArgs5 (args, A);
    00567     object->RunMethod (method, A);
    00568     ThreadedCallable<T>::FreeArgs5 (args, A);
    00569     args = nullptr;
    00570   }
    00571
    00572 private:
    00573   ThreadedCallable<T>* object;
    00574   bool (T::*method)(A1, A2, A3, A4, A5);
    00575   void const** args;
    00576 };
    00577
    00578 template<class T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
    00579 class ThreadEvent6 : public scfImplementation1<ThreadEvent6<T, A1, A2, A3, A4, A5, A6>, iJob>
    00580 {
    00581 public:
    00582   ThreadEvent6(ThreadedCallable<T>* &object, bool (T::*method)(A1, A2, A3, A4, A5, A6), void const** &args)
    00583     : scfImplementation1<ThreadEvent6<T, A1, A2, A3, A4, A5, A6>, iJob> (this),
    00584       object(object), method(method), args(args)
    00585   {
    00586   }
    00587   ~ThreadEvent6()
    00588   {
    00589     if (args)
    00590     {
    00591       typename ThreadedCallable<T>::template Args6<A1, A2, A3, A4, A5, A6> A;
    00592       ThreadedCallable<T>::FetchArgs6 (args, A);
    00593       ThreadedCallable<T>::FreeArgs6 (args, A);
    00594     }
    00595   }
    00596
    00597   void Run()
    00598   {
    00599     typename ThreadedCallable<T>::template Args6<A1, A2, A3, A4, A5, A6> A;
    00600     ThreadedCallable<T>::FetchArgs6 (args, A);
    00601     object->RunMethod (method, A);
    00602     ThreadedCallable<T>::FreeArgs6 (args, A);
    00603     args = nullptr;
    00604   }
    00605
    00606 private:
    00607   ThreadedCallable<T>* object;
    00608   bool (T::*method)(A1, A2, A3, A4, A5, A6);
    00609   void const** args;
    00610 };
    00611
    00612 template<class T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
    00613 class ThreadEvent7 : public scfImplementation1<ThreadEvent7<T, A1, A2, A3, A4, A5, A6, A7>, iJob>
    00614 {
    00615 public:
    00616   ThreadEvent7(ThreadedCallable<T>* &object, bool (T::*method)(A1, A2, A3, A4, A5, A6, A7), void const** &args)
    00617     : scfImplementation1<ThreadEvent7<T, A1, A2, A3, A4, A5, A6, A7>, iJob> (this),
    00618       object(object), method(method), args(args)
    00619   {
    00620   }
    00621   ~ThreadEvent7()
    00622   {
    00623     if (args)
    00624     {
    00625       typename ThreadedCallable<T>::template Args7<A1, A2, A3, A4, A5, A6, A7> A;
    00626       ThreadedCallable<T>::FetchArgs7 (args, A);
    00627       ThreadedCallable<T>::FreeArgs7 (args, A);
    00628     }
    00629   }
    00630
    00631   void Run()
    00632   {
    00633     typename ThreadedCallable<T>::template Args7<A1, A2, A3, A4, A5, A6, A7> A;
    00634     ThreadedCallable<T>::FetchArgs7 (args, A);
    00635     object->RunMethod (method, A);
    00636     ThreadedCallable<T>::FreeArgs7 (args, A);
    00637     args = nullptr;
    00638   }
    00639
    00640 private:
    00641   ThreadedCallable<T>* object;
    00642   bool (T::*method)(A1, A2, A3, A4, A5, A6, A7);
    00643   void const** args;
    00644 };
    00645
    00646 template<class T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
    00647 class ThreadEvent8 : public scfImplementation1<ThreadEvent8<T, A1, A2, A3, A4, A5, A6, A7, A8>, iJob>
    00648 {
    00649 public:
    00650   ThreadEvent8(ThreadedCallable<T>* &object, bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8), void const** &args)
    00651     : scfImplementation1<ThreadEvent8<T, A1, A2, A3, A4, A5, A6, A7, A8>, iJob> (this),
    00652       object(object), method(method), args(args)
    00653   {
    00654   }
    00655   ~ThreadEvent8()
    00656   {
    00657     if (args)
    00658     {
    00659       typename ThreadedCallable<T>::template Args8<A1, A2, A3, A4, A5, A6, A7, A8> A;
    00660       ThreadedCallable<T>::FetchArgs8 (args, A);
    00661       ThreadedCallable<T>::FreeArgs8 (args, A);
    00662     }
    00663   }
    00664
    00665   void Run()
    00666   {
    00667     typename ThreadedCallable<T>::template Args8<A1, A2, A3, A4, A5, A6, A7, A8> A;
    00668     ThreadedCallable<T>::FetchArgs8 (args, A);
    00669     object->RunMethod (method, A);
    00670     ThreadedCallable<T>::FreeArgs8 (args, A);
    00671     args = nullptr;
    00672   }
    00673
    00674 private:
    00675   ThreadedCallable<T>* object;
    00676   bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8);
    00677   void const** args;
    00678 };
    00679
    00680 template<class T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9>
    00681 class ThreadEvent9 : public scfImplementation1<ThreadEvent9<T, A1, A2, A3, A4, A5, A6, A7, A8, A9>, iJob>
    00682 {
    00683 public:
    00684   ThreadEvent9(ThreadedCallable<T>* &object, bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9), void const** &args)
    00685     : scfImplementation1<ThreadEvent9<T, A1, A2, A3, A4, A5, A6, A7, A8, A9>, iJob>(this),
    00686       object(object), method(method), args(args)
    00687   {
    00688   }
    00689   ~ThreadEvent9()
    00690   {
    00691     if (args)
    00692     {
    00693       typename ThreadedCallable<T>::template Args9<A1, A2, A3, A4, A5, A6, A7, A8, A9> A;
    00694       ThreadedCallable<T>::FetchArgs9 (args, A);
    00695       ThreadedCallable<T>::FreeArgs9 (args, A);
    00696     }
    00697   }
    00698
    00699   void Run()
    00700   {
    00701     typename ThreadedCallable<T>::template Args9<A1, A2, A3, A4, A5, A6, A7, A8, A9> A;
    00702     ThreadedCallable<T>::FetchArgs9 (args, A);
    00703     object->RunMethod (method, A);
    00704     ThreadedCallable<T>::FreeArgs9 (args, A);
    00705     args = nullptr;
    00706   }
    00707
    00708 private:
    00709   ThreadedCallable<T>* object;
    00710   bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9);
    00711   void const** args;
    00712 };
    00713
    00714 template<class T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10>
    00715 class ThreadEvent10 : public scfImplementation1<ThreadEvent10<T, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>, iJob>
    00716 {
    00717 public:
    00718   ThreadEvent10(ThreadedCallable<T>* &object, bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10), void const** &args)
    00719     : scfImplementation1<ThreadEvent10<T, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>, iJob>(this),
    00720       object(object), method(method), args(args)
    00721   {
    00722   }
    00723   ~ThreadEvent10()
    00724   {
    00725     if (args)
    00726     {
    00727       typename ThreadedCallable<T>::template Args10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> A;
    00728       ThreadedCallable<T>::FetchArgs10 (args, A);
    00729       ThreadedCallable<T>::FreeArgs10 (args, A);
    00730     }
    00731   }
    00732
    00733   void Run()
    00734   {
    00735     typename ThreadedCallable<T>::template Args10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> A;
    00736     ThreadedCallable<T>::FetchArgs10 (args, A);
    00737     object->RunMethod (method, A);
    00738     ThreadedCallable<T>::FreeArgs10 (args, A);
    00739     args = nullptr;
    00740   }
    00741
    00742 private:
    00743   ThreadedCallable<T>* object;
    00744   bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
    00745   void const** args;
    00746 };
    00747
    00748 template<class T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11>
    00749 class ThreadEvent11 : public scfImplementation1<ThreadEvent11<T, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>, iJob>
    00750 {
    00751 public:
    00752   ThreadEvent11(ThreadedCallable<T>* &object, bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11), void const** &args)
    00753     : scfImplementation1<ThreadEvent11<T, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>, iJob> (this),
    00754       object(object), method(method), args(args)
    00755   {
    00756   }
    00757   ~ThreadEvent11()
    00758   {
    00759     if (args)
    00760     {
    00761       typename ThreadedCallable<T>::template Args11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> A;
    00762       ThreadedCallable<T>::FetchArgs11 (args, A);
    00763       ThreadedCallable<T>::FreeArgs11 (args, A);
    00764     }
    00765   }
    00766
    00767   void Run()
    00768   {
    00769     typename ThreadedCallable<T>::template Args11<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> A;
    00770     ThreadedCallable<T>::FetchArgs11 (args, A);
    00771     object->RunMethod (method, A);
    00772     ThreadedCallable<T>::FreeArgs11 (args, A);
    00773     args = nullptr;
    00774   }
    00775
    00776 private:
    00777   ThreadedCallable<T>* object;
    00778   bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11);
    00779   void const** args;
    00780 };
    00781
    00782 template<class T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12>
    00783 class ThreadEvent12 : public scfImplementation1<ThreadEvent12<T, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>, iJob>
    00784 {
    00785 public:
    00786   ThreadEvent12(ThreadedCallable<T>* &object, bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12), void const** &args)
    00787     : scfImplementation1<ThreadEvent12<T, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12>, iJob> (this),
    00788       object(object), method(method), args(args)
    00789   {
    00790   }
    00791   ~ThreadEvent12()
    00792   {
    00793     if (args)
    00794     {
    00795       typename ThreadedCallable<T>::template Args12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12> A;
    00796       ThreadedCallable<T>::FetchArgs12 (args, A);
    00797       ThreadedCallable<T>::FreeArgs12 (args, A);
    00798     }
    00799   }
    00800
    00801   void Run()
    00802   {
    00803     typename ThreadedCallable<T>::template Args12<A1, A2, A3, A4, A5, A6, A7, A8, A9, A11, A12> A;
    00804     ThreadedCallable<T>::FetchArgs12 (args, A);
    00805     object->RunMethod (method, A);
    00806     ThreadedCallable<T>::FreeArgs12 (args, A);
    00807     args = nullptr;
    00808   }
    00809
    00810 private:
    00811   ThreadedCallable<T>* object;
    00812   bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12);
    00813   void const** args;
    00814 };
    00815
    00816 template<class T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13>
    00817 class ThreadEvent13 : public scfImplementation1<ThreadEvent13<T, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>, iJob>
    00818 {
    00819 public:
    00820   ThreadEvent13(ThreadedCallable<T>* &object, bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13), void const** &args)
    00821     : scfImplementation1<ThreadEvent13<T, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13>, iJob> (this),
    00822       object(object), method(method), args(args)
    00823   {
    00824   }
    00825   ~ThreadEvent13()
    00826   {
    00827     if (args)
    00828     {
    00829       typename ThreadedCallable<T>::template Args13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> A;
    00830       ThreadedCallable<T>::FetchArgs13 (args, A);
    00831       ThreadedCallable<T>::FreeArgs13 (args, A);
    00832     }
    00833   }
    00834
    00835   void Run()
    00836   {
    00837     typename ThreadedCallable<T>::template Args13<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> A;
    00838     ThreadedCallable<T>::FetchArgs13 (args, A);
    00839     object->RunMethod (method, A);
    00840     ThreadedCallable<T>::FreeArgs13 (args, A);
    00841     args = nullptr;
    00842   }
    00843
    00844 private:
    00845   ThreadedCallable<T>* object;
    00846   bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13);
    00847   void const** args;
    00848 };
    00849
    00850 template<class T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13, typename A14>
    00851 class ThreadEvent14 : public scfImplementation1<ThreadEvent14<T, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>, iJob>
    00852 {
    00853 public:
    00854   ThreadEvent14(ThreadedCallable<T>* &object, bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14), void const** &args)
    00855     : scfImplementation1<ThreadEvent14<T, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14>, iJob> (this),
    00856       object(object), method(method), args(args)
    00857   {
    00858   }
    00859   ~ThreadEvent14()
    00860   {
    00861     if (args)
    00862     {
    00863       typename ThreadedCallable<T>::template Args14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14> A;
    00864       ThreadedCallable<T>::FetchArgs14 (args, A);
    00865       ThreadedCallable<T>::FreeArgs14 (args, A);
    00866     }
    00867   }
    00868
    00869   void Run()
    00870   {
    00871     typename ThreadedCallable<T>::template Args14<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14> A;
    00872     ThreadedCallable<T>::FetchArgs14 (args, A);
    00873     object->RunMethod (method, A);
    00874     ThreadedCallable<T>::FreeArgs14 (args, A);
    00875     args = nullptr;
    00876   }
    00877
    00878 private:
    00879   ThreadedCallable<T>* object;
    00880   bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14);
    00881   void const** args;
    00882 };
    00883
    00884 template<class T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13, typename A14, typename A15>
    00885 class ThreadEvent15 : public scfImplementation1<ThreadEvent15<T, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>, iJob>
    00886 {
    00887 public:
    00888   ThreadEvent15(ThreadedCallable<T>* &object, bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15), void const** &args)
    00889     : scfImplementation1<ThreadEvent15<T, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15>, iJob> (this),
    00890       object(object), method(method), args(args)
    00891   {
    00892   }
    00893   ~ThreadEvent15()
    00894   {
    00895     if (args)
    00896     {
    00897       typename ThreadedCallable<T>::template Args15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15> A;
    00898       ThreadedCallable<T>::FetchArgs15 (args, A);
    00899       ThreadedCallable<T>::FreeArgs15 (args, A);
    00900     }
    00901   }
    00902
    00903   void Run()
    00904   {
    00905     typename ThreadedCallable<T>::template Args15<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15> A;
    00906     ThreadedCallable<T>::FetchArgs15 (args, A);
    00907     object->RunMethod (method, A);
    00908     ThreadedCallable<T>::FreeArgs15 (args, A);
    00909     args = nullptr;
    00910   }
    00911
    00912 private:
    00913   ThreadedCallable<T>* object;
    00914   bool (T::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15);
    00915   void const** args;
    00916 };
    00917
    00918 #include "custom_new_disable.h"
    00919
    00920 class TEventMemPool : public csMemoryPool
    00921 {
    00922 public:
    00923
    00924   template<typename T>
    00925   void const* Store(T* p)
    00926   {
    00927     T* newp = (T*)csMemoryPool::Alloc (sizeof(T));
    00928     new (newp) T (*p);
    00929     return (void const*)newp;
    00930   }
    00931 };
    00932
    00933 template<>
    00934 inline void const* TEventMemPool::Store<const char*>(const char** p)
    00935 {
    00936   if(!p)
    00937   {
    00938     return 0;
    00939   }
    00940
    00941   char* ptr = 0;
    00942   if(*p)
    00943   {
    00944     size_t length = strlen(*p) + 1;
    00945     ptr = (char*)Alloc(length);
    00946     memcpy(ptr, *p, length);
    00947   }
    00948
    00949   char** ptrPtr = new (this) char*;
    00950   *ptrPtr = ptr;
    00951   return (void const*)ptrPtr;
    00952 }
    00953
    00954 #include "custom_new_enable.h"
    00955
    00956 #endif // __CS_CSUTIL_THREADEVENT_H__