Base abstract class for observers registered in ProgressStatus. More...
#include <cadex/Base/ProgressStatus.hxx>
Public Member Functions | |
Observer () | |
Constructor. | |
virtual void | ChangedValue (const ProgressStatus &theStatus)=0 |
A callback called when the progress status has changed its value. | |
virtual void | Completed (const ProgressStatus &theStatus)=0 |
A callback called when the progress status object is being destructed. | |
virtual void | Canceled (const ProgressStatus &theStatus) |
A callback called when the progress status object was set to the canceled state. | |
void | SetNotifyingThread () |
Sets the current thread as the only thread sending notifications. | |
void | SetNotifyingThread (const Observer &theOther) |
Sets the same notification thread as used by theOther observer. | |
void | SetAllNotifyingThreads () |
Enables sending notifications from any thread. | |
bool | CanBeNotifiedFromThisThread () const |
Returns true if notifications can be send from the current thread. | |
Base abstract class for observers registered in ProgressStatus.
Subclasses must redefined virtual functions ChangedValue() and Completed(). User-defined observers must be registered in the progress status object with the help of ProgressStatus::Register().
By default the observer will only be notified in the same thread it was created. This is to minimize a risk of data race in multi-threaded applications if the user-defined observer is not thread-safe. To enable notifications from other threads use SetAllNotifyingThreads() to allow notifications from any thread or different syntaxes of SetNotifyingThread() to enable notifications from single thread.
cadex::ProgressStatus::Observer::Observer | ( | ) |
Constructor.
Default constructor.
|
virtual |
A callback called when the progress status object was set to the canceled state.
This callback is called when ProgressStatus::Cancel() was called. Default implementation is empty.
|
pure virtual |
A callback called when the progress status has changed its value.
Subclasses must redefine this method to process this event.
|
pure virtual |
A callback called when the progress status object is being destructed.
Subclasses must redefine this method to process this event.