MeVisLab Toolbox Reference
mlBackgroundTaskMessage.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2009, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_BACKGROUND_TASK_MESSAGE_H
14#define ML_BACKGROUND_TASK_MESSAGE_H
15
16// Local includes
18
20
21//-----------------------------------------------------------------------
22class BackgroundTask;
23
36
37//-----------------------------------------------------------------------
40public:
43
45 void setSender(BackgroundTask* task) { _sender = task; }
46
48 BackgroundTask* sender() { return _sender; }
49
52
54 BackgroundTaskMessageReceiver* receiver() { return _receiver; }
55
58 virtual void execute() = 0;
59
63 virtual void executeSynchronous() { execute(); }
64
68 virtual bool finishedProcessing() { return true; }
69
71 virtual void taskWillBeDestroyed();
72
73private:
74 BackgroundTask* _sender;
76};
77
78//-----------------------------------------------------------------------
79
81
82#endif
83
84
#define MLBACKGROUNDTASKS_EXPORT
The background task receiver is a light-weight base class that can be inherited (e....
The base class of all background messages.
BackgroundTask * sender()
Returns the task from which the message originates.
virtual void executeSynchronous()
Executes message when it is delivered and the task runs synchronously.
void setSender(BackgroundTask *task)
Sets who sends the message. Default is NULL and this means that the message's sender is not a Backgro...
virtual void taskWillBeDestroyed()
This needs to be implemented if the message uses finishedProcessing() and the task is finished while ...
BackgroundTaskMessageReceiver * receiver()
Returns the object which receives the message. Default is NULL.
void setReceiver(BackgroundTaskMessageReceiver *receiverArg)
Sets who receives the message. Default is NULL.
virtual void execute()=0
Executes message when it is delivered.
virtual bool finishedProcessing()
Returns whether the message needs further processing or if it may be deleted.
Base class for a task that is started in an extra thread.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.