MeVisLab Toolbox 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//-------------------------------------------------------------------------------------------
36//-------------------------------------------------------------------------------------------
38{
39public:
46
48 void init(TileRequest* request);
49
51 void setProcessingScope(int scope) { _processingScope = scope; }
52
54 int getProcessingScope() const { return _processingScope; }
55
62
67 CursorState nextStep(PageRequestQueueInterface& queue, bool &hasCreatedWork);
68
71
74
76 void collectPageRequestsWithErrors(std::set<PageRequest*>& result);
77
79 bool isNeeded();
80
82 void clear();
83
85 TileRequest* currentTileRequest() { return _tileRequest; }
86
88 void append(PageRequest* request) override;
89
91 MLint getNumCreatedPageRequests() const { return _numCreatedPageRequests; };
92
93private:
95 void commonInit();
96
101 void moveUpToNextDown();
102
104 PageRequest* _pageRequest;
106 TileRequest* _tileRequest;
107
109 PageRequest* _pageRequestToPutInQueue;
110
112 int _processingScope;
113
115 int _currentDepth;
116
117 MLint _numCreatedPageRequests;
118};
119
120ML_END_NAMESPACE
121
122#endif //of __mlPageRequestCursor_H
123
CursorState
Defines the current state of the cursor.
@ HasFinished
The cursor has no more work and may be removed.
@ HasMoreWork
Further work is available, re-call nextStep().
@ IsBlocked
The cursor has more work but is blocked by a pending request (e.g., a pending memory image).
PageRequestCursor(TileRequest *request)
Creates a cursor from a root TileRequest.
void setProcessingScope(int scope)
Sets the processing scope.
CursorState nextStep(PageRequestQueueInterface &queue, bool &hasCreatedWork)
int getProcessingScope() const
Returns the processing scope.
bool propagateCancellationDownIfRequestNotNeededAnymore()
See Page/TileRequest.
TileRequest * currentTileRequest()
Returns the current tile request.
PageRequestCursor(PageRequest *request)
Creates a cursor from a root PageRequest.
void propagateErrorUpwards(MLErrorCode error)
See Page/TileRequest.
void init(TileRequest *request)
Initializes from a TileRequest.
MLint getNumCreatedPageRequests() const
Returns number of created page requests (inner requests, not the requests that are in the queue).
void append(PageRequest *request) override
Appends PageRequest request that is ready for processing to the work queue.
void clear()
Clears the cursor so that it points to no requests anymore.
bool isNeeded()
Returns whether the cursor is still needed (which is the case when it points to either a PageRequest ...
PageRequestCursor()
Creates an empty cursor.
void collectPageRequestsWithErrors(std::set< PageRequest * > &result)
See Page/TileRequest.
Virtual interface for queuing PageRequests that are ready for processing.
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:715
#define MLEXPORT
Code it as import symbol if compiled elsewhere.
MLint64 MLint
Definition mlTypeDefs.h:489