ML 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) |
Inits a PageRequests for the given pageId on the given outputImage . | |
Setup and dependency to TileRequest | |
void | createInputTileRequests () |
Creates the TileRequests that are needed for this PageRequest. | |
void | addNeededBy (TileRequest *request) |
Adds that the given TileRequest request depends on this page. | |
bool | tileRequestFinished () |
Called when one of the tile requests has finished, returns true if all input tiles are finished. | |
bool | isNeededByTiles () |
Returns if this PageRequest is needed by any tiles (if not, it should not be deleted). | |
Processing and queuing | |
bool | isReadyForProcessing () |
Returns if the request is ready for the page calculation and can be placed in the work queue. | |
MLErrorCode | runCalculateOutputSubImage (UserThreadData *userThreadData) |
Allocates the page and call Module::calculateOutputSubImage with given output page and input tiles (may only be called when isReadyForProcessing() returns true). | |
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. | |
PagedImage * | getPagedImage () |
Get access to the associated paged image (never NULL!) | |
MLint | getPageId () |
Get the page id. | |
int | getProcessingScope () const |
Get the assigned processing scope. | |
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. | |
bool | propagateCancellationDownIfRequestNotNeededAnymore () |
Recursively walks up to all tree roots and checks whether they are canceled. | |
void | collectPageRequestsWithErrors (std::set< PageRequest * > &result) |
Collects all page requests that have error()!=ML_RESULT_OK up to the roots of the tree. | |
bool | hasError () const |
Returns if the request has an error (and the data is thus unusable/invalid). | |
void | setError (MLErrorCode error) |
Sets the error that happened (on this single request, not an the tree). | |
MLErrorCode | getError () |
Returns the error that happened. | |
Static Public Member Functions | |
static PageRequest * | allocate () |
Page requests are allocated via the allocate method, they can not be created with new. | |
static void | deallocate (PageRequest *request) |
Page requests are deallocated with the deallocate method, they can not be deleted directly. | |
static void | clearFreeList () |
Clear the internal free list of deallocated PageRequests. | |
Protected Member Functions | |
void | freeInputTiles () |
Frees the input tiles and their data. | |
Protected Attributes | |
std::vector< TileRequest * > | _inputTiles |
Array of input tiles, may contain NULL for empty boxes (array is empty on data sources). | |
int | _inputTilesNeeded |
The number of still needed input tiles (without empty tiles) (is decremented whenever a tile has finished). | |
Mutex | _inputTilesNeededMutex |
int | _totalInputTilesNeeded |
The total number of input tiles (without empty tiles) | |
int | _traversalCursorPosition |
Offset into _inputTiles to indicate the next tile request to fill with pages. | |
int | _traversalCreatedTiles |
Number of tiles that has already been created. | |
MLMemoryBlockHandle | _page |
The page data (which locks the data in the cache, since it uses a MLMemoryBlockHandle). | |
PagedImage * | _image |
The image from which the page should be requested. | |
MLint | _pageId |
The pageid that should be requested. | |
MLErrorCode | _error |
The error that happened. | |
int | _processingScope |
the processing scope | |
std::vector< TileRequest * > | _neededByTiles |
A list of links to the dependend TileRequests which need this PageRequest to complete. | |
bool | _needsToBeRemovedFromPagedImage |
flag if we need to be removed from the paged image | |
Friends | |
class | PageRequestCursor |
PageRequestCursor is a friend, since it directly accesses the traversal state. | |
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 |
Clear 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 |
Get access to the associated paged image (never NULL!)
Definition at line 106 of file mlPageRequest.h.
|
inline |
Get the page id.
Definition at line 109 of file mlPageRequest.h.
|
inline |
Get the assigned processing scope.
Definition at line 112 of file mlPageRequest.h.
|
inline |
Returns if the request has an error (and the data is thus unusable/invalid).
Definition at line 134 of file mlPageRequest.h.
References ML_RESULT_OK.
void ml::PageRequest::init | ( | PagedImage * | outputImage, |
MLint | pageId, | ||
int | processingScope ) |
Inits a PageRequests for the given pageId
on the given outputImage
.
|
inline |
Returns if 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 if 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 when 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 call Module::calculateOutputSubImage with given output page and input tiles (may only be called when isReadyForProcessing() returns true).
|
inline |
Sets the error that happened (on this single request, not an the tree).
Definition at line 137 of file mlPageRequest.h.
bool ml::PageRequest::tileRequestFinished | ( | ) |
Called when one of the tile requests has finished, 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, 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 (without empty tiles) (is decremented whenever a tile has 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 dependend TileRequests which need this PageRequest to complete.
Definition at line 181 of file mlPageRequest.h.
|
protected |
flag if 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 a 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 |
Number of tiles that has 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.