9#include <Poco/ActiveResult.h>
17 : QObject(parent), m_finishedObserver(*this, &
QtAlgorithmRunner::handleAlgorithmFinishedNotification),
18 m_progressObserver(*this, &
QtAlgorithmRunner::handleAlgorithmProgressNotification),
19 m_errorObserver(*this, &
QtAlgorithmRunner::handleAlgorithmErrorNotification), m_asyncResult(nullptr) {}
54 throw std::invalid_argument(
"QtAlgorithmRunner::startAlgorithm() given a NULL Algorithm");
55 if (!alg->isInitialized())
56 throw std::invalid_argument(
"QtAlgorithmRunner::startAlgorithm() given an uninitialized Algorithm");
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
The QtAlgorithmRunner is a QObject that encapsulates methods for running an algorithm asynchronously ...
virtual Mantid::API::IAlgorithm_sptr getAlgorithm() const
Get back a pointer to the running algorithm.
void algorithmProgress(double p, const std::string &msg)
Signal emitted when the algorithm reports progress.
void handleAlgorithmFinishedNotification(const Poco::AutoPtr< Mantid::API::Algorithm::FinishedNotification > &pNf)
Algorithm notification handlers.
Poco::NObserver< QtAlgorithmRunner, Mantid::API::Algorithm::FinishedNotification > m_finishedObserver
QtAlgorithmRunner(QObject *parent=nullptr)
Mantid::API::IAlgorithm_sptr m_asyncAlg
Reference to the algorithm executing asynchronously.
void cancelRunningAlgorithm()
If an algorithm is already running, cancel it.
Poco::ActiveResult< bool > * m_asyncResult
For the asynchronous call in dynamic rebinning.
void handleAlgorithmErrorNotification(const Poco::AutoPtr< Mantid::API::Algorithm::ErrorNotification > &pNf)
Observer called when the async algorithm has encountered an error.
Poco::NObserver< QtAlgorithmRunner, Mantid::API::Algorithm::ErrorNotification > m_errorObserver
~QtAlgorithmRunner() override
Poco::NObserver< QtAlgorithmRunner, Mantid::API::Algorithm::ProgressNotification > m_progressObserver
void handleAlgorithmProgressNotification(const Poco::AutoPtr< Mantid::API::Algorithm::ProgressNotification > &pNf)
Observer called when the async algorithm has progress to report.
void algorithmComplete(bool error)
Signal emitted when the algorithm has completed execution/encountered an error.
virtual void startAlgorithm(Mantid::API::IAlgorithm_sptr alg)
Begin asynchronous execution of an algorithm and observe its execution.
std::shared_ptr< IAlgorithm > IAlgorithm_sptr
shared pointer to Mantid::API::IAlgorithm