MeVisLab Toolbox Reference
ml::ImagingBackgroundTask Class Reference

#include <mlImagingBackgroundTask.h>

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

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. More...
 
virtual ~BackgroundTask ()
 
virtual void run ()=0
 run method that needs to be reimplemented (called from worker thread) More...
 
bool isSynchronous () const
 check if task is synchronous (which means it is NOT run in an extra thread) More...
 
void setSynchronous (bool flag)
 set if task is handled synchronous (call this ONLY on setup of the task, not while it is already running) More...
 
void setSynchronousCancelField (NotifyField *field)
 set a cancel field that is used in synchronous mode to check if cancel was pressed More...
 
Status status () const
 returns the status of the task (threadsafe) More...
 
void cancel ()
 cancel the task (sets status to canceled) (threadsafe, typically called from GUI) More...
 
bool isCanceled () const
 check if the task was canceled (threadsafe, typically called from GUI) More...
 
bool shouldStop ()
 returns if the task should stop its work because it has been canceled. More...
 
void resume ()
 resume task after it was suspended (will only do something if current status() is Suspended) (threadsafe) More...
 
void suspend ()
 suspend task, so that it will wait until resume() is called (threadsafe). More...
 
std::string statusString () const
 get current status string (threadsafe) More...
 
virtual void setStatusString (const std::string &status)
 update the status string while processing (from run() method only) More...
 
float progress () const
 get current progress (threadsafe) More...
 
virtual void setProgress (float progress)
 update the progress while processing (from run() method only) More...
 
void setOwnerWasDeleted ()
 tell the task that it's owner was deleted (only call from GUI thread!), this also cancels the task More...
 
bool hasOwner () const
 check if owner was deleted (only call from GUI thread!) More...
 
void * owner () const
 get the owner of the task (only call from GUI thread!) More...
 
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() More...
 
bool executeNextMessage ()
 execute the next message (does not block if no message is available) It returns true if there was a message to process. More...
 
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. More...
 
void logMessage (const std::string &message)
 log a message (only logged if verbose logging is turned on) (threadsafe) More...
 
bool isVerbose () const
 check if task uses verbose logging More...
 
void setVerbose (bool flag)
 set if task uses verbose logging (call this ONLY on setup of the task, not while it is already running) More...
 
double runningTime () const
 returns the running time (in seconds) of the task (after it has finished or canceled, only call from GUI thread) More...
 
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) More...
 
void getStatusInformation (BackgroundTaskStatusInformation &info)
 get the complete status information (threadsafe) More...
 
MLuint32 taskId () const
 get the unique id of this task, the id of a task never changes More...
 
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 More...
 
void addObserver (Observer *observer)
 add the given observer (threadsafe) (ownership stays with caller) More...
 
void removeObserver (Observer *observer)
 remove the given observer (threadsafe) (ownership stays with caller) More...
 

Protected Member Functions

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

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 Function Documentation

◆ AsyncTileRequest

friend class AsyncTileRequest
friend

Definition at line 106 of file mlImagingBackgroundTask.h.

◆ BackgroundTaskMLGetTileResultMessage

Definition at line 104 of file mlImagingBackgroundTask.h.

◆ BackgroundTaskMLProcessAllPagesResultMessage

Definition at line 105 of file mlImagingBackgroundTask.h.

◆ ProcessAllPagesRequest

friend class ProcessAllPagesRequest
friend

Definition at line 107 of file mlImagingBackgroundTask.h.


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