ML Reference
mlPageRequestCursor.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_CURSOR_H
14#define ML_PAGE_REQUEST_CURSOR_H
15
17
18// ML-includes
19#include "mlInitSystemML.h"
20
22
23#include <set>
24
25ML_START_NAMESPACE
26
27class TileRequest;
28class PageRequest;
29
30#define ML_PAGEREQUEST_TILES_NOT_CREATED -1
31#define ML_TILEREQUEST_PAGES_NOT_CREATED -1
32
33//-------------------------------------------------------------------------------------------
37//-------------------------------------------------------------------------------------------
39{
40public:
47
49 void init(TileRequest* request);
50
52 void setProcessingScope(int scope) { _processingScope = scope; }
53
55 int getProcessingScope() const { return _processingScope; }
56
63
68 CursorState nextStep(PageRequestQueueInterface& queue, bool &hasCreatedWork);
69
72
75
77 void collectPageRequestsWithErrors(std::set<PageRequest*>& result);
78
80 bool isNeeded();
81
83 void clear();
84
86 TileRequest* currentTileRequest() { return _tileRequest; }
87
89 void append(PageRequest* request) override;
90
92 MLint getNumCreatedPageRequests() const { return _numCreatedPageRequests; };
93
94private:
96 void commonInit();
97
102 void moveUpToNextDown();
103
105 PageRequest* _pageRequest;
107 TileRequest* _tileRequest;
108
110 PageRequest* _pageRequestToPutInQueue;
111
113 int _processingScope;
114
116 int _currentDepth;
117
118 MLint _numCreatedPageRequests;
119};
120
121ML_END_NAMESPACE
122
123#endif //of __mlPageRequestCursor_H
124
A cursor to create page and tile requests in an iterative manner, to allow breaking/resuming at any t...
CursorState
Defines the current state of the cursor.
@ HasFinished
The cursor has no more work to-do and may be removed.
@ HasMoreWork
Further work is available, re-call nextStep().
PageRequestCursor(TileRequest *request)
Creates cursor from a root TileRequest.
void setProcessingScope(int scope)
Sets the processing scope.
CursorState nextStep(PageRequestQueueInterface &queue, bool &hasCreatedWork)
Implements an iterative tree traversal with automatic expanding of the tile and page requests.
int getProcessingScope() const
Gets the processing scope.
bool propagateCancellationDownIfRequestNotNeededAnymore()
See Page/TileRequest.
TileRequest * currentTileRequest()
returns the current tile request
PageRequestCursor(PageRequest *request)
Creates cursor from a root PageRequest.
void propagateErrorUpwards(MLErrorCode error)
See Page/TileRequest.
void init(TileRequest *request)
Initializes from a TileRequest.
MLint getNumCreatedPageRequests() const
Return number of created page requests (inner requests, not the requests that are in the queue).
void append(PageRequest *request) override
Append PageRequest request which is ready for processing to the work queue.
void clear()
Clears the cursor, so that it points to no requests anymore.
bool isNeeded()
Returns if the cursor is still needed (which is the case when it points to either a PageRequest or Ti...
PageRequestCursor()
Creates empty cursor.
void collectPageRequestsWithErrors(std::set< PageRequest * > &result)
See Page/TileRequest.
Virtual interface for queuing PageRequests that are ready for processing.
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...
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:716
#define MLEXPORT
To export symbols from a dll/shared object, we need to mark them with the MLEXPORT symbol.
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition mlTypeDefs.h:490