OpendTect-6_4  6.4
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
CallBack Class Reference

CallBacks object-oriented (object + method). More...

Public Member Functions

 CallBack (CallBacker *o=0, CallBackFunction f=0)
 
 CallBack (StaticCallBackFunction f)
 
int operator== (const CallBack &c) const
 
int operator!= (const CallBack &cb) const
 
bool willCall () const
 
void doCall (CallBacker *) const
 
CallBackercbObj ()
 
const CallBackercbObj () const
 
CallBackFunction cbFn () const
 
StaticCallBackFunction scbFn () const
 

Static Public Member Functions

static void initClass ()
 
static bool addToMainThread (const CallBack &, CallBacker *=0)
 
static bool callInMainThread (const CallBack &, CallBacker *=0)
 
static void removeFromMainThread (const CallBacker *)
 
static bool queueIfNotInMainThread (CallBack, CallBacker *=0)
 

Protected Attributes

CallBackerobj_
 
CallBackFunction fn_
 
StaticCallBackFunction sfn_
 

Detailed Description

CallBacks object-oriented (object + method).

CallBack is nothing more than a function pointer + optionally an object to call it on. It may be null, in which case doCall() will simply do nothing. If you want to be able to send a CallBack, you must provide a 'sender' CallBacker* (usually 'this').

Constructor & Destructor Documentation

CallBack::CallBack ( CallBacker o = 0,
CallBackFunction  f = 0 
)
inline
CallBack::CallBack ( StaticCallBackFunction  f)
inline

Member Function Documentation

static bool CallBack::addToMainThread ( const CallBack ,
CallBacker = 0 
)
static

Unconditionally add this to main event loop. For thread safety, the removeFromMainThread() must be called in the destructor.

static bool CallBack::callInMainThread ( const CallBack ,
CallBacker = 0 
)
static

If in main thread or no event-loop is present, it will be called directly. Otherwise, it will be put on event loop. For thread safety, the removeFromMainThread() must be called in the destructor.

Returns
true if the callback was called directly.
CallBackFunction CallBack::cbFn ( ) const
inline
CallBacker* CallBack::cbObj ( )
inline
const CallBacker* CallBack::cbObj ( ) const
inline
void CallBack::doCall ( CallBacker ) const
static void CallBack::initClass ( )
static
int CallBack::operator!= ( const CallBack cb) const
inline
int CallBack::operator== ( const CallBack c) const
inline
static bool CallBack::queueIfNotInMainThread ( CallBack  ,
CallBacker = 0 
)
static

If not in main thread, queue it. return whether CB was queued.

static void CallBack::removeFromMainThread ( const CallBacker )
static
StaticCallBackFunction CallBack::scbFn ( ) const
inline
bool CallBack::willCall ( ) const
inline

Member Data Documentation

CallBackFunction CallBack::fn_
protected
CallBacker* CallBack::obj_
protected
StaticCallBackFunction CallBack::sfn_
protected

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