Drag[en]gine Game Engine  1.0
deParallelTask Class Referenceabstract

Parallel processing task. More...

#include <deParallelTask.h>

Inheritance diagram for deParallelTask:
deObject

Public Member Functions

Constructors and Destructors
 deParallelTask ()
 Create task. More...
 
virtual ~deParallelTask ()
 Clean up task. More...
 
Management
bool IsCancelled () const
 Task has been cancelled. More...
 
void Cancel ()
 Cancel task. More...
 
bool GetFinished () const
 Task is finished. More...
 
void SetFinished ()
 Set task finished. More...
 
deParallelTaskGetDependsOn () const
 Task this task depends on or NULL if there is none. More...
 
void SetDependsOn (deParallelTask *task)
 Set task this task depends on or NULL if there is none. More...
 
decObjectOrderedSetGetDependedOnBy ()
 List of tasks depending on this task. More...
 
const decObjectOrderedSetGetDependedOnBy () const
 
void RemoveFromAllDependedOnTasks ()
 Remove from all tasks depending on this task. More...
 
void Reset ()
 Reset task. More...
 
Subclass Responsibility
virtual void Run ()=0
 Parallel task implementation. More...
 
virtual void Finished ()=0
 Synchronous processing of task Run() finished. More...
 
- Public Member Functions inherited from deObject
int GetRefCount () const
 Reference count. More...
 
void AddReference ()
 Add reference increasing reference count by 1. More...
 
void FreeReference ()
 Decrease reference count by one and delete object if count reaches 0. More...
 
 deObject ()
 Create object with reference count of 1. More...
 

Additional Inherited Members

- Protected Member Functions inherited from deObject
virtual ~deObject ()
 Clean up object. More...
 

Detailed Description

Parallel processing task.

Subclass to implement task to run. Tasks have to finished as quick as possible to allow for best throughput. Guards can be implemented it tasks depend on the result of other tasks.

Author
Pl├╝ss Roland
Version
1.0
Date
2015

Constructor & Destructor Documentation

◆ deParallelTask()

deParallelTask::deParallelTask ( )

Create task.

◆ ~deParallelTask()

virtual deParallelTask::~deParallelTask ( )
virtual

Clean up task.

Member Function Documentation

◆ Cancel()

void deParallelTask::Cancel ( )

Cancel task.

Call from the main thread to cancel a task. A cancelled task does not call Finished() or Run() if still pending.

Referenced by IsCancelled().

◆ Finished()

virtual void deParallelTask::Finished ( )
pure virtual

Synchronous processing of task Run() finished.

Called after the task has finished and has been collected by deParallelProcessing::Update(). This call runs synchronously in the main engine thread. You have to check using IsCancelled() if the task has been cancelled or finished successfully. Finished() will be called in all circumstances to allow proper cleaning up.

Referenced by GetDependedOnBy().

◆ GetDependedOnBy() [1/2]

decObjectOrderedSet& deParallelTask::GetDependedOnBy ( )
inline

List of tasks depending on this task.

Used by deParallelProcessing only.

◆ GetDependedOnBy() [2/2]

const decObjectOrderedSet& deParallelTask::GetDependedOnBy ( ) const
inline

◆ GetDependsOn()

deParallelTask* deParallelTask::GetDependsOn ( ) const
inline

Task this task depends on or NULL if there is none.

References SetDependsOn().

◆ GetFinished()

bool deParallelTask::GetFinished ( ) const
inline

Task is finished.

Used by deParallelProcessing only.

References SetFinished().

◆ IsCancelled()

bool deParallelTask::IsCancelled ( ) const
inline

Task has been cancelled.

References Cancel().

◆ RemoveFromAllDependedOnTasks()

void deParallelTask::RemoveFromAllDependedOnTasks ( )

Remove from all tasks depending on this task.

Used by deParallelProcessing only.

Referenced by GetDependedOnBy().

◆ Reset()

void deParallelTask::Reset ( )

Reset task.

Used only by deParallelProcessing.

Referenced by GetDependedOnBy().

◆ Run()

virtual void deParallelTask::Run ( )
pure virtual

Parallel task implementation.

Referenced by GetDependedOnBy().

◆ SetDependsOn()

void deParallelTask::SetDependsOn ( deParallelTask task)

Set task this task depends on or NULL if there is none.

Exceptions
deeInvalidParamtask is this task.

Referenced by GetDependsOn().

◆ SetFinished()

void deParallelTask::SetFinished ( )

Set task finished.

Used by deParallelProcessing only.

Referenced by GetFinished().


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