13#ifndef ML_BACKGROUND_TASK_MODULE_HANDLER_H
14#define ML_BACKGROUND_TASK_MODULE_HANDLER_H
26class BackgroundTaskBaseModule;
105 void preTaskFinished();
#define MLBACKGROUNDTASKS_EXPORT
Project global and OS specific declarations.
Base class for ML modules that use background tasks.
A handle to a task that has been created by the background task manager.
BoolField * getTaskVerboseLoggingField()
BoolField * getTaskRunningField()
StringField * getTaskStatusField()
void setTaskCanceledField(NotifyField *taskCanceledField)
void startTask()
Start a task with mode Asynchronous.
virtual void handleTaskFieldNotification(Field *field)
Handle field changes of the field field.
void cancelTask()
Cancel a task if it is currently running.
NotifyField * _taskFinished
void setTaskProgressField(FloatField *progressField)
bool willRestartTask()
Returns if the task will be restarted after the previous task has been canceled.
virtual void taskFinished(BackgroundTask *task)
Callback for finished/canceled tasks (to be derived, make sure to call parent method).
NotifyField * _cancelTask
void setRestartTask(bool flag)
Set if the task should be restarted after the previous task finishes.
NotifyField * getTaskFinishedField()
virtual void postTaskFinished()
Called after taskFinished() has been called and can be used to handle the restarting of a task.
virtual ~BackgroundTaskModuleHandler()
ExecutionMode
Execution mode of background tasks.
@ Synchronous
Execute the background task synchronously.
void startTask(const ExecutionMode mode)
Start a task with user specifying the mode (Synchronous or Asynchronous).
NotifyField * _startTaskSynchronous
bool hasRunningTask()
Returns if a task is currently running (and not yet canceled).
FloatField * getTaskProgressField()
virtual void setupTaskFields(Module *module)
BoolField * _taskVerboseLogging
NotifyField * getTaskCanceledField()
NotifyField * getCancelTaskField()
NotifyField * getStartTaskField()
virtual void updateFinishedTaskStatus(BackgroundTask *task)
Updates the status and progress field of a finished task, is called by taskFinished and may be reimpl...
virtual ModuleBackgroundTask * createTask()=0
Request a new task to be created, reimplement this method and make sure that you keep no reference to...
NotifyField * _taskCanceled
void setTaskRunningField(BoolField *taskRunningField)
void setTaskFinishedField(NotifyField *taskFinishedField)
BackgroundTaskModuleHandler()
NotifyField * getStartTaskSynchronousField()
void setTaskStatusField(StringField *statusField)
Base class for a task that is started in an extra thread.
Field to encapsulate a boolean value.
Base class for all fields used in the ML.
Field to encapsulate a float value.
ModuleBackgroundTask extends the ImagingBackgroundTask with a number of useful methods that allow asy...
Base class for an image processing module of the ML.
Field without value for notifications.
Field to encapsulate a string value.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.