Mantid
Loading...
Searching...
No Matches
AlgorithmObserver.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
12#include "MantidAPI/Algorithm.h"
14#include "MantidAPI/DllConfig.h"
15#include <Poco/NObserver.h>
16
17namespace Mantid {
18namespace API {
23class MANTID_API_DLL AlgorithmObserver {
24public:
28
29 void observeAll(const IAlgorithm_const_sptr &alg);
31 void observeStarting();
32 void observeStart(const IAlgorithm_const_sptr &alg);
33 void observeFinish(const IAlgorithm_const_sptr &alg);
34 void observeError(const IAlgorithm_const_sptr &alg);
35
36 void stopObserving(const IAlgorithm_const_sptr &alg);
38 void stopObservingManager();
39
40 virtual void progressHandle(const IAlgorithm *alg, double p, const std::string &msg, const double estimatedTime,
41 const int progressPrecision);
43 virtual void startHandle(const IAlgorithm *alg);
44 virtual void finishHandle(const IAlgorithm *alg);
45 virtual void errorHandle(const IAlgorithm *alg, const std::string &what);
46
47private:
48 void _progressHandle(const Poco::AutoPtr<Algorithm::ProgressNotification> &pNf);
51
52 void _startHandle(const Poco::AutoPtr<Algorithm::StartedNotification> &pNf);
55
56 void _finishHandle(const Poco::AutoPtr<Algorithm::FinishedNotification> &pNf);
59
60 void _errorHandle(const Poco::AutoPtr<Algorithm::ErrorNotification> &pNf);
63
64 void _startingHandle(const Poco::AutoPtr<AlgorithmStartingNotification> &pNf);
67};
68
69} // namespace API
70} // namespace Mantid
void stopObserving(AlgorithmObserver &self, const boost::python::object &alg)
void observeProgress(AlgorithmObserver &self, const boost::python::object &alg)
void observeFinish(AlgorithmObserver &self, const boost::python::object &alg)
void observeError(AlgorithmObserver &self, const boost::python::object &alg)
Observes Algorithm notifications: start,progress,finish,error.
virtual void startingHandle(IAlgorithm_sptr alg)
Poco::NObserver< AlgorithmObserver, AlgorithmStartingNotification > m_startingObserver
Poco::NObserver for API::AlgorithmStartingNotification.
virtual ~AlgorithmObserver()
Virtual destructor.
virtual void finishHandle(const IAlgorithm *alg)
Poco::NObserver< AlgorithmObserver, Algorithm::ProgressNotification > m_progressObserver
Poco::NObserver for Algorithm::ProgressNotification.
virtual void errorHandle(const IAlgorithm *alg, const std::string &what)
virtual void startHandle(const IAlgorithm *alg)
Poco::NObserver< AlgorithmObserver, Algorithm::StartedNotification > m_startObserver
Poco::NObserver for Algorithm::StartedNotification.
virtual void progressHandle(const IAlgorithm *alg, double p, const std::string &msg, const double estimatedTime, const int progressPrecision)
Poco::NObserver< AlgorithmObserver, Algorithm::ErrorNotification > m_errorObserver
Poco::NObserver for Algorithm::ErrorNotification.
Poco::NObserver< AlgorithmObserver, Algorithm::FinishedNotification > m_finishObserver
Poco::NObserver for Algorithm::FinishedNotification.
IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:45
std::shared_ptr< IAlgorithm > IAlgorithm_sptr
shared pointer to Mantid::API::IAlgorithm
std::shared_ptr< const IAlgorithm > IAlgorithm_const_sptr
shared pointer to Mantid::API::IAlgorithm (const version)
Helper class which provides the Collimation Length for SANS instruments.