MeVisLab Toolbox Reference
ml::ImagingBackgroundTask Class Reference

#include <mlImagingBackgroundTask.h>

Inheritance diagram for ml::ImagingBackgroundTask:
ml::MessagingBackgroundTask ml::BackgroundTask ml::ModuleBackgroundTask ml::ProcessAllPagesBackgroundTask

Classes

class  AsyncTileRequest
 an asynchronous tile request (copyable!) More...
 
class  ProcessAllPagesRequest
 an asynchronous process all pages request (copyable!) More...
 

Public Types

enum  TileRequestFlags {
  UseMemoryManager = TileRequest::UseMemoryManager , UseMLAlloc = TileRequest::UseMLAlloc , NoAllocation = TileRequest::NoAllocation , ExternalBuffer = TileRequest::ExternalBuffer ,
  AllocationPolicyMask = 0xf , RequestReadOnlyPage = 16 , ReceiveProgressMessages = 32
}
 Defines flags that can be passed with requestTile(). NOTE: Only one of the allocation schemes can be used at a time. More...
 
- Public Types inherited from ml::BackgroundTask
enum  Status {
  NotInTaskManager , Queued , Running , Finished ,
  Canceled , Suspended
}
 Defines current status of the task. More...
 

Public Member Functions

 ImagingBackgroundTask (void *owner)
 
 ~ImagingBackgroundTask () override
 
- Public Member Functions inherited from ml::MessagingBackgroundTask
 MessagingBackgroundTask (void *ownerArg)
 
template<typename Object , typename Method >
void callMethodOnGUI (const DistantObject< Object > &target, Method method)
 
template<typename Object , typename Method , typename Arg1 >
void callMethodOnGUI (const DistantObject< Object > &target, Method method, const Arg1 &arg1)
 
template<typename Object , typename Method , typename Arg1 , typename Arg2 >
void callMethodOnGUI (const DistantObject< Object > &target, Method method, const Arg1 &arg1, const Arg2 &arg2)
 
template<typename Object , typename Method , typename Arg1 , typename Arg2 , typename Arg3 >
void callMethodOnGUI (const DistantObject< Object > &target, Method method, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
 
template<typename Object , typename Method , typename Arg1 , typename Arg2 , typename Arg3 , typename Arg4 >
void callMethodOnGUI (const DistantObject< Object > &target, Method method, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
 
template<typename Object , typename Method , typename Arg1 , typename Arg2 , typename Arg3 , typename Arg4 , typename Arg5 >
void callMethodOnGUI (const DistantObject< Object > &target, Method method, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
 
- Public Member Functions inherited from ml::BackgroundTask
 BackgroundTask (void *owner)
 Create a new task with given owner (the owner can be used to associate the task with a given class instance, e.g.
 
virtual ~BackgroundTask ()
 
virtual void run ()=0
 run method that needs to be reimplemented (called from worker thread)
 
bool isSynchronous () const
 check if task is synchronous (which means it is NOT run in an extra thread)
 
void setSynchronous (bool flag)
 set if task is handled synchronous (call this ONLY on setup of the task, not while it is already running)
 
void setSynchronousCancelField (NotifyField *field)
 set a cancel field that is used in synchronous mode to check if cancel was pressed
 
Status status () const
 returns the status of the task (threadsafe)
 
void cancel ()
 cancel the task (sets status to canceled) (threadsafe, typically called from GUI)
 
bool isCanceled () const
 check if the task was canceled (threadsafe, typically called from GUI)
 
bool shouldStop ()
 returns if the task should stop its work because it has been canceled.
 
void resume ()
 resume task after it was suspended (will only do something if current status() is Suspended) (threadsafe)
 
void suspend ()
 suspend task, so that it will wait until resume() is called (threadsafe).
 
std::string statusString () const
 get current status string (threadsafe)
 
virtual void setStatusString (const std::string &status)
 update the status string while processing (from run() method only)
 
float progress () const
 get current progress (threadsafe)
 
virtual void setProgress (float progress)
 update the progress while processing (from run() method only)
 
void setOwnerWasDeleted ()
 tell the task that it's owner was deleted (only call from GUI thread!), this also cancels the task
 
bool hasOwner () const
 check if owner was deleted (only call from GUI thread!)
 
voidowner () const
 get the owner of the task (only call from GUI thread!)
 
void waitAndExecuteNextMessage ()
 execute the next message (waits if no messages are available and processes the first message that is received) NOTE: only call from within run()
 
bool executeNextMessage ()
 execute the next message (does not block if no message is available) It returns true if there was a message to process.
 
void sendMessageToGUI (BackgroundTaskMessage *message)
 send the message to the GUI (ownership of message is passed to the method) and it sets the sender of the message to this BackgroundTask.
 
void logMessage (const std::string &message)
 log a message (only logged if verbose logging is turned on) (threadsafe)
 
bool isVerbose () const
 check if task uses verbose logging
 
void setVerbose (bool flag)
 set if task uses verbose logging (call this ONLY on setup of the task, not while it is already running)
 
double runningTime () const
 returns the running time (in seconds) of the task (after it has finished or canceled, only call from GUI thread)
 
double idleTime () const
 returns the idle time (in seconds) of the task (which it e.g. waited for getTile to complete), (after it has finished or canceled, only call from GUI thread)
 
void getStatusInformation (BackgroundTaskStatusInformation &info)
 get the complete status information (threadsafe)
 
MLuint32 taskId () const
 get the unique id of this task, the id of a task never changes
 
void setTaskFinishedCB (BackgroundTaskFinishedCB *callback, void *userdata)
 set this directly after initialization of the task (from the GUI thread) this callback will be called whenever a task is either finished or canceled
 
void addObserver (Observer *observer)
 add the given observer (threadsafe) (ownership stays with caller)
 
void removeObserver (Observer *observer)
 remove the given observer (threadsafe) (ownership stays with caller)
 

Protected Member Functions

BackgroundRequestId generateBackgroundRequestId ()
 generate next generateBackgroundRequestId()
 
- Protected Member Functions inherited from ml::BackgroundTask
void sendStatusChangedToObservers ()
 send the status change to all observers
 
void sendStatusStringChangedToObservers ()
 send the status string change to all observers
 
void sendLogMessageToObservers (const std::string &msg)
 send the status string change to all observers
 
void addIdleTime (double timeInSecs)
 add given timeInSecs as spent idle time
 

Friends

class BackgroundTaskMLGetTileResultMessage
 
class BackgroundTaskMLProcessAllPagesResultMessage
 
class AsyncTileRequest
 
class ProcessAllPagesRequest
 

Detailed Description

Definition at line 32 of file mlImagingBackgroundTask.h.

Member Enumeration Documentation

◆ TileRequestFlags

Defines flags that can be passed with requestTile(). NOTE: Only one of the allocation schemes can be used at a time.

Enumerator
UseMemoryManager 
UseMLAlloc 
NoAllocation 
ExternalBuffer 
AllocationPolicyMask 
RequestReadOnlyPage 
ReceiveProgressMessages 

Definition at line 42 of file mlImagingBackgroundTask.h.

Constructor & Destructor Documentation

◆ ImagingBackgroundTask()

ml::ImagingBackgroundTask::ImagingBackgroundTask ( void * owner)

◆ ~ImagingBackgroundTask()

ml::ImagingBackgroundTask::~ImagingBackgroundTask ( )
override

Member Function Documentation

◆ generateBackgroundRequestId()

BackgroundRequestId ml::ImagingBackgroundTask::generateBackgroundRequestId ( )
inlineprotected

generate next generateBackgroundRequestId()

Definition at line 99 of file mlImagingBackgroundTask.h.

Friends And Related Symbol Documentation

◆ AsyncTileRequest

friend class AsyncTileRequest
friend

Definition at line 106 of file mlImagingBackgroundTask.h.

◆ BackgroundTaskMLGetTileResultMessage

◆ BackgroundTaskMLProcessAllPagesResultMessage

◆ ProcessAllPagesRequest

friend class ProcessAllPagesRequest
friend

Definition at line 107 of file mlImagingBackgroundTask.h.


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