MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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
37
38//-----------------------------------------------------------------------
41{
42public:
45 {}
46
49 {
50 _sender = task;
51 }
52
55 {
56 return _sender;
57 }
58
64
67 {
68 return _receiver;
69 }
70
73 virtual void execute() = 0;
74
78 virtual void executeSynchronous()
79 {
80 execute();
81 }
82
86 virtual bool finishedProcessing()
87 {
88 return true;
89 }
90
93 virtual void taskWillBeDestroyed();
94
95private:
96 BackgroundTask* _sender;
98};
99
100//-----------------------------------------------------------------------
101
103
104#endif
#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.