Classic ML host used internally to calculate getTile and processAllPages requests.
More...
#include <mlClassicHost.h>
|
MLErrorCode | _processPagesHelper (PagedImage &outputImage, const SubImageBox &location, MLDataType dataType, void *data, const ScaleShiftData &scaleShiftData, bool calledByProcessAllPages) |
| Helper function doing the real page processing work for processAllPages or getTile methods.
|
|
MLErrorCode | _getTileCore (PagedImage &outputImage, SubImageBox location, MLDataType dataType, void *data, const ScaleShiftData &scaleShiftData) |
| Core of the getTile method: It fills a chunk of memory assuming that it has the correct size.
|
|
void | _initializePageData (ThreadDataClass &tData, bool permitInCaching) |
| Initializes the buffer tData with all settings which is needed to compute one output page.
|
|
ThreadDataClass ** | _getWorkForWorkerThread (size_t workIndex) |
| Returns the work for worker thread with workIndex .
|
|
void | _increaseErrorCounter () |
| Increases the error counter (threadsafe).
|
|
|
void | _calcPages (PagedImage &outputImage, const std::vector< MLint > pageIDs, MLMemoryBlockHandle *memoryBlockHandles) |
| For the output image outputImage , all invalid pages with numbers given by pageIDs are calculated.
|
|
Classic ML host used internally to calculate getTile and processAllPages requests.
Definition at line 38 of file mlClassicHost.h.
◆ ClassicHost()
ml::ClassicHost::ClassicHost |
( |
Host * | host | ) |
|
◆ ~ClassicHost()
ml::ClassicHost::~ClassicHost |
( |
| ) |
|
◆ _calcPages()
For the output image outputImage
, all invalid pages with numbers given by pageIDs
are calculated.
Errors throw exceptions.
Notes:
- An image is composed by many rectangular/box-like pages which are numbered and addressed like voxels (see classes PagedImage).
- The Host works page based, i.e., it must know page numbers and PagedImage must not encapsulate pages.
- The Host works with untyped and sequential subimages and manages them with SubImage wrappers. These subimages will be composed of pages and passed as module inputs; module outputs will then be a page which again can be part of a subimage passed to the next module input.
- A recursion counter is passed for testing purposes and to call certain function after everything has finished.
- Errors are thrown as exceptions, either as controlled (allowed) MLErrorCode exceptions or as other exceptions which indicate an uncontrolled worst case crash.
◆ _calcPagesMT()
Calculates a sequence of output pages where each one has a set of input pages.
For each page all necessary input/output/buffering information must have been initialized in initializePageData before.
◆ _getTileCore()
Core of the getTile method: It fills a chunk of memory assuming that it has the correct size.
Updating memory outputs of output images is optionally. Not to be called directly by users!
◆ _getWorkForWorkerThread()
ThreadDataClass ** ml::ClassicHost::_getWorkForWorkerThread |
( |
size_t | workIndex | ) |
|
|
protected |
Returns the work for worker thread with workIndex
.
◆ _increaseErrorCounter()
void ml::ClassicHost::_increaseErrorCounter |
( |
| ) |
|
|
protected |
Increases the error counter (threadsafe).
◆ _initializePageData()
void ml::ClassicHost::_initializePageData |
( |
ThreadDataClass & | tData, |
|
|
bool | permitInCaching ) |
|
protected |
Initializes the buffer tData
with all settings which is needed to compute one output page.
permitInCaching
must be set true only for one (the last) thread data container if many threads are calculated in parallel. Otherwise more than one thread would modify the memory output of an input.
◆ _processPagesHelper()
Helper function doing the real page processing work for processAllPages or getTile methods.
If the parameter calledByProcessedAllPages is true: Requests the image region loc from outputIndex
of the module
. The image data will be stored at memory address data as dataType
. The data will be scaled linearly dependent on the settings of the scaleShiftData
(see ScaleShiftData).
If the parameter calledByProcessedAllPages is false: Requests the image region location
from outputIndex
of the module
. Values of data
, scaleShiftData
and dataType
are ignored.
◆ enableTimeLineProfiling()
void ml::ClassicHost::enableTimeLineProfiling |
( |
bool | flag | ) |
|
|
inline |
◆ getProcessingTimeLine()
Get access to the processing time line.
Definition at line 90 of file mlClassicHost.h.
◆ getTile()
Requests the image region location
from the image outputImage
.
If *data
is a non NULL pointer, it must be large enough to hold the entire requested image data. If *data
is NULL, the getTile function will allocate enough memory for the image data. The image data will be stored in that memory as data type dataType
. The data will be scaled linearly dependent on the settings of the scaleShiftData (see ScaleShiftData). The return value data then pointer to the allocated memory. IMPORTANT: Memory allocated with any Host::getTile function must be freed with the Host::freeTile function or with the corresponding mapped freeTile function of the class Module.
◆ processAllPages()
Internal implementation of processAllPages functionality.
◆ shutdownWorkerThreads()
void ml::ClassicHost::shutdownWorkerThreads |
( |
| ) |
|
Shuts down and frees all worker threads (all threads are joined when this method returns).
◆ CalcPagesWorkerThreadFunction
friend struct CalcPagesWorkerThreadFunction |
|
friend |
◆ _countSyncMutex
Mutex ml::ClassicHost::_countSyncMutex |
|
protected |
A mutex used at many position for safe manipulations of members in the host instance by threads.
Typically for changing counters etc.
Definition at line 214 of file mlClassicHost.h.
◆ _errorCounter
MLint32 ml::ClassicHost::_errorCounter |
|
protected |
Counter for errors detected in calcPagesMT, usually in different threads. Only valid during thread calculations.
Definition at line 217 of file mlClassicHost.h.
◆ _guiTimeLine
◆ _host
Host* ml::ClassicHost::_host |
|
protected |
◆ _maxNumPagesToCalculateInSingleWorkerThread
size_t ml::ClassicHost::_maxNumPagesToCalculateInSingleWorkerThread |
|
protected |
The maximum number of pages that a single worker thread will calculate.
Definition at line 226 of file mlClassicHost.h.
◆ _numFinishedThreads
MLint32 ml::ClassicHost::_numFinishedThreads |
|
protected |
Counter for the number of already finished threads. Only valid during thread calculations.
Definition at line 220 of file mlClassicHost.h.
◆ _numLaunchedThreads
MLint32 ml::ClassicHost::_numLaunchedThreads |
|
protected |
Counter for the number of really launched threads. Only valid during thread calculations.
Definition at line 223 of file mlClassicHost.h.
◆ _profile
◆ _shutdownWorkerThreadsFlag
bool ml::ClassicHost::_shutdownWorkerThreadsFlag |
|
protected |
Flag that signals that the worker threads should shutdown.
Definition at line 210 of file mlClassicHost.h.
◆ _useTimeLineProfiling
bool ml::ClassicHost::_useTimeLineProfiling |
|
protected |
◆ _workAvailable
A wait condition to signal waiting worker threads that there is more work to be done.
Definition at line 195 of file mlClassicHost.h.
◆ _workAvailableMutex
Mutex ml::ClassicHost::_workAvailableMutex |
|
protected |
Mutex that protects the work assignment to the worker threads.
Definition at line 201 of file mlClassicHost.h.
◆ _workDone
A wait condition that signals that all threads have done their work.
Definition at line 198 of file mlClassicHost.h.
◆ _workerThreadClassData
std::vector<ThreadDataClass**> ml::ClassicHost::_workerThreadClassData |
|
protected |
The offset into the current ThreadDataClass array, sorted by worker threads.
Definition at line 207 of file mlClassicHost.h.
◆ _workerThreads
std::vector<Thread*> ml::ClassicHost::_workerThreads |
|
protected |
The worker threads that are currently started.
Definition at line 204 of file mlClassicHost.h.
◆ _workerThreadTimeLines
The documentation for this class was generated from the following file: