MeVisLab Toolbox Reference
mlSingleThreadedPageRequestProcessor.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_SINGLE_THREADED_PAGE_REQUEST_PROCESSOR_H
14 #define ML_SINGLE_THREADED_PAGE_REQUEST_PROCESSOR_H
15 
16 #include "mlInitSystemML.h"
17 
19 #include "mlProcessingTimeLine.h"
20 
21 ML_START_NAMESPACE
22 
23 //-------------------------------------------------------------------------------------------
26 //-------------------------------------------------------------------------------------------
28 {
29 public:
32 
34  bool supportsMultiThreading() override { return false; }
35 
37  void setNumWorkerThreads(std::size_t /*threads*/) override {};
38 
40  void addRootTileRequest(TileRequest* tileRequest) override;
41 
43  void processAll() override;
44 
46  void process(double timeBudget) override;
47 
49  bool needsProcessing() override;
50 
52  void append(PageRequest* request) override;
53 
55  bool processingWasSingleThreaded() const override { return true; }
56 
57 private:
59  bool processNextGUIRequest(bool processAll);
60 
62  MLErrorCode processRequest(PageRequest* request);
63 
65  static void rootTileRequestFinishedCB(void* data, TileRequest* request);
66 
68  void rootTileRequestFinished(TileRequest* request);
69 
70 };
71 
72 ML_END_NAMESPACE
73 
74 #endif
75 
The Host is the central image processing class in the ML.
Definition: mlHost.h:115
Base class for single and multi-threaded processor.
A PageRequest represents the request for the calculation of a single page of a PagedImage.
Definition: mlPageRequest.h:32
A single-threaded processor that takes one or even multiple tile requests and can process them iterat...
void setNumWorkerThreads(std::size_t) override
Set the number of threads (ignored by this implementation)
bool supportsMultiThreading() override
Returns if multi-threading is supported.
void addRootTileRequest(TileRequest *tileRequest) override
Adds the root tileRequest that should be processed (the ownership stays with the caller).
bool needsProcessing() override
Returns if the tile request needs some more processing.
void process(double timeBudget) override
Process the requests for the given timeBudget given in seconds.
void processAll() override
Processes all requests until the cursors have traversed the whole tree and the queue is empty.
bool processingWasSingleThreaded() const override
Processing is always single-threaded, only implemented for testing purposes.
SingleThreadedPageRequestProcessor(Host *host=nullptr)
void append(PageRequest *request) override
Implements PageRequestQueueInterface interface.
A TileRequest either represents the input sub image that is needed by a PageRequest or if it is a roo...
Definition: mlTileRequest.h:50
MLint32 MLErrorCode
Type of an ML Error code.
Definition: mlTypeDefs.h:818
#define MLEXPORT
To export symbols from a dll/shared object, we need to mark them with the MLEXPORT symbol.