MeVisLab Toolbox Reference
mlPageRequestProcessor.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_PAGE_REQUEST_PROCESSOR_H
14#define ML_PAGE_REQUEST_PROCESSOR_H
15
17
18// ML-includes
19#include "mlInitSystemML.h"
20
21#include "mlInitSystemML.h"
22
24
25class TileRequest;
26class PageRequest;
27class PageRequestCursor;
28
29//-------------------------------------------------------------------------------------------
31//-------------------------------------------------------------------------------------------
33{
34public:
37
39 virtual void append(PageRequest* request) = 0;
40};
41
42
43//-------------------------------------------------------------------------------------------
45//-------------------------------------------------------------------------------------------
47{
48public:
51
54
56 virtual void processAll() = 0;
57
59 virtual void process(double timeBudget) = 0;
60
62 virtual bool needsProcessing() = 0;
63
65 virtual void removeCancelledRequests() = 0;
66
72 virtual void enterProcessingScope() = 0;
73
75 virtual void leaveProcessingScope() = 0;
76
78 virtual void setNumWorkerThreads(std::size_t /*threads*/) = 0;
79
81 virtual bool processingWasSingleThreaded() const = 0;
82
84 static void enableTileRequestAllocationFailure(int count = 1);
87
88};
89
90
92
93#endif //of __mlPageRequestProcessor_H
94
Abstract base class for page request processors.
virtual void setNumWorkerThreads(std::size_t)=0
Set number of worker threads (available here even if subclasses may not support it)
virtual bool processingWasSingleThreaded() const =0
Returns if the last request was processed single or multi-threaded.
virtual void processAll()=0
Processes all requests until the cursors have traversed the whole tree and the queue is empty.
virtual void process(double timeBudget)=0
Process the requests for the given timeBudget given in seconds.
virtual void removeCancelledRequests()=0
Removes all requests that are canceled and no longer needed.
virtual bool needsProcessing()=0
Returns if the tile request needs some more processing.
static void enableTileRequestAllocationFailure(int count=1)
Enables failing on every count allocation.
virtual void enterProcessingScope()=0
Enters a recursive processing scope (always called from main thread!) Default scope is 0 (which is us...
virtual void leaveProcessingScope()=0
Leaves a recursive processing scope (always called from main thread!)
static void disableTileRequestAllocationFailure()
Disables allocation failure (default!)
~PageRequestProcessor() override
Virtual destructor.
virtual void addRootTileRequest(TileRequest *tileRequest)=0
Adds the root tileRequest that should be processed (the ownership stays with the caller).
Virtual interface for queuing PageRequests that are ready for processing.
virtual ~PageRequestQueueInterface()
Virtual destructor to get rid of warning.
virtual void append(PageRequest *request)=0
Append PageRequest request which is ready for processing to the work queue.
A PageRequest represents the request for the calculation of a single page of a PagedImage.
A TileRequest either represents the input sub image that is needed by a PageRequest or if it is a roo...
#define MLEXPORT
To export symbols from a dll/shared object, we need to mark them with the MLEXPORT symbol.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.