ML Reference
ml::PageRequestProcessorBase Class Reference

Base class for single and multi-threaded processor. More...

#include <mlPageRequestProcessorBase.h>

Inheritance diagram for ml::PageRequestProcessorBase:
ml::PageRequestProcessor ml::PageRequestQueueInterface ml::MultiThreadedPageRequestProcessor ml::SingleThreadedPageRequestProcessor

List of all members.

Classes

struct  PerThreadStorage
 Data this is available on a per-thread basis to cache things that are reused across PageRequest calls, e.g. More...
struct  ScopeStackEntry
 Each processing scope has its own GUI work queue and flags/counters for errors and tiles to wait for. More...

Public Member Functions

 PageRequestProcessorBase (Host *host)
 ~PageRequestProcessorBase ()
virtual bool supportsMultiThreading ()=0
 Returns if multi-threading is supported.
virtual void removeCancelledRequests ()
 Removes all requests that are canceled and no longer needed.
ProcessingTimeLinegetProcessingTimeLine ()
 Get access to the processing time line.
ProcessingTimeLine::TimeLinegetOverviewTimeLine ()
 Get access to the overview time line (only if time line profiling is on)
void enableTimeLineProfiling (bool flag)
 Enable/disable time line profiling.
bool isTimeLineProfilingEnabled () const
 Returns if time line profiling is enabled.
int getProcessingScope () const
 Return the current processing scope.
virtual void enterProcessingScope ()
 Enters a recursive processing scope (always called from main thread!)
virtual void leaveProcessingScope ()
 Leaves a recursive processing scope (always called from main thread!)

Protected Member Functions

bool createMoreWork (bool sleepWhenBlocked)
 Creates more work items, returns true if new work was created.
void setupCurrentProcessingScope ()
 helper
virtual void handleErrorsInGUIThread ()
 handle all errors that have been accumulated
void terminateAllRequestsInGUIThread ()
 terminate all requests
void addNewCursor (PageRequestCursor *cursor)
 add the new cursor
virtual void getAllPageRequestQueues (std::vector< std::deque< PageRequest * > * > &queues)
 get all page request queues (to be derived when there are more than the GUI queues)
UserThreadDatagetUserThreadData (PageRequest *request, PerThreadStorage &perThreadStorage)
 Gets or allocates the UserThreadData for the given request as part of the perThreadStorage.

Protected Attributes

Host_host
 optional pointer to the host
bool _terminated
 flag if the calculation was terminated
bool _workProduced
 flag to know if producer produces work
int _rootTileRequests
 the number of root tile requests, if this gets down to 0, we are done
std::vector< std::vector
< PageRequestCursor * > > 
_cursors
 The cursors that are handled by the producer thread, one list for each processing scope.
int _processingScope
 the current processing scope (0 = BG tasks, 1 = normal get tile, >1 = recursive get tile
int _producerProcessingScope
 the current cursor scope of the producer
int _producerCursorCounter
 how many cursors the producer contains in all lists
int _guiThreadRecursionCounter
 the recursion of the GUI thread (0 = outer entry)
ScopeStackEntry_currentScope
 the current scope pointer
std::vector< ScopeStackEntry_scopeStack
 Stack of processing scopes for performance reasons, we only grow this stack, we never shrink it.
TimeCounter _progressUpdateTimer
 Timer used for progress update from GUI thread.
PerThreadStorage _guiPerThreadStorage
 The per thread storage for the GUI thread.
Profiling
bool _useTimeLineProfiling
ProcessingTimeLine _profile
ProcessingTimeLine::TimeLine_guiThreadTimeLine
ProcessingTimeLine::TimeLine_overviewTimeLine

Detailed Description

Base class for single and multi-threaded processor.

Definition at line 26 of file mlPageRequestProcessorBase.h.


Constructor & Destructor Documentation

ml::PageRequestProcessorBase::PageRequestProcessorBase ( Host host)
ml::PageRequestProcessorBase::~PageRequestProcessorBase ( )

Member Function Documentation

void ml::PageRequestProcessorBase::addNewCursor ( PageRequestCursor cursor) [protected]

add the new cursor

bool ml::PageRequestProcessorBase::createMoreWork ( bool  sleepWhenBlocked) [protected]

Creates more work items, returns true if new work was created.

void ml::PageRequestProcessorBase::enableTimeLineProfiling ( bool  flag)

Enable/disable time line profiling.

virtual void ml::PageRequestProcessorBase::enterProcessingScope ( ) [virtual]

Enters a recursive processing scope (always called from main thread!)

Implements ml::PageRequestProcessor.

Reimplemented in ml::MultiThreadedPageRequestProcessor.

virtual void ml::PageRequestProcessorBase::getAllPageRequestQueues ( std::vector< std::deque< PageRequest * > * > &  queues) [protected, virtual]

get all page request queues (to be derived when there are more than the GUI queues)

ProcessingTimeLine::TimeLine* ml::PageRequestProcessorBase::getOverviewTimeLine ( ) [inline]

Get access to the overview time line (only if time line profiling is on)

Definition at line 44 of file mlPageRequestProcessorBase.h.

int ml::PageRequestProcessorBase::getProcessingScope ( ) const [inline]

Return the current processing scope.

Definition at line 53 of file mlPageRequestProcessorBase.h.

ProcessingTimeLine& ml::PageRequestProcessorBase::getProcessingTimeLine ( ) [inline]

Get access to the processing time line.

Definition at line 41 of file mlPageRequestProcessorBase.h.

UserThreadData* ml::PageRequestProcessorBase::getUserThreadData ( PageRequest request,
PerThreadStorage perThreadStorage 
) [protected]

Gets or allocates the UserThreadData for the given request as part of the perThreadStorage.

virtual void ml::PageRequestProcessorBase::handleErrorsInGUIThread ( ) [protected, virtual]

handle all errors that have been accumulated

bool ml::PageRequestProcessorBase::isTimeLineProfilingEnabled ( ) const [inline]

Returns if time line profiling is enabled.

Definition at line 50 of file mlPageRequestProcessorBase.h.

virtual void ml::PageRequestProcessorBase::leaveProcessingScope ( ) [virtual]

Leaves a recursive processing scope (always called from main thread!)

Implements ml::PageRequestProcessor.

Reimplemented in ml::MultiThreadedPageRequestProcessor.

virtual void ml::PageRequestProcessorBase::removeCancelledRequests ( ) [virtual]

Removes all requests that are canceled and no longer needed.

Make sure to only call this from the GUI thread AND when you know that processing by other threads in not allowed at that point in time.

Implements ml::PageRequestProcessor.

void ml::PageRequestProcessorBase::setupCurrentProcessingScope ( ) [protected]

helper

virtual bool ml::PageRequestProcessorBase::supportsMultiThreading ( ) [pure virtual]

Returns if multi-threading is supported.

Implemented in ml::MultiThreadedPageRequestProcessor, and ml::SingleThreadedPageRequestProcessor.

void ml::PageRequestProcessorBase::terminateAllRequestsInGUIThread ( ) [protected]

terminate all requests


Member Data Documentation

the current scope pointer

Definition at line 135 of file mlPageRequestProcessorBase.h.

std::vector< std::vector<PageRequestCursor*> > ml::PageRequestProcessorBase::_cursors [protected]

The cursors that are handled by the producer thread, one list for each processing scope.

Definition at line 94 of file mlPageRequestProcessorBase.h.

The per thread storage for the GUI thread.

Definition at line 159 of file mlPageRequestProcessorBase.h.

the recursion of the GUI thread (0 = outer entry)

Definition at line 111 of file mlPageRequestProcessorBase.h.

optional pointer to the host

Definition at line 81 of file mlPageRequestProcessorBase.h.

the current processing scope (0 = BG tasks, 1 = normal get tile, >1 = recursive get tile

Definition at line 105 of file mlPageRequestProcessorBase.h.

how many cursors the producer contains in all lists

Definition at line 109 of file mlPageRequestProcessorBase.h.

the current cursor scope of the producer

Definition at line 107 of file mlPageRequestProcessorBase.h.

Timer used for progress update from GUI thread.

Definition at line 142 of file mlPageRequestProcessorBase.h.

the number of root tile requests, if this gets down to 0, we are done

Definition at line 90 of file mlPageRequestProcessorBase.h.

Stack of processing scopes for performance reasons, we only grow this stack, we never shrink it.

Definition at line 139 of file mlPageRequestProcessorBase.h.

flag if the calculation was terminated

Definition at line 84 of file mlPageRequestProcessorBase.h.

flag to know if producer produces work

Definition at line 87 of file mlPageRequestProcessorBase.h.


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