MeVisLabToolboxReference
|
MessagingBackgroundTask extends the BackgroundTask with the functionality to call methods on DistantObject instances on the GUI thread to communicate with the GUI (e.g. More...
#include <mlMessagingBackgroundTask.h>
Public Member Functions | |
MessagingBackgroundTask (void *owner) | |
Calling methods on DistantObjects in the GUI thread | |
template<typename Object , typename Method > | |
void | callMethodOnGUI (const DistantObject< Object > &target, Method method) |
template<typename Object , typename Method , typename Arg1 > | |
void | callMethodOnGUI (const DistantObject< Object > &target, Method method, const Arg1 &arg1) |
template<typename Object , typename Method , typename Arg1 , typename Arg2 > | |
void | callMethodOnGUI (const DistantObject< Object > &target, Method method, const Arg1 &arg1, const Arg2 &arg2) |
template<typename Object , typename Method , typename Arg1 , typename Arg2 , typename Arg3 > | |
void | callMethodOnGUI (const DistantObject< Object > &target, Method method, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3) |
template<typename Object , typename Method , typename Arg1 , typename Arg2 , typename Arg3 , typename Arg4 > | |
void | callMethodOnGUI (const DistantObject< Object > &target, Method method, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4) |
template<typename Object , typename Method , typename Arg1 , typename Arg2 , typename Arg3 , typename Arg4 , typename Arg5 > | |
void | callMethodOnGUI (const DistantObject< Object > &target, Method method, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5) |
MessagingBackgroundTask extends the BackgroundTask with the functionality to call methods on DistantObject instances on the GUI thread to communicate with the GUI (e.g.
send some intermediate result to the GUI).
Definition at line 30 of file mlMessagingBackgroundTask.h.
ml::MessagingBackgroundTask::MessagingBackgroundTask | ( | void * | owner | ) | [inline] |
Definition at line 35 of file mlMessagingBackgroundTask.h.
void ml::MessagingBackgroundTask::callMethodOnGUI | ( | const DistantObject< Object > & | target, |
Method | method | ||
) | [inline] |
callMethodOnGUI() can call any non-static member method on the instance of T that is stored in a DistantObject<T> with up to 5 arguments, the arguments are copies so that values that you pass need to be copyable. You should be very careful when you pass pointers since the ownership stays with the caller and you can not easily know when it is safe to delete the pointer. The call is send to the GUI thread and executed there.
The example shows how to send an intermediate Matrix4 result to a MatrixField in the GUI thread:
class MyBackgroundTask { MyBackgroundTask(void* owner, MatrixField* field) :MessagingBackgroundTask(owner), _field(field) {} virtual void run() { ... Matrix4 someIntermediateResult; ... // Note the &MatrixField::setMat4Value syntax to get a pointer to the member function callMethodOnGUI(_field, &MatrixField::setMat4Value, someIntermediateResult); ... } private: DistantObject<MatrixField> _field; };
Typically you will either pass the pointer to your derived Module and store it as a DistantObject, or alternatively you can pass individual fields and store them in their own DistantObjects.
Definition at line 78 of file mlMessagingBackgroundTask.h.
References ml::NewBackgroundTaskMethodCall(), and ml::BackgroundTask::sendMessageToGUI().
void ml::MessagingBackgroundTask::callMethodOnGUI | ( | const DistantObject< Object > & | target, |
Method | method, | ||
const Arg1 & | arg1, | ||
const Arg2 & | arg2, | ||
const Arg3 & | arg3, | ||
const Arg4 & | arg4, | ||
const Arg5 & | arg5 | ||
) | [inline] |
Definition at line 108 of file mlMessagingBackgroundTask.h.
References ml::NewBackgroundTaskMethodCall(), and ml::BackgroundTask::sendMessageToGUI().
void ml::MessagingBackgroundTask::callMethodOnGUI | ( | const DistantObject< Object > & | target, |
Method | method, | ||
const Arg1 & | arg1, | ||
const Arg2 & | arg2, | ||
const Arg3 & | arg3, | ||
const Arg4 & | arg4 | ||
) | [inline] |
Definition at line 102 of file mlMessagingBackgroundTask.h.
References ml::NewBackgroundTaskMethodCall(), and ml::BackgroundTask::sendMessageToGUI().
void ml::MessagingBackgroundTask::callMethodOnGUI | ( | const DistantObject< Object > & | target, |
Method | method, | ||
const Arg1 & | arg1, | ||
const Arg2 & | arg2, | ||
const Arg3 & | arg3 | ||
) | [inline] |
Definition at line 96 of file mlMessagingBackgroundTask.h.
References ml::NewBackgroundTaskMethodCall(), and ml::BackgroundTask::sendMessageToGUI().
void ml::MessagingBackgroundTask::callMethodOnGUI | ( | const DistantObject< Object > & | target, |
Method | method, | ||
const Arg1 & | arg1, | ||
const Arg2 & | arg2 | ||
) | [inline] |
Definition at line 90 of file mlMessagingBackgroundTask.h.
References ml::NewBackgroundTaskMethodCall(), and ml::BackgroundTask::sendMessageToGUI().
void ml::MessagingBackgroundTask::callMethodOnGUI | ( | const DistantObject< Object > & | target, |
Method | method, | ||
const Arg1 & | arg1 | ||
) | [inline] |
Definition at line 84 of file mlMessagingBackgroundTask.h.
References ml::NewBackgroundTaskMethodCall(), and ml::BackgroundTask::sendMessageToGUI().