MeVisLab Toolbox Reference
mlBackgroundTaskMessages.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_MESSAGES_H
14#define ML_BACKGROUND_TASK_MESSAGES_H
15
16// Local includes
21
23
24class GetTileJobBase;
25class ProcessAllPagesHandler;
26
34
35//--------------------------------------------------------------------------------------
37public:
39 : BackgroundTaskMessage(), _request(nullptr), _module(module), _tileId(tileId), _resultWasSent(false) {
40 }
41
43
44 void executeSynchronous() override;
45
46 bool finishedProcessing() override;
47
48 void taskWillBeDestroyed() override;
49
50 static void tileRequestFinishedCB(void* data, TileRequest* request);
51
52 virtual void sendFinishedRequest() = 0;
53
54 virtual void sendFailedRequest() = 0;
55
56 virtual void sendProgress() = 0;
57
58protected:
63};
64
65//--------------------------------------------------------------------------------------
66
68public:
70 int inputImageIndex, MLDataType type, const SubImageBox& box, const ScaleShiftData& shift = ScaleShiftData(),
71 int getTileFlags = 0, ManagedSubImage* externalBuffer = nullptr);
72
74
75 void execute() override;
76
77 void sendFinishedRequest() override;
78
79 void sendFailedRequest() override;
80
81 void sendProgress() override;
82
83private:
84 ManagedSubImage* _externalBuffer;
85 int _inputImageIndex;
86 MLDataType _type;
87 SubImageBox _box;
88 ScaleShiftData _shift;
89 int _getTileFlags;
90};
91
92//--------------------------------------------------------------------------------------
93
95public:
97
99
100 void execute() override;
101
102 void sendFinishedRequest() override;
103
104 void sendFailedRequest() override;
105
106 void sendProgress() override;
107
108private:
109 ProcessAllPagesHandler* _handler;
110 SubImageBox _box;
111 bool _ownsHandler;
112};
113
114//--------------------------------------------------------------------------------------
115
132
133
134//--------------------------------------------------------------------------------------
135
152
154
155#endif
156
157
#define MLBACKGROUNDTASKS_EXPORT
Project global and OS specific declarations.
void execute() override
execute message when it is delivered (reimplement in subclasses)
BackgroundTaskFinishedMessage(BackgroundTask *task)
BackgroundTaskMLGetTileBaseMessage(BackgroundRequestId tileId, Module *module)
bool finishedProcessing() override
tells if the message needs further processing or if it may be deleted if true is returned,...
void taskWillBeDestroyed() override
this needs to be implemented if the message uses finishedProcessing() and the task is finished while ...
void executeSynchronous() override
execute message when it is delivered and the task runs synchronous, the default implementation just c...
static void tileRequestFinishedCB(void *data, TileRequest *request)
BackgroundTaskMLGetTileMessage(BackgroundRequestId tileId, Module *module, int inputImageIndex, MLDataType type, const SubImageBox &box, const ScaleShiftData &shift=ScaleShiftData(), int getTileFlags=0, ManagedSubImage *externalBuffer=nullptr)
void execute() override
execute message when it is delivered (reimplement in subclasses)
void execute() override
execute message when it is delivered (reimplement in subclasses)
BackgroundTaskMLGetTileResultMessage(ImagingBackgroundTask *task, BackgroundRequestId tileId, ManagedSubImage *img)
void execute() override
execute message when it is delivered (reimplement in subclasses)
BackgroundTaskMLProcessAllPagesMessage(BackgroundRequestId tileId, Module *module, ProcessAllPagesHandler *handler, const SubImageBox &box)
BackgroundTaskMLProcessAllPagesResultMessage(ImagingBackgroundTask *task, BackgroundRequestId requestId, ProcessAllPagesHandler *handler)
void execute() override
execute message when it is delivered (reimplement in subclasses)
The base class of all background messages.
void setSender(BackgroundTask *task)
set who sends the message (default is NULL and means that the message's sender is not a BackgroundTas...
Base class for a task that is started in an extra thread.
Base class for TileRequest based jobs.
ManagedSubImage is derived from SubImage and frees its allocated memory automatically when it is dest...
Base class for an image processing module of the ML.
Definition mlModule.h:151
Base class for handlers that are used for the Module::processAllPages facility.
A TileRequest either represents the input sub image that is needed by a PageRequest or if it is a roo...
MLint32 MLDataType
MLDataType.
Definition mlTypeDefs.h:596
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
TScaleShiftData< MLdouble > ScaleShiftData
Double version of TScaleShiftData for maximum reasonable precision.
MLuint32 BackgroundRequestId
the id of a tile request