OpendTect
7.0
|
CallBacks object-oriented (object + method). More...
Public Member Functions | |
CallBack () | |
CallBack (CallBacker *o, CallBackFunction f) | |
CallBack (StaticCallBackFunction f) | |
CallBackFunction | cbFn () const |
CallBacker * | cbObj () |
const CallBacker * | cbObj () const |
void | disable (bool yn=true) const |
void | doCall (CallBacker *) const |
void | enable () const |
bool | isDisabled () const |
bool | operator!= (const CallBack &) const |
bool | operator== (const CallBack &) const |
StaticCallBackFunction | scbFn () const |
bool | willCall () const |
Static Public Member Functions | |
static bool | addToMainThread (const CallBack &, CallBacker *=nullptr) |
static bool | addToThread (Threads::ThreadID, const CallBack &, CallBacker *=nullptr) |
static bool | callInMainThread (const CallBack &, CallBacker *=nullptr) |
static void | initClass () |
static bool | queueIfNotInMainThread (CallBack, CallBacker *=nullptr) |
static void | removeFromMainThread (const CallBacker *cber) |
static void | removeFromThreadCalls (const CallBacker *) |
Private Attributes | |
CallBacker * | cberobj_ |
Threads::Atomic< int > | disablecount_ |
CallBackFunction | fn_ |
StaticCallBackFunction | sfn_ |
Static Private Attributes | |
static Threads::ThreadID | mainthread_ |
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').
You can disable a CallBack, but if you do make sure you enable it again using disable(false), as it works with a counter (so that disabling can be nested).
<>
|
inline |
|
inline |
|
inline |
|
static |
Unconditionally add this to main event loop. For thread safety, the removeFromThreadCalls() must be called in the destructor.
|
static |
Unconditionally add this to event loop of the other thread. For thread safety, the removeFromThreadCalls() must be called in the destructor.
|
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 removeFromThreadCalls() must be called in the destructor.
|
inline |
|
inline |
|
inline |
void CallBack::disable | ( | bool | yn = true | ) | const |
void CallBack::doCall | ( | CallBacker * | ) | const |
|
inline |
|
static |
|
inline |
bool CallBack::operator!= | ( | const CallBack & | ) | const |
bool CallBack::operator== | ( | const CallBack & | ) | const |
|
static |
If not in main thread, queue it. return whether CB was queued.
|
inlinestatic |
|
static |
|
inline |
bool CallBack::willCall | ( | ) | const |
|
private |
|
mutableprivate |
|
private |
|
staticprivate |
|
private |
Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024