MeVisLab Toolbox Reference
ml::PageRequest Class 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. 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, returns true if all input tiles are finished. More...
 
bool isNeededByTiles ()
 Returns if this PageRequest is needed by any tiles (if not, it should not be deleted). More...
 
Processing and queuing
bool isReadyForProcessing ()
 Returns if 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 call Module::calculateOutputSubImage with given output page and input tiles (may only be called when isReadyForProcessing() returns true). 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...
 
PagedImagegetPagedImage ()
 Get access to the associated paged image (never NULL!) More...
 
MLint getPageId ()
 Get the page id. More...
 
int getProcessingScope () const
 Get 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 if the request has an error (and the data is thus unusable/invalid). More...
 
void setError (MLErrorCode error)
 Sets the error that happened (on this single request, not an the tree). More...
 
MLErrorCode getError ()
 Returns the error that happened. More...
 

Static Public Member Functions

static PageRequestallocate ()
 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 ()
 Clear 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, may contain NULL for empty boxes (array is empty on data sources). More...
 
int _inputTilesNeeded
 The number of still needed input tiles (without empty tiles) (is decremented whenever a tile has 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
 Number of tiles that has already been created. More...
 
MLMemoryBlockHandle _page
 The page data (which locks the data in the cache, since it uses a 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 dependend TileRequests which need this PageRequest to complete. More...
 
bool _needsToBeRemovedFromPagedImage
 flag if 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...
 

Detailed Description

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.

Member Function Documentation

◆ addNeededBy()

void ml::PageRequest::addNeededBy ( TileRequest request)
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.

◆ allocate()

static PageRequest* ml::PageRequest::allocate ( )
static

Page requests are allocated via the allocate method, they can not be created with new.

◆ clearFreeList()

static void ml::PageRequest::clearFreeList ( )
static

Clear the internal free list of deallocated PageRequests.

◆ collectPageRequestsWithErrors()

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.

◆ copyPageToTileRequests()

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.

◆ createInputTileRequests()

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.

◆ deallocate()

static void ml::PageRequest::deallocate ( PageRequest request)
static

Page requests are deallocated with the deallocate method, they can not be deleted directly.

◆ freeInputTiles()

void ml::PageRequest::freeInputTiles ( )
protected

Frees the input tiles and their data.

◆ getError()

MLErrorCode ml::PageRequest::getError ( )
inline

Returns the error that happened.

Definition at line 140 of file mlPageRequest.h.

◆ getPagedImage()

PagedImage* ml::PageRequest::getPagedImage ( )
inline

Get access to the associated paged image (never NULL!)

Definition at line 106 of file mlPageRequest.h.

◆ getPageId()

MLint ml::PageRequest::getPageId ( )
inline

Get the page id.

Definition at line 109 of file mlPageRequest.h.

◆ getProcessingScope()

int ml::PageRequest::getProcessingScope ( ) const
inline

Get the assigned processing scope.

Definition at line 112 of file mlPageRequest.h.

◆ hasError()

bool ml::PageRequest::hasError ( ) const
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.

◆ init()

void ml::PageRequest::init ( PagedImage outputImage,
MLint  pageId,
int  processingScope 
)

Inits a PageRequests for the given pageId on the given outputImage.

◆ isNeededByTiles()

bool ml::PageRequest::isNeededByTiles ( )
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.

◆ isReadyForProcessing()

bool ml::PageRequest::isReadyForProcessing ( )

Returns if the request is ready for the page calculation and can be placed in the work queue.

◆ propagateCancellationDownIfRequestNotNeededAnymore()

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.

◆ propagateErrorUpwards()

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.

◆ runCalculateOutputSubImage()

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).

◆ setError()

void ml::PageRequest::setError ( MLErrorCode  error)
inline

Sets the error that happened (on this single request, not an the tree).

Definition at line 137 of file mlPageRequest.h.

◆ tileRequestFinished()

bool ml::PageRequest::tileRequestFinished ( )

Called when one of the tile requests has finished, returns true if all input tiles are finished.

Friends And Related Function Documentation

◆ PageRequestCursor

friend class PageRequestCursor
friend

PageRequestCursor is a friend, since it directly accesses the traversal state.

Definition at line 149 of file mlPageRequest.h.

Member Data Documentation

◆ _error

MLErrorCode ml::PageRequest::_error
protected

The error that happened.

Definition at line 175 of file mlPageRequest.h.

◆ _image

PagedImage* ml::PageRequest::_image
protected

The image from which the page should be requested.

Definition at line 170 of file mlPageRequest.h.

◆ _inputTiles

std::vector<TileRequest*> ml::PageRequest::_inputTiles
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.

◆ _inputTilesNeeded

int ml::PageRequest::_inputTilesNeeded
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.

◆ _inputTilesNeededMutex

Mutex ml::PageRequest::_inputTilesNeededMutex
protected

Definition at line 157 of file mlPageRequest.h.

◆ _neededByTiles

std::vector<TileRequest*> ml::PageRequest::_neededByTiles
protected

A list of links to the dependend TileRequests which need this PageRequest to complete.

Definition at line 181 of file mlPageRequest.h.

◆ _needsToBeRemovedFromPagedImage

bool ml::PageRequest::_needsToBeRemovedFromPagedImage
protected

flag if we need to be removed from the paged image

Definition at line 184 of file mlPageRequest.h.

◆ _page

MLMemoryBlockHandle ml::PageRequest::_page
protected

The page data (which locks the data in the cache, since it uses a MLMemoryBlockHandle).

Definition at line 168 of file mlPageRequest.h.

◆ _pageId

MLint ml::PageRequest::_pageId
protected

The pageid that should be requested.

Definition at line 172 of file mlPageRequest.h.

◆ _processingScope

int ml::PageRequest::_processingScope
protected

the processing scope

Definition at line 178 of file mlPageRequest.h.

◆ _totalInputTilesNeeded

int ml::PageRequest::_totalInputTilesNeeded
protected

The total number of input tiles (without empty tiles)

Definition at line 160 of file mlPageRequest.h.

◆ _traversalCreatedTiles

int ml::PageRequest::_traversalCreatedTiles
protected

Number of tiles that has already been created.

Definition at line 165 of file mlPageRequest.h.

◆ _traversalCursorPosition

int ml::PageRequest::_traversalCursorPosition
protected

Offset into _inputTiles to indicate the next tile request to fill with pages.

Definition at line 163 of file mlPageRequest.h.


The documentation for this class was generated from the following file: