MeVisLab Toolbox Reference
|
A PageRequest represents the request for the calculation of a single page of a PagedImage. More...
#include <mlPageRequest.h>
Public Member Functions | |
void | init (PagedImage *outputImage, MLint pageId, int processingScope) |
Initializes a PageRequests for the given pageId on the given outputImage . More... | |
Setup and dependency to TileRequest | |
void | createInputTileRequests () |
Creates the TileRequests that are needed for this PageRequest. More... | |
void | addNeededBy (TileRequest *request) |
Adds that the given TileRequest request depends on this page. More... | |
bool | tileRequestFinished () |
Called when one of the tile requests has finished, and returns true if all input tiles are finished. More... | |
bool | isNeededByTiles () |
Returns whether this PageRequest is needed by any tiles (if not, it should not be deleted). More... | |
Processing and queuing | |
bool | isReadyForProcessing () |
Returns whether the request is ready for the page calculation and can be placed in the work queue. More... | |
MLErrorCode | runCalculateOutputSubImage (UserThreadData *userThreadData) |
Allocates the page and calls Module::calculateOutputSubImage with the given output page and input tiles. More... | |
void | copyPageToTileRequests (PageRequestQueueInterface &queue) |
Copies data to dependent tile requests (may only be called after a successful runCalculateOutputSubImage()) and adds new PageRequests that have no more pending dependencies to the queue. More... | |
PagedImage * | getPagedImage () |
Returns access to the associated paged image (never NULL!). More... | |
MLint | getPageId () |
Returns the page ID. More... | |
int | getProcessingScope () const |
Returns the assigned processing scope. More... | |
Error handling | |
void | propagateErrorUpwards (MLErrorCode error) |
Propagates an error upwards through the request tree, sets the error on all dependend TileRequest and PageRequests up to the root TileRequests. More... | |
bool | propagateCancellationDownIfRequestNotNeededAnymore () |
Recursively walks up to all tree roots and checks whether they are canceled. More... | |
void | collectPageRequestsWithErrors (std::set< PageRequest * > &result) |
Collects all page requests that have error()!=ML_RESULT_OK up to the roots of the tree. More... | |
bool | hasError () const |
Returns whether the request has an error (making the data unusable or invalid). More... | |
void | setError (MLErrorCode error) |
Sets the error that happened (on this single request, not on the tree). More... | |
MLErrorCode | getError () |
Returns the error that happened. More... | |
Static Public Member Functions | |
static PageRequest * | allocate () |
Page requests are allocated via the allocate method; they can not be created with new . More... | |
static void | deallocate (PageRequest *request) |
Page requests are deallocated with the deallocate method; they can not be deleted directly. More... | |
static void | clearFreeList () |
Clears the internal free list of deallocated PageRequests. More... | |
Protected Member Functions | |
void | freeInputTiles () |
Frees the input tiles and their data. More... | |
Protected Attributes | |
std::vector< TileRequest * > | _inputTiles |
Array of input tiles; it may contain NULL for empty boxes (array is empty on data sources). More... | |
int | _inputTilesNeeded |
The number of still needed input tiles (excluding empty tiles), decremented whenever a tile is finished. More... | |
Mutex | _inputTilesNeededMutex |
int | _totalInputTilesNeeded |
The total number of input tiles (without empty tiles) More... | |
int | _traversalCursorPosition |
Offset into _inputTiles to indicate the next tile request to fill with pages. More... | |
int | _traversalCreatedTiles |
The number of tiles that have already been created. More... | |
MLMemoryBlockHandle | _page |
The page data, which locks the data in the cache since it uses an MLMemoryBlockHandle. More... | |
PagedImage * | _image |
The image from which the page should be requested. More... | |
MLint | _pageId |
The pageid that should be requested. More... | |
MLErrorCode | _error |
The error that happened. More... | |
int | _processingScope |
The processing scope. More... | |
std::vector< TileRequest * > | _neededByTiles |
A list of links to the dependent TileRequests that need this PageRequest to complete. More... | |
bool | _needsToBeRemovedFromPagedImage |
Flag whether we need to be removed from the paged image. More... | |
Friends | |
class | PageRequestCursor |
PageRequestCursor is a friend, since it directly accesses the traversal state. More... | |
A PageRequest represents the request for the calculation of a single page of a PagedImage.
It defines the work item that the PageRequestProcessor queues and executes.
Definition at line 31 of file mlPageRequest.h.
|
inline |
Adds that the given TileRequest request
depends on this page.
When the PageRequest has finished, it will notify the TileRequest. Multiple TileRequests can depend on the same PageRequest (and thus share a PageRequest).
Definition at line 76 of file mlPageRequest.h.
|
static |
Page requests are allocated via the allocate method; they can not be created with new
.
|
static |
Clears the internal free list of deallocated PageRequests.
void ml::PageRequest::collectPageRequestsWithErrors | ( | std::set< PageRequest * > & | result | ) |
Collects all page requests that have error()!=ML_RESULT_OK up to the roots of the tree.
void ml::PageRequest::copyPageToTileRequests | ( | PageRequestQueueInterface & | queue | ) |
Copies data to dependent tile requests (may only be called after a successful runCalculateOutputSubImage()) and adds new PageRequests that have no more pending dependencies to the queue.
void ml::PageRequest::createInputTileRequests | ( | ) |
Creates the TileRequests that are needed for this PageRequest.
Pages on modules without inputs will not have any TileRequests. Empty input boxes will also not generate TileRequest.
|
static |
Page requests are deallocated with the deallocate method; they can not be deleted directly.
|
protected |
Frees the input tiles and their data.
|
inline |
Returns the error that happened.
Definition at line 140 of file mlPageRequest.h.
|
inline |
Returns access to the associated paged image (never NULL!).
Definition at line 106 of file mlPageRequest.h.
|
inline |
Returns the page ID.
Definition at line 109 of file mlPageRequest.h.
|
inline |
Returns the assigned processing scope.
Definition at line 112 of file mlPageRequest.h.
|
inline |
Returns whether the request has an error (making the data unusable or invalid).
Definition at line 134 of file mlPageRequest.h.
References ML_RESULT_OK.
void ml::PageRequest::init | ( | PagedImage * | outputImage, |
MLint | pageId, | ||
int | processingScope | ||
) |
Initializes a PageRequests for the given pageId
on the given outputImage
.
|
inline |
Returns whether this PageRequest is needed by any tiles (if not, it should not be deleted).
Definition at line 84 of file mlPageRequest.h.
bool ml::PageRequest::isReadyForProcessing | ( | ) |
Returns whether the request is ready for the page calculation and can be placed in the work queue.
bool ml::PageRequest::propagateCancellationDownIfRequestNotNeededAnymore | ( | ) |
Recursively walks up to all tree roots and checks whether they are canceled.
Returns true
if all encountered tree roots have been canceled and sets the error to ML_OPERATION_INTERRUPTED if true
is returned.
void ml::PageRequest::propagateErrorUpwards | ( | MLErrorCode | error | ) |
Propagates an error upwards through the request tree, sets the error
on all dependend TileRequest and PageRequests up to the root TileRequests.
MLErrorCode ml::PageRequest::runCalculateOutputSubImage | ( | UserThreadData * | userThreadData | ) |
Allocates the page and calls Module::calculateOutputSubImage with the given output page and input tiles.
It may only be called if isReadyForProcessing() returns true
.
|
inline |
Sets the error that happened (on this single request, not on the tree).
Definition at line 137 of file mlPageRequest.h.
bool ml::PageRequest::tileRequestFinished | ( | ) |
Called when one of the tile requests has finished, and returns true
if all input tiles are finished.
|
friend |
PageRequestCursor is a friend, since it directly accesses the traversal state.
Definition at line 149 of file mlPageRequest.h.
|
protected |
The error that happened.
Definition at line 175 of file mlPageRequest.h.
|
protected |
The image from which the page should be requested.
Definition at line 170 of file mlPageRequest.h.
|
protected |
Array of input tiles; it may contain NULL for empty boxes (array is empty on data sources).
Definition at line 152 of file mlPageRequest.h.
|
protected |
The number of still needed input tiles (excluding empty tiles), decremented whenever a tile is finished.
Definition at line 154 of file mlPageRequest.h.
|
protected |
Definition at line 157 of file mlPageRequest.h.
|
protected |
A list of links to the dependent TileRequests that need this PageRequest to complete.
Definition at line 181 of file mlPageRequest.h.
|
protected |
Flag whether we need to be removed from the paged image.
Definition at line 184 of file mlPageRequest.h.
|
protected |
The page data, which locks the data in the cache since it uses an MLMemoryBlockHandle.
Definition at line 168 of file mlPageRequest.h.
|
protected |
The pageid that should be requested.
Definition at line 172 of file mlPageRequest.h.
|
protected |
The processing scope.
Definition at line 178 of file mlPageRequest.h.
|
protected |
The total number of input tiles (without empty tiles)
Definition at line 160 of file mlPageRequest.h.
|
protected |
The number of tiles that have already been created.
Definition at line 165 of file mlPageRequest.h.
|
protected |
Offset into _inputTiles to indicate the next tile request to fill with pages.
Definition at line 163 of file mlPageRequest.h.