MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00009 //---------------------------------------------------------------------------------- 00010 00011 00012 #ifndef __mlMessagingBackgroundTask_H 00013 #define __mlMessagingBackgroundTask_H 00014 00015 00016 // Local includes 00017 #include "MLBackgroundTasksSystem.h" 00018 00019 #include "mlBackgroundTask.h" 00020 #include "mlDistantObject.h" 00021 #include "mlBackgroundTaskMethodCallMessage.h" 00022 00023 ML_START_NAMESPACE 00024 00025 //----------------------------------------------------------------------- 00026 00030 class MLBACKGROUNDTASKS_EXPORT MessagingBackgroundTask : public BackgroundTask 00031 { 00032 ML_DISALLOW_COPY_AND_ASSIGN(MessagingBackgroundTask) 00033 00034 public: 00035 MessagingBackgroundTask(void* owner):BackgroundTask(owner) {}; 00036 00037 //------------------------------------------------------ 00039 00075 //------------------------------------------------------ 00076 00077 template <typename Object, typename Method> 00078 void callMethodOnGUI(const DistantObject<Object>& target, Method method) 00079 { 00080 sendMessageToGUI(NewBackgroundTaskMethodCall(DistantObjectAccessor::get(target), method)); 00081 } 00082 00083 template <typename Object, typename Method, typename Arg1> 00084 void callMethodOnGUI(const DistantObject<Object>& target, Method method, const Arg1& arg1) 00085 { 00086 sendMessageToGUI(NewBackgroundTaskMethodCall(DistantObjectAccessor::get(target), method, arg1)); 00087 } 00088 00089 template <typename Object, typename Method, typename Arg1, typename Arg2> 00090 void callMethodOnGUI(const DistantObject<Object>& target, Method method, const Arg1& arg1, const Arg2& arg2) 00091 { 00092 sendMessageToGUI(NewBackgroundTaskMethodCall(DistantObjectAccessor::get(target), method, arg1, arg2)); 00093 } 00094 00095 template <typename Object, typename Method, typename Arg1, typename Arg2, typename Arg3> 00096 void callMethodOnGUI(const DistantObject<Object>& target, Method method, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3) 00097 { 00098 sendMessageToGUI(NewBackgroundTaskMethodCall(DistantObjectAccessor::get(target), method, arg1, arg2, arg3)); 00099 } 00100 00101 template <typename Object, typename Method, typename Arg1, typename Arg2, typename Arg3, typename Arg4> 00102 void callMethodOnGUI(const DistantObject<Object>& target, Method method, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4) 00103 { 00104 sendMessageToGUI(NewBackgroundTaskMethodCall(DistantObjectAccessor::get(target), method, arg1, arg2, arg3, arg4)); 00105 } 00106 00107 template <typename Object, typename Method, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> 00108 void callMethodOnGUI(const DistantObject<Object>& target, Method method, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4, const Arg5& arg5) 00109 { 00110 sendMessageToGUI(NewBackgroundTaskMethodCall(DistantObjectAccessor::get(target), method, arg1, arg2, arg3, arg4, arg5)); 00111 } 00112 }; 00113 00114 00115 ML_END_NAMESPACE 00116 00117 #endif 00118 00119