Mantid
|
Observes Algorithm notifications: start,progress,finish,error. More...
#include <AlgorithmObserver.h>
Public Member Functions | |
AlgorithmObserver () | |
Default constructor. More... | |
AlgorithmObserver (const IAlgorithm_const_sptr &alg) | |
Constructs AlgorithmObserver and connects all its handlers to algorithm alg. More... | |
virtual void | errorHandle (const IAlgorithm *alg, const std::string &what) |
virtual void | finishHandle (const IAlgorithm *alg) |
void | observeAll (const IAlgorithm_const_sptr &alg) |
Connect to algorithm alg and observe all its notifications. More... | |
void | observeError (const IAlgorithm_const_sptr &alg) |
Connect to algorithm alg and observe its error notification. More... | |
void | observeFinish (const IAlgorithm_const_sptr &alg) |
Connect to algorithm alg and observe its finish notification. More... | |
void | observeProgress (const IAlgorithm_const_sptr &alg) |
Connect to algorithm alg and observe its progress notification. More... | |
void | observeStart (const IAlgorithm_const_sptr &alg) |
Connect to algorithm alg and observe its start notification. More... | |
void | observeStarting () |
Connect to AlgorithmManager and observe its starting notifications. More... | |
virtual void | progressHandle (const IAlgorithm *alg, double p, const std::string &msg, const double estimatedTime, const int progressPrecision) |
virtual void | startHandle (const IAlgorithm *alg) |
virtual void | startingHandle (IAlgorithm_sptr alg) |
void | stopObserving (const IAlgorithm_const_sptr &alg) |
Disconnect from algorithm alg. More... | |
void | stopObserving (const Mantid::API::IAlgorithm *alg) |
void | stopObservingManager () |
Disconnect from the algorithm manager. More... | |
virtual | ~AlgorithmObserver () |
Virtual destructor. More... | |
Private Member Functions | |
void | _errorHandle (const Poco::AutoPtr< Algorithm::ErrorNotification > &pNf) |
Poco notification handler for Algorithm::ErrorNotification. More... | |
void | _finishHandle (const Poco::AutoPtr< Algorithm::FinishedNotification > &pNf) |
Poco notification handler for Algorithm::FinishedNotification. More... | |
void | _progressHandle (const Poco::AutoPtr< Algorithm::ProgressNotification > &pNf) |
Poco notification handler for Algorithm::ProgressNotification. More... | |
void | _startHandle (const Poco::AutoPtr< Algorithm::StartedNotification > &pNf) |
Poco notification handler for Algorithm::StartedNotification. More... | |
void | _startingHandle (const Poco::AutoPtr< AlgorithmStartingNotification > &pNf) |
Poco notification handler for API::AlgorithmStartingNotification. More... | |
Observes Algorithm notifications: start,progress,finish,error.
Hides Poco::Notification API from the user.
Definition at line 23 of file AlgorithmObserver.h.
Mantid::API::AlgorithmObserver::AlgorithmObserver | ( | ) |
Default constructor.
Notification handlers are not connected to any algorithm
Definition at line 19 of file AlgorithmObserver.cpp.
Mantid::API::AlgorithmObserver::AlgorithmObserver | ( | const IAlgorithm_const_sptr & | alg | ) |
Constructs AlgorithmObserver and connects all its handlers to algorithm alg.
alg | :: Algorithm to be observed |
Definition at line 30 of file AlgorithmObserver.cpp.
References observeAll().
|
virtualdefault |
Virtual destructor.
|
private |
Poco notification handler for Algorithm::ErrorNotification.
pNf | :: An pointer to the notification. |
Definition at line 171 of file AlgorithmObserver.cpp.
References errorHandle().
|
private |
Poco notification handler for Algorithm::FinishedNotification.
pNf | :: An pointer to the notification. |
Definition at line 164 of file AlgorithmObserver.cpp.
References finishHandle().
|
private |
Poco notification handler for Algorithm::ProgressNotification.
pNf | :: An pointer to the notification. |
Definition at line 150 of file AlgorithmObserver.cpp.
References progressHandle().
|
private |
Poco notification handler for Algorithm::StartedNotification.
pNf | :: An pointer to the notification. |
Definition at line 157 of file AlgorithmObserver.cpp.
References startHandle().
|
private |
Poco notification handler for API::AlgorithmStartingNotification.
pNf | :: An pointer to the notification. |
Definition at line 178 of file AlgorithmObserver.cpp.
References startingHandle().
|
virtual |
Reimplemented in Mantid::PythonInterface::AlgorithmObserverAdapter, MantidQt::API::AlgorithmDialog, and MantidQt::MantidWidgets::AlgorithmProgressModel.
Referenced by _errorHandle().
|
virtual |
Reimplemented in Mantid::PythonInterface::AlgorithmObserverAdapter, MantidQt::API::AlgorithmDialog, MantidQt::MantidWidgets::AlgorithmProgressModel, MantidQt::MantidWidgets::FitPropertyBrowser, MantidQt::MantidWidgets::MuonFitPropertyBrowser, and MantidQt::MantidWidgets::SequentialFitDialog.
Referenced by _finishHandle().
void Mantid::API::AlgorithmObserver::observeAll | ( | const IAlgorithm_const_sptr & | alg | ) |
Connect to algorithm alg and observe all its notifications.
alg | :: Algorithm to be observed |
Definition at line 45 of file AlgorithmObserver.cpp.
References m_errorObserver, m_finishObserver, m_progressObserver, and m_startObserver.
Referenced by AlgorithmObserver().
void Mantid::API::AlgorithmObserver::observeError | ( | const IAlgorithm_const_sptr & | alg | ) |
Connect to algorithm alg and observe its error notification.
alg | :: Algorithm to be observed |
Definition at line 76 of file AlgorithmObserver.cpp.
References m_errorObserver.
Referenced by MantidQt::API::AlgorithmDialog::executeAlgorithmAsync(), observeError(), and MantidQt::MantidWidgets::AlgorithmProgressModel::startingHandle().
void Mantid::API::AlgorithmObserver::observeFinish | ( | const IAlgorithm_const_sptr & | alg | ) |
Connect to algorithm alg and observe its finish notification.
alg | :: Algorithm to be observed |
Definition at line 71 of file AlgorithmObserver.cpp.
References m_finishObserver.
Referenced by MantidQt::MantidWidgets::SequentialFitDialog::accept(), MantidQt::MantidWidgets::FitPropertyBrowser::doFit(), MantidQt::MantidWidgets::MuonFitPropertyBrowser::doTFAsymmFit(), MantidQt::API::AlgorithmDialog::executeAlgorithmAsync(), observeFinish(), and MantidQt::MantidWidgets::AlgorithmProgressModel::startingHandle().
void Mantid::API::AlgorithmObserver::observeProgress | ( | const IAlgorithm_const_sptr & | alg | ) |
Connect to algorithm alg and observe its progress notification.
alg | :: Algorithm to be observed |
Definition at line 55 of file AlgorithmObserver.cpp.
References m_progressObserver.
Referenced by observeProgress(), and MantidQt::MantidWidgets::AlgorithmProgressModel::startingHandle().
void Mantid::API::AlgorithmObserver::observeStart | ( | const IAlgorithm_const_sptr & | alg | ) |
Connect to algorithm alg and observe its start notification.
alg | :: Algorithm to be observed |
Definition at line 66 of file AlgorithmObserver.cpp.
References m_startObserver.
Referenced by MantidQt::MantidWidgets::AlgorithmProgressModel::startingHandle().
void Mantid::API::AlgorithmObserver::observeStarting | ( | ) |
Connect to AlgorithmManager and observe its starting notifications.
Definition at line 59 of file AlgorithmObserver.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance(), and m_startingObserver.
Referenced by MantidQt::MantidWidgets::AlgorithmProgressModel::AlgorithmProgressModel(), Mantid::Algorithms::RecordPythonScript::exec(), and export_algorithm_observer().
|
virtual |
Reimplemented in Mantid::PythonInterface::AlgorithmObserverAdapter, and MantidQt::MantidWidgets::AlgorithmProgressModel.
Referenced by _progressHandle().
|
virtual |
Reimplemented in MantidQt::MantidWidgets::AlgorithmProgressModel.
Referenced by _startHandle().
|
virtual |
Reimplemented in Mantid::Algorithms::RecordPythonScript, Mantid::PythonInterface::AlgorithmObserverAdapter, and MantidQt::MantidWidgets::AlgorithmProgressModel.
Referenced by _startingHandle().
void Mantid::API::AlgorithmObserver::stopObserving | ( | const IAlgorithm_const_sptr & | alg | ) |
Disconnect from algorithm alg.
Should be called in the destructor of inherited classes.
alg | :: Algorithm to be disconnected |
Definition at line 82 of file AlgorithmObserver.cpp.
References stopObserving().
Referenced by MantidQt::API::AlgorithmDialog::executeAlgorithmAsync(), MantidQt::MantidWidgets::AlgorithmProgressModel::removeFrom(), stopObserving(), stopObserving(), and MantidQt::API::AlgorithmDialog::~AlgorithmDialog().
void Mantid::API::AlgorithmObserver::stopObserving | ( | const Mantid::API::IAlgorithm * | alg | ) |
Definition at line 84 of file AlgorithmObserver.cpp.
References m_errorObserver, m_finishObserver, m_progressObserver, m_startObserver, and Mantid::API::IAlgorithm::removeObserver().
void Mantid::API::AlgorithmObserver::stopObservingManager | ( | ) |
Disconnect from the algorithm manager.
Definition at line 94 of file AlgorithmObserver.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance(), and m_startingObserver.
Referenced by Mantid::Algorithms::RecordPythonScript::exec(), and MantidQt::MantidWidgets::AlgorithmProgressModel::~AlgorithmProgressModel().
|
private |
Poco::NObserver for Algorithm::ErrorNotification.
Definition at line 62 of file AlgorithmObserver.h.
Referenced by observeAll(), observeError(), and stopObserving().
|
private |
Poco::NObserver for Algorithm::FinishedNotification.
Definition at line 58 of file AlgorithmObserver.h.
Referenced by observeAll(), observeFinish(), and stopObserving().
|
private |
Poco::NObserver for Algorithm::ProgressNotification.
Definition at line 50 of file AlgorithmObserver.h.
Referenced by observeAll(), observeProgress(), and stopObserving().
|
private |
Poco::NObserver for API::AlgorithmStartingNotification.
Definition at line 66 of file AlgorithmObserver.h.
Referenced by observeStarting(), and stopObservingManager().
|
private |
Poco::NObserver for Algorithm::StartedNotification.
Definition at line 54 of file AlgorithmObserver.h.
Referenced by observeAll(), observeStart(), and stopObserving().