Workspace 6.21.5
Public Types | Signals | Public Member Functions | Protected Member Functions | List of all members
Task Class Referenceabstract

The base class of a runnable task.

#include <Workspace/DataExecution/Execution/task.h>

Inheritance diagram for Task:
[legend]

Public Types

enum  State {
  Dormant , Scheduled , Running , Aborted ,
  Finished
}
 
enum  TaskBehaviour { GrowThreadPool = 0x01 , AutoDelete = 0x02 , RunRemotely = 0x04 }
 

Signals

void aborted ()
 
void finished ()
 
void started ()
 

Public Member Functions

 Task (bool growThreadPool, bool autoDelete, bool runRemotely)
 
 Task (TaskBehaviours behaviours)
 
 ~Task () override
 
State getState () const
 
bool getSupportsRemoteExecution () const
 
virtual void moveToMainThread ()
 
 Q_DECLARE_FLAGS (TaskBehaviours, TaskBehaviour)
 
void run () override
 
void setState (State)
 
void setSupportsRemoteExecution (bool)
 

Protected Member Functions

virtual void doTask ()=0
 

Member Enumeration Documentation

◆ State

enum State

Enumerates Task states.

Enumerator
Dormant 
Scheduled 
Running 
Aborted 
Finished 

◆ TaskBehaviour

Enumerator
GrowThreadPool 
AutoDelete 
RunRemotely 

Constructor & Destructor Documentation

◆ Task() [1/2]

Task ( TaskBehaviours  behaviours)
explicit

Constructs a Task.

Parameters
behavioursIf GrowThreadPool set, requests the TaskQueue grow by an additional thread. If AutoDelete set, requests the TaskQueue destroy the Task on completion of the task. If RunRemotely set, requests the TaskQueue run remotely if posible.

◆ Task() [2/2]

Task ( bool  growThreadPool,
bool  autoDelete,
bool  runRemotely 
)
explicit

Constructs a Task.

Parameters
growThreadPoolIf set, requests the TaskQueue grow by an additional thread
autoDeleteIf set, requests the TaskQueue destroy the Task on completion of the task
runRemotelyIf set, requests the TaskQueue run remotely if posible.

◆ ~Task()

~Task ( )
override

Task destructor

Member Function Documentation

◆ aborted

void aborted ( )
signal

◆ doTask()

virtual void doTask ( )
protectedpure virtual

Performs the work associated with a task. This should be overridden by each task.

Implemented in Updater.

◆ finished

void finished ( )
signal

◆ getState()

Task::State getState ( ) const
Returns
The Task's current state.

◆ getSupportsRemoteExecution()

bool getSupportsRemoteExecution ( ) const

Indicates if the task is suitable for remote execution

Returns
True if suitable for remote execution and false if it should be run locally.

◆ moveToMainThread()

void moveToMainThread ( )
virtual

Reimplemented in Updater.

◆ Q_DECLARE_FLAGS()

Q_DECLARE_FLAGS ( TaskBehaviours  ,
TaskBehaviour   
)

◆ run()

void run ( )
override

The inherited Task run() method which calls the overrideable doTask() method.

◆ setState()

void setState ( State  state)

Sets the task's state.

Parameters
statethe task state.

◆ setSupportsRemoteExecution()

void setSupportsRemoteExecution ( bool  val)

Indicates if the task is suitable for remote execution

Parameters
valTrue if suitable for remote execution and false if it should be run locally.

◆ started

void started ( )
signal