]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Extend formalism of void functions to Mem_Fun_Data[56].
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 16 Feb 2000 17:40:01 +0000 (17:40 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 16 Feb 2000 17:40:01 +0000 (17:40 +0000)
git-svn-id: https://svn.dealii.org/trunk@2421 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/thread_manager.h

index cdc48b3689e943a05cf97e5acded41ef1aaeade5..00b90840d59a0899b28067fbb8f8b4a10681318d 100644 (file)
@@ -610,13 +610,15 @@ class ThreadManager : public ACE_Thread_Manager
     struct Mem_Fun_Data5
     {
        typedef void * (Class::*MemFun) (Arg1, Arg2, Arg3, Arg4, Arg5);
-       Class *object;
-       Arg1   arg1;
-       Arg2   arg2;
-       Arg3   arg3;
-       Arg4   arg4;
-       Arg5   arg5;
-       MemFun mem_fun;
+       typedef void   (Class::*VoidMemFun) (Arg1, Arg2, Arg3, Arg4, Arg5);
+       Class     *object;
+       Arg1       arg1;
+       Arg2       arg2;
+       Arg3       arg3;
+       Arg4       arg4;
+       Arg5       arg5;
+       MemFun     mem_fun;
+       VoidMemFun void_mem_fun;
 
        Mem_Fun_Data5 (Class *object,
                       Arg1   arg1,
@@ -631,7 +633,24 @@ class ThreadManager : public ACE_Thread_Manager
                        arg3 (arg3),
                        arg4 (arg4),
                        arg5 (arg5),
-                       mem_fun (mem_fun) {};
+                       mem_fun (mem_fun),
+                       void_mem_fun (0) {};
+
+       Mem_Fun_Data5 (Class     *object,
+                      Arg1       arg1,
+                      Arg2       arg2,
+                      Arg3       arg3,
+                      Arg4       arg4,
+                      Arg5       arg5,
+                      VoidMemFun void_mem_fun) :
+                       object (object),
+                       arg1 (arg1),
+                       arg2 (arg2),
+                       arg3 (arg3),
+                       arg4 (arg4),
+                       arg5 (arg5),
+                       mem_fun (0),
+                       void_mem_fun (void_mem_fun) {};
     };
 
     
@@ -653,14 +672,17 @@ class ThreadManager : public ACE_Thread_Manager
     struct Mem_Fun_Data6
     {
        typedef void * (Class::*MemFun) (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6);
-       Class *object;
-       Arg1   arg1;
-       Arg2   arg2;
-       Arg3   arg3;
-       Arg4   arg4;
-       Arg5   arg5;
-       Arg6   arg6;
-       MemFun mem_fun;
+       typedef void   (Class::*VoidMemFun) (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6);
+
+       Class     *object;
+       Arg1       arg1;
+       Arg2       arg2;
+       Arg3       arg3;
+       Arg4       arg4;
+       Arg5       arg5;
+       Arg6       arg6;
+       MemFun     mem_fun;
+       VoidMemFun void_mem_fun;
 
        Mem_Fun_Data6 (Class *object,
                       Arg1   arg1,
@@ -677,7 +699,26 @@ class ThreadManager : public ACE_Thread_Manager
                        arg4 (arg4),
                        arg5 (arg5),
                        arg6 (arg6),
-                       mem_fun (mem_fun) {};
+                       mem_fun (mem_fun),
+                       void_mem_fun (0) {};
+
+       Mem_Fun_Data6 (Class     *object,
+                      Arg1       arg1,
+                      Arg2       arg2,
+                      Arg3       arg3,
+                      Arg4       arg4,
+                      Arg5       arg5,
+                      Arg6       arg6,
+                      VoidMemFun void_mem_fun) :
+                       object (object),
+                       arg1 (arg1),
+                       arg2 (arg2),
+                       arg3 (arg3),
+                       arg4 (arg4),
+                       arg5 (arg5),
+                       arg6 (arg6),
+                       mem_fun (0),
+                       void_mem_fun (void_mem_fun) {};
     };
     
                                     /**
@@ -3709,11 +3750,21 @@ void * ThreadManager::thread_entry_point5 (void *_arg)
                                   // extract function pointer, object
                                   // and argument and dispatch the
                                   // call
-  return (arg->object->*(arg->mem_fun))(arg->arg1,
-                                       arg->arg2,
-                                       arg->arg3,
-                                       arg->arg4,
-                                       arg->arg5);
+  if (arg->mem_fun != 0)
+    return (arg->object->*(arg->mem_fun))(arg->arg1,
+                                         arg->arg2,
+                                         arg->arg3,
+                                         arg->arg4,
+                                         arg->arg5);
+  else
+    {
+      (arg->object->*(arg->void_mem_fun))(arg->arg1,
+                                         arg->arg2,
+                                         arg->arg3,
+                                         arg->arg4,
+                                         arg->arg5);
+      return;
+    };
 };
 
 
@@ -3733,12 +3784,23 @@ void * ThreadManager::thread_entry_point6 (void *_arg)
                                   // extract function pointer, object
                                   // and argument and dispatch the
                                   // call
-  return (arg->object->*(arg->mem_fun))(arg->arg1,
-                                       arg->arg2,
-                                       arg->arg3,
-                                       arg->arg4,
-                                       arg->arg5,
-                                       arg->arg6);
+  if (arg->mem_fun != 0)
+    return (arg->object->*(arg->mem_fun))(arg->arg1,
+                                         arg->arg2,
+                                         arg->arg3,
+                                         arg->arg4,
+                                         arg->arg5,
+                                         arg->arg6);
+  else
+    {
+      (arg->object->*(arg->void_mem_fun))(arg->arg1,
+                                         arg->arg2,
+                                         arg->arg3,
+                                         arg->arg4,
+                                         arg->arg5,
+                                         arg->arg6);
+      return 0;
+    };
 };
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.