From 4ef89822428cf5d6bbd2bb8d55e7f8f3fae0166f Mon Sep 17 00:00:00 2001 From: wolf Date: Mon, 27 May 2002 11:57:50 +0000 Subject: [PATCH] Encapsulating member functions with 8 and 9 args. git-svn-id: https://svn.dealii.org/trunk@5878 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/thread_management.h | 1016 +++++++++++++++-- 1 file changed, 905 insertions(+), 111 deletions(-) diff --git a/deal.II/base/include/base/thread_management.h b/deal.II/base/include/base/thread_management.h index b50cd44ec9..7f241114ce 100644 --- a/deal.II/base/include/base/thread_management.h +++ b/deal.II/base/include/base/thread_management.h @@ -610,6 +610,67 @@ namespace Threads }; #endif + + /** + * Given a class, argument types, + * and the return type, generate a + * local typedef denoting a pointer + * to such a member function. + */ + template + struct MemFunPtr8 + { + typedef RetType (Class::*type) (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8); + }; + +#ifdef DEAL_II_CONST_MEM_FUN_PTR_BUG + /** + * Same as above, but for the case + * of a member function marked + * @p{const}. This should not + * really be necessary, but Intel's + * compiler has a bug here so we + * have to work around. + */ + template + struct MemFunPtr9 + { + typedef RetType (Class::*type) (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const; + }; +#endif + + + + /** + * Given a class, argument types, + * and the return type, generate a + * local typedef denoting a pointer + * to such a member function. + */ + template + struct MemFunPtr9 + { + typedef RetType (Class::*type) (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9); + }; + +#ifdef DEAL_II_CONST_MEM_FUN_PTR_BUG + /** + * Same as above, but for the case + * of a member function marked + * @p{const}. This should not + * really be necessary, but Intel's + * compiler has a bug here so we + * have to work around. + */ + template + struct MemFunPtr9 + { + typedef RetType (Class::*type) (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9) const; + }; +#endif + + + /** * Class used to store a pointer temporarily and delete the object * pointed to upon destruction of this object. For more information on @@ -3336,91 +3397,440 @@ namespace Threads }; - /** - * Encapsulate a function pointer - * into an object with which a new - * thread can later be spawned. - * For more information on use and - * internals of this class see the - * report on multithreading. - * - * This function exists once for - * each number of parameters. - */ - inline - FunData0::ArgCollector - encapsulate (void (*fun_ptr)()); +/** + * Class to store the parameters of a function with 8 arguments. For + * more information on use and internals of this class see the report + * on this subject. + * + * @author Wolfgang Bangerth, Ralf Hartmann, 2001 + */ + template + class MemFunData8 : public FunDataBase + { + public: + /** + * Typedef a pointer to a member + * function which we will call + * from this class. + */ + typedef typename MemFunPtr8::type FunPtr; - /** - * Encapsulate a function pointer - * into an object with which a new - * thread can later be spawned. - * For more information on use and - * internals of this class see the - * report on multithreading. - * - * This function exists once for - * each number of parameters. - */ - template - inline - typename FunData1::ArgCollector - encapsulate (void (*fun_ptr)(Arg1)); + /** + * Constructor. Store pointer to + * the function and the values of + * the arguments. + */ + MemFunData8 (FunPtr fun_ptr, + Class *object, + Arg1 arg1, + Arg2 arg2, + Arg3 arg3, + Arg4 arg4, + Arg5 arg5, + Arg6 arg6, + Arg7 arg7, + Arg8 arg8); + /** + * Copy constructor. + */ + MemFunData8 (const MemFunData8 &fun_data8); - /** - * Encapsulate a function pointer - * into an object with which a new - * thread can later be spawned. - * For more information on use and - * internals of this class see the - * report on multithreading. - * - * This function exists once for - * each number of parameters. - */ - template - inline - typename FunData2::ArgCollector - encapsulate (void (*fun_ptr)(Arg1, Arg2)); - + /** + * Virtual constructor. + */ + virtual FunDataBase * clone () const; - /** - * Encapsulate a function pointer - * into an object with which a new - * thread can later be spawned. - * For more information on use and - * internals of this class see the - * report on multithreading. - * - * This function exists once for - * each number of parameters. - */ - template - inline - typename FunData3::ArgCollector - encapsulate (void (*fun_ptr)(Arg1, Arg2, Arg3)); - + private: - /** - * Encapsulate a function pointer - * into an object with which a new - * thread can later be spawned. - * For more information on use and - * internals of this class see the - * report on multithreading. - * - * This function exists once for - * each number of parameters. - */ - template - inline - typename FunData4::ArgCollector - encapsulate (void (*fun_ptr)(Arg1, Arg2, Arg3, Arg4)); + /** + * Pointer to the function to be + * called and values of the + * arguments to be passed. + */ + FunPtr fun_ptr; + /** + * Pointer to the object which + * we shall work on. + */ + Class *object; + + /** + * Values of the arguments of the + * function to be called. + */ + Arg1 arg1; + Arg2 arg2; + Arg3 arg3; + Arg4 arg4; + Arg5 arg5; + Arg6 arg6; + Arg7 arg7; + Arg8 arg8; + + /** + * Static function used as entry + * point for the new thread. + */ + static void * thread_entry_point (void *arg); + /** + * Helper class, used to collect + * the values of the parameters + * which we will pass to the + * function, once we know its + * type. + */ + class ArgCollector + { + public: + /** + * Typedef the function + * pointer type of the + * underlying class to a + * local type. + */ + typedef typename MemFunData8::FunPtr FunPtr; + + /** + * Constructor. Take and store a + * pointer to the function which + * is to be called. + */ + ArgCollector (FunPtr fun_ptr); + + /** + * Take the arguments with + * which we want to call the + * function and produce and + * object of the desired type + * from that. + */ + FunEncapsulation collect_args (Class *object, + Arg1 arg1, + Arg2 arg2, + Arg3 arg3, + Arg4 arg4, + Arg5 arg5, + Arg6 arg6, + Arg7 arg7, + Arg8 arg8); + + /** + * Same as above, but take + * a reference instead of a + * pointer. This allows us + * to be a little + * convenient, as we can + * use @p{object} or + * @p{this}, without taking + * care that one is a + * reference and the other + * a pointer. + */ + FunEncapsulation collect_args (Class &object, + Arg1 arg1, + Arg2 arg2, + Arg3 arg3, + Arg4 arg4, + Arg5 arg5, + Arg6 arg6, + Arg7 arg7, + Arg8 arg8); + private: + /** + * Space to temporarily store + * the function pointer. + */ + FunPtr fun_ptr; + }; - /** + /** + * Declare a function that uses + * the @ref{ArgCollector} as + * friend. + */ + template + friend + typename MemFunData8::ArgCollector + encapsulate (void (Class_::*fun_ptr)(Arg1_, Arg2_, Arg3_, + Arg4_, Arg5_, Arg6_, + Arg7_, Arg8_)); + +#ifdef DEAL_II_TEMPL_CONST_MEM_PTR_BUG + template + friend + typename MemFunData8::ArgCollector + encapsulate (void (Class_::*fun_ptr)(Arg1_, Arg2_, Arg3_, + Arg4_, Arg5_, Arg6_, + Arg7_, Arg8_) const); +#endif + }; + + +/** + * Class to store the parameters of a function with 9 arguments. For + * more information on use and internals of this class see the report + * on this subject. + * + * @author Wolfgang Bangerth, Ralf Hartmann, 2001 + */ + template + class MemFunData9 : public FunDataBase + { + public: + /** + * Typedef a pointer to a member + * function which we will call + * from this class. + */ + typedef typename MemFunPtr9::type FunPtr; + + /** + * Constructor. Store pointer to + * the function and the values of + * the arguments. + */ + MemFunData9 (FunPtr fun_ptr, + Class *object, + Arg1 arg1, + Arg2 arg2, + Arg3 arg3, + Arg4 arg4, + Arg5 arg5, + Arg6 arg6, + Arg7 arg7, + Arg8 arg8, + Arg9 arg9); + + /** + * Copy constructor. + */ + MemFunData9 (const MemFunData9 &fun_data9); + + /** + * Virtual constructor. + */ + virtual FunDataBase * clone () const; + + private: + + /** + * Pointer to the function to be + * called and values of the + * arguments to be passed. + */ + FunPtr fun_ptr; + + /** + * Pointer to the object which + * we shall work on. + */ + Class *object; + + /** + * Values of the arguments of the + * function to be called. + */ + Arg1 arg1; + Arg2 arg2; + Arg3 arg3; + Arg4 arg4; + Arg5 arg5; + Arg6 arg6; + Arg7 arg7; + Arg8 arg8; + Arg9 arg9; + + /** + * Static function used as entry + * point for the new thread. + */ + static void * thread_entry_point (void *arg); + + /** + * Helper class, used to collect + * the values of the parameters + * which we will pass to the + * function, once we know its + * type. + */ + class ArgCollector + { + public: + /** + * Typedef the function + * pointer type of the + * underlying class to a + * local type. + */ + typedef typename MemFunData9::FunPtr FunPtr; + + /** + * Constructor. Take and store a + * pointer to the function which + * is to be called. + */ + ArgCollector (FunPtr fun_ptr); + + /** + * Take the arguments with + * which we want to call the + * function and produce and + * object of the desired type + * from that. + */ + FunEncapsulation collect_args (Class *object, + Arg1 arg1, + Arg2 arg2, + Arg3 arg3, + Arg4 arg4, + Arg5 arg5, + Arg6 arg6, + Arg7 arg7, + Arg8 arg8, + Arg9 arg9); + + /** + * Same as above, but take + * a reference instead of a + * pointer. This allows us + * to be a little + * convenient, as we can + * use @p{object} or + * @p{this}, without taking + * care that one is a + * reference and the other + * a pointer. + */ + FunEncapsulation collect_args (Class &object, + Arg1 arg1, + Arg2 arg2, + Arg3 arg3, + Arg4 arg4, + Arg5 arg5, + Arg6 arg6, + Arg7 arg7, + Arg8 arg8, + Arg9 arg9); + private: + /** + * Space to temporarily store + * the function pointer. + */ + FunPtr fun_ptr; + }; + + /** + * Declare a function that uses + * the @ref{ArgCollector} as + * friend. + */ + template + friend + typename MemFunData9::ArgCollector + encapsulate (void (Class_::*fun_ptr)(Arg1_, Arg2_, Arg3_, + Arg4_, Arg5_, Arg6_, + Arg7_, Arg8_, Arg9_)); + +#ifdef DEAL_II_TEMPL_CONST_MEM_PTR_BUG + template + friend + typename MemFunData9::ArgCollector + encapsulate (void (Class_::*fun_ptr)(Arg1_, Arg2_, Arg3_, + Arg4_, Arg5_, Arg6_, + Arg7_, Arg8_, Arg9_) const); +#endif + }; + + + + /** + * Encapsulate a function pointer + * into an object with which a new + * thread can later be spawned. + * For more information on use and + * internals of this class see the + * report on multithreading. + * + * This function exists once for + * each number of parameters. + */ + inline + FunData0::ArgCollector + encapsulate (void (*fun_ptr)()); + + /** + * Encapsulate a function pointer + * into an object with which a new + * thread can later be spawned. + * For more information on use and + * internals of this class see the + * report on multithreading. + * + * This function exists once for + * each number of parameters. + */ + template + inline + typename FunData1::ArgCollector + encapsulate (void (*fun_ptr)(Arg1)); + + + /** + * Encapsulate a function pointer + * into an object with which a new + * thread can later be spawned. + * For more information on use and + * internals of this class see the + * report on multithreading. + * + * This function exists once for + * each number of parameters. + */ + template + inline + typename FunData2::ArgCollector + encapsulate (void (*fun_ptr)(Arg1, Arg2)); + + + /** + * Encapsulate a function pointer + * into an object with which a new + * thread can later be spawned. + * For more information on use and + * internals of this class see the + * report on multithreading. + * + * This function exists once for + * each number of parameters. + */ + template + inline + typename FunData3::ArgCollector + encapsulate (void (*fun_ptr)(Arg1, Arg2, Arg3)); + + + /** + * Encapsulate a function pointer + * into an object with which a new + * thread can later be spawned. + * For more information on use and + * internals of this class see the + * report on multithreading. + * + * This function exists once for + * each number of parameters. + */ + template + inline + typename FunData4::ArgCollector + encapsulate (void (*fun_ptr)(Arg1, Arg2, Arg3, Arg4)); + + + + /** * Encapsulate a function pointer * into an object with which a new * thread can later be spawned. @@ -3641,10 +4051,82 @@ namespace Threads * This function exists once for * each number of parameters. */ - template + template + inline + typename MemFunData3::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3)); + +#ifdef DEAL_II_TEMPL_CONST_MEM_PTR_BUG + /** + * Same as the previous function, + * but for member functions marked + * @p{const}. This function should + * not be necessary, since the + * compiler should deduce a + * constant class as template + * argument, but we have to work + * around a bug in Intel's icc + * compiler with this. + */ + template + inline + typename MemFunData3::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3) const); +#endif + + + /** + * Encapsulate a member function + * pointer into an object with + * which a new thread can later be + * spawned. For more information + * on use and internals of this + * class see the report on this + * subject. + * + * This function exists once for + * each number of parameters. + */ + template + inline + typename MemFunData4::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4)); + +#ifdef DEAL_II_TEMPL_CONST_MEM_PTR_BUG + /** + * Same as the previous function, + * but for member functions marked + * @p{const}. This function should + * not be necessary, since the + * compiler should deduce a + * constant class as template + * argument, but we have to work + * around a bug in Intel's icc + * compiler with this. + */ + template + inline + typename MemFunData4::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4) const); +#endif + + + /** + * Encapsulate a member function + * pointer into an object with + * which a new thread can later be + * spawned. For more information + * on use and internals of this + * class see the report on this + * subject. + * + * This function exists once for + * each number of parameters. + */ + template inline - typename MemFunData3::ArgCollector - encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3)); + typename MemFunData5::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5)); #ifdef DEAL_II_TEMPL_CONST_MEM_PTR_BUG /** @@ -3658,12 +4140,12 @@ namespace Threads * around a bug in Intel's icc * compiler with this. */ - template + template inline - typename MemFunData3::ArgCollector - encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3) const); + typename MemFunData5::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5) const); #endif - + /** * Encapsulate a member function @@ -3677,10 +4159,10 @@ namespace Threads * This function exists once for * each number of parameters. */ - template + template inline - typename MemFunData4::ArgCollector - encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4)); + typename MemFunData6::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)); #ifdef DEAL_II_TEMPL_CONST_MEM_PTR_BUG /** @@ -3694,13 +4176,12 @@ namespace Threads * around a bug in Intel's icc * compiler with this. */ - template + template inline - typename MemFunData4::ArgCollector - encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4) const); + typename MemFunData6::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const); #endif - - + /** * Encapsulate a member function * pointer into an object with @@ -3713,10 +4194,10 @@ namespace Threads * This function exists once for * each number of parameters. */ - template + template inline - typename MemFunData5::ArgCollector - encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5)); + typename MemFunData7::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)); #ifdef DEAL_II_TEMPL_CONST_MEM_PTR_BUG /** @@ -3730,13 +4211,12 @@ namespace Threads * around a bug in Intel's icc * compiler with this. */ - template + template inline - typename MemFunData5::ArgCollector - encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5) const); + typename MemFunData7::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const); #endif - /** * Encapsulate a member function * pointer into an object with @@ -3749,10 +4229,10 @@ namespace Threads * This function exists once for * each number of parameters. */ - template + template inline - typename MemFunData6::ArgCollector - encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)); + typename MemFunData8::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)); #ifdef DEAL_II_TEMPL_CONST_MEM_PTR_BUG /** @@ -3766,10 +4246,10 @@ namespace Threads * around a bug in Intel's icc * compiler with this. */ - template + template inline - typename MemFunData6::ArgCollector - encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const); + typename MemFunData8::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const); #endif /** @@ -3784,10 +4264,10 @@ namespace Threads * This function exists once for * each number of parameters. */ - template + template inline - typename MemFunData7::ArgCollector - encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)); + typename MemFunData9::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)); #ifdef DEAL_II_TEMPL_CONST_MEM_PTR_BUG /** @@ -3801,10 +4281,10 @@ namespace Threads * around a bug in Intel's icc * compiler with this. */ - template + template inline - typename MemFunData7::ArgCollector - encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const); + typename MemFunData9::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9) const); #endif @@ -5920,6 +6400,284 @@ namespace Threads } +/* ---------------------- MemFunData8 implementation ------------------------ */ + + template + MemFunData8::MemFunData8 (FunPtr fun_ptr, + Class *object, + Arg1 arg1, + Arg2 arg2, + Arg3 arg3, + Arg4 arg4, + Arg5 arg5, + Arg6 arg6, + Arg7 arg7, + Arg8 arg8) : + FunDataBase (&MemFunData8::thread_entry_point), + fun_ptr (fun_ptr), + object (object), + arg1 (arg1), + arg2 (arg2), + arg3 (arg3), + arg4 (arg4), + arg5 (arg5), + arg6 (arg6), + arg7 (arg7), + arg8 (arg8) + {} + + + + template + MemFunData8::MemFunData8 (const MemFunData8 &fun_data) : + FunDataBase (fun_data), + fun_ptr (fun_data.fun_ptr), + object (fun_data.object), + arg1 (fun_data.arg1), + arg2 (fun_data.arg2), + arg3 (fun_data.arg3), + arg4 (fun_data.arg4), + arg5 (fun_data.arg5), + arg6 (fun_data.arg6), + arg7 (fun_data.arg7), + arg8 (fun_data.arg8) + {} + + + + template + FunDataBase * + MemFunData8::clone () const + { + return new MemFunData8 (*this); + } + + + + template + void * + MemFunData8::thread_entry_point (void *arg) + { + // convenience typedef, since we + // will need that class name + // several times below + typedef MemFunData8 ThisClass; + + FunEncapsulation *fun_encapsulation + = reinterpret_cast(arg); + const ThisClass *fun_data + = dynamic_cast (fun_encapsulation->fun_data_base); + + // copy the parameters + ThisClass::FunPtr fun_ptr = fun_data->fun_ptr; + Class *object = fun_data->object; + Arg1 arg1 = fun_data->arg1; + Arg2 arg2 = fun_data->arg2; + Arg3 arg3 = fun_data->arg3; + Arg4 arg4 = fun_data->arg4; + Arg5 arg5 = fun_data->arg5; + Arg6 arg6 = fun_data->arg6; + Arg7 arg7 = fun_data->arg7; + Arg8 arg8 = fun_data->arg8; + + + // copying of parameters is done, + // now we can release the lock on + // @p{fun_data} + fun_data->lock.release (); + + // call the function + (object->*fun_ptr)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); + + return 0; + } + + + + template + MemFunData8::ArgCollector::ArgCollector (FunPtr fun_ptr) : + fun_ptr (fun_ptr) + {} + + + + template + FunEncapsulation + MemFunData8::ArgCollector::collect_args (Class *object, + Arg1 arg1, + Arg2 arg2, + Arg3 arg3, + Arg4 arg4, + Arg5 arg5, + Arg6 arg6, + Arg7 arg7, + Arg8 arg8) + { + return new MemFunData8(fun_ptr, object, + arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); + } + + + + template + inline + FunEncapsulation + MemFunData8::ArgCollector::collect_args (Class &object, + Arg1 arg1, + Arg2 arg2, + Arg3 arg3, + Arg4 arg4, + Arg5 arg5, + Arg6 arg6, + Arg7 arg7, + Arg8 arg8) + { + return collect_args (&object, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); + } + + +/* ---------------------- MemFunData9 implementation ------------------------ */ + + template + MemFunData9::MemFunData9 (FunPtr fun_ptr, + Class *object, + Arg1 arg1, + Arg2 arg2, + Arg3 arg3, + Arg4 arg4, + Arg5 arg5, + Arg6 arg6, + Arg7 arg7, + Arg8 arg8, + Arg9 arg9) : + FunDataBase (&MemFunData9::thread_entry_point), + fun_ptr (fun_ptr), + object (object), + arg1 (arg1), + arg2 (arg2), + arg3 (arg3), + arg4 (arg4), + arg5 (arg5), + arg6 (arg6), + arg7 (arg7), + arg8 (arg8), + arg9 (arg9) + {} + + + + template + MemFunData9::MemFunData9 (const MemFunData9 &fun_data) : + FunDataBase (fun_data), + fun_ptr (fun_data.fun_ptr), + object (fun_data.object), + arg1 (fun_data.arg1), + arg2 (fun_data.arg2), + arg3 (fun_data.arg3), + arg4 (fun_data.arg4), + arg5 (fun_data.arg5), + arg6 (fun_data.arg6), + arg7 (fun_data.arg7), + arg8 (fun_data.arg8), + arg9 (fun_data.arg9) + {} + + + + template + FunDataBase * + MemFunData9::clone () const + { + return new MemFunData9 (*this); + } + + + + template + void * + MemFunData9::thread_entry_point (void *arg) + { + // convenience typedef, since we + // will need that class name + // several times below + typedef MemFunData9 ThisClass; + + FunEncapsulation *fun_encapsulation + = reinterpret_cast(arg); + const ThisClass *fun_data + = dynamic_cast (fun_encapsulation->fun_data_base); + + // copy the parameters + ThisClass::FunPtr fun_ptr = fun_data->fun_ptr; + Class *object = fun_data->object; + Arg1 arg1 = fun_data->arg1; + Arg2 arg2 = fun_data->arg2; + Arg3 arg3 = fun_data->arg3; + Arg4 arg4 = fun_data->arg4; + Arg5 arg5 = fun_data->arg5; + Arg6 arg6 = fun_data->arg6; + Arg7 arg7 = fun_data->arg7; + Arg8 arg8 = fun_data->arg8; + Arg9 arg9 = fun_data->arg9; + + + // copying of parameters is done, + // now we can release the lock on + // @p{fun_data} + fun_data->lock.release (); + + // call the function + (object->*fun_ptr)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); + + return 0; + } + + + + template + MemFunData9::ArgCollector::ArgCollector (FunPtr fun_ptr) : + fun_ptr (fun_ptr) + {} + + + + template + FunEncapsulation + MemFunData9::ArgCollector::collect_args (Class *object, + Arg1 arg1, + Arg2 arg2, + Arg3 arg3, + Arg4 arg4, + Arg5 arg5, + Arg6 arg6, + Arg7 arg7, + Arg8 arg8, + Arg9 arg9) + { + return new MemFunData9(fun_ptr, object, + arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); + } + + + + template + inline + FunEncapsulation + MemFunData9::ArgCollector::collect_args (Class &object, + Arg1 arg1, + Arg2 arg2, + Arg3 arg3, + Arg4 arg4, + Arg5 arg5, + Arg6 arg6, + Arg7 arg7, + Arg8 arg8, + Arg9 arg9) + { + return collect_args (&object, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); + } + + /* ---------------------------------------------------------------- */ inline @@ -6167,6 +6925,42 @@ namespace Threads + template + typename MemFunData8::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)) + { + return fun_ptr; + } + +#ifdef DEAL_II_TEMPL_CONST_MEM_PTR_BUG + template + typename MemFunData8::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const) + { + return fun_ptr; + } +#endif + + + + template + typename MemFunData9::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)) + { + return fun_ptr; + } + +#ifdef DEAL_II_TEMPL_CONST_MEM_PTR_BUG + template + typename MemFunData9::ArgCollector + encapsulate (void (Class::*fun_ptr)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9) const) + { + return fun_ptr; + } +#endif + + + template typename std::vector > split_range (const ForwardIterator &begin, -- 2.39.5