Base abstract class for observers registered in Base_ProgressStatus. More...
#include <cadex/Base_ProgressStatus.hxx>
Inherited by cadex::internal::Base_InterprocessClient::ProgressStatusObserver, cadex::internal::Base_InterprocessServer< Executor >::ProgressStatusObserver, and cadex::internal::CadExModelXDEBrowser_ProgressBarObserver.
Public Member Functions | |
Observer () | |
Constructor. | |
Observer (const Observer &theOther) | |
Constructor. | |
virtual | ~Observer () |
Destructor. | |
Observer & | operator= (const Observer &theOther) |
Assignment operator. | |
virtual void | ChangedValue (const Base_ProgressStatus &theStatus)=0 |
A callback called when the progress status has changed its value. | |
virtual void | Completed (const Base_ProgressStatus &theStatus)=0 |
A callback called when the progress status object is being destructed. | |
virtual void | Canceled (const Base_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 Base_ProgressStatus.
Subclasses must redefined virtual functions ChangedValue() and Completed(). User-defined observers must be registered in the progress status object with the help of Base_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::Base_ProgressStatus::Observer::Observer | ( | ) |
Constructor.
Default constructor.
cadex::Base_ProgressStatus::Observer::Observer | ( | const Observer & | theOther | ) |
Constructor.
Copy constructor.
|
virtual |
A callback called when the progress status object was set to the canceled state.
This callback is called when Base_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.
void cadex::Base_ProgressStatus::Observer::SetAllNotifyingThreads | ( | ) |
Enables sending notifications from any thread.
void cadex::Base_ProgressStatus::Observer::SetNotifyingThread | ( | ) |
Sets the current thread as the only thread sending notifications.
void cadex::Base_ProgressStatus::Observer::SetNotifyingThread | ( | const Observer & | theOther | ) |
Sets the same notification thread as used by theOther observer.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.