OpendTect  7.0
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Threads::Work Class Reference

The abstraction of something that can be done. It can be an ordinary CallBack, a static function (must return bool) or a TaskFunction on a CallBackerinheriting class, or a Task. The three examples are shown below. More...

Public Member Functions

 Work ()
 
 Work (CallBacker *o, TaskFunction f)
 
 Work (const CallBack &)
 
 Work (StaticTaskFunction f)
 
 Work (Task &t, bool takeover)
 
uiString errMsg () const
 
bool execute ()
 
const TaskgetTask () const
 
bool isOK () const
 
bool operator== (const Work &) const
 

Private Member Functions

void destroy ()
 

Private Attributes

CallBackFunction cbf_
 
uiString msg_
 
CallBackerobj_
 
StaticTaskFunction stf_
 
bool takeover_ =false
 
TaskFunction tf_
 

Friends

class WorkManager
 
class WorkThread
 

Detailed Description

The abstraction of something that can be done. It can be an ordinary CallBack, a static function (must return bool) or a TaskFunction on a CallBackerinheriting class, or a Task. The three examples are shown below.

mExpClass(Basic) MyClass : public CallBacker
{
void normalCallBack(CallBacker*);
bool taskFunction();
static bool staticFunc();
};
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:184

Calls to normalCallBack and task functions can be invoked as:

Work(mCB(this,MyClass,normalCallBack) ) );
static Threads::WorkManager & twm()
void addWork(const Work &, CallBack *finished=0, int queueid=cDefaultQueueID(), bool putfirstinline=false, bool discardduplicates=false, bool forcedifferentthread=false)
Work()
Definition: threadwork.h:225

or

Threads::WorkManager::twm().addWork( mWMT(this,MyClass,taskFunction));

or

Threads::WorkManager::twm().addWork( Work( &MyClass::staticFunc) );

You can also add Tasks, with the option that they may be deleted when the work is done, or if there is an error.

<>

Constructor & Destructor Documentation

◆ Work() [1/5]

Threads::Work::Work ( )
inline

◆ Work() [2/5]

Threads::Work::Work ( const CallBack cb)
inline

◆ Work() [3/5]

Threads::Work::Work ( CallBacker o,
TaskFunction  f 
)
inline

◆ Work() [4/5]

Threads::Work::Work ( StaticTaskFunction  f)
inline

◆ Work() [5/5]

Threads::Work::Work ( Task t,
bool  takeover 
)
inline

Member Function Documentation

◆ destroy()

void Threads::Work::destroy ( )
private

◆ errMsg()

uiString Threads::Work::errMsg ( ) const
inline

◆ execute()

bool Threads::Work::execute ( )
inline

◆ getTask()

const Task * Threads::Work::getTask ( ) const
inline

◆ isOK()

bool Threads::Work::isOK ( ) const
inline

◆ operator==()

bool Threads::Work::operator== ( const Work ) const

Friends And Related Function Documentation

◆ WorkManager

friend class WorkManager
friend

◆ WorkThread

friend class WorkThread
friend

Member Data Documentation

◆ cbf_

CallBackFunction Threads::Work::cbf_
private

◆ msg_

uiString Threads::Work::msg_
private

◆ obj_

CallBacker* Threads::Work::obj_
private

◆ stf_

StaticTaskFunction Threads::Work::stf_
private

◆ takeover_

bool Threads::Work::takeover_ =false
private

◆ tf_

TaskFunction Threads::Work::tf_
private

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024