Mantid
Loading...
Searching...
No Matches
ProgressPresenter.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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
11
13private:
15
16public:
17 ProgressPresenter(double start, double end, int64_t nSteps,
18 MantidQt::MantidWidgets::ProgressableView *const progressableView)
19 : ProgressBase(static_cast<int>(start), static_cast<int>(end), static_cast<int>(nSteps)),
20 m_progressableView(progressableView) {
21 if (!progressableView) {
22 throw std::runtime_error("ProgressableView is null");
23 }
25 m_progressableView->setProgressRange(static_cast<int>(start), static_cast<int>(end));
26 }
27
28 void doReport(const std::string & /*msg*/) override {
30 m_progressableView->setProgress(static_cast<int>(m_i));
31 }
35 virtual ~ProgressPresenter() = default;
36};
ProgressableView : Abstract view useful for indicating progress.
virtual void setProgressRange(int min, int max)
virtual void setProgress(int progress)=0
std::atomic< int64_t > m_i
Loop counter.
Definition: ProgressBase.h:86
ProgressBase()
Default constructor.
ProgressPresenter(double start, double end, int64_t nSteps, MantidQt::MantidWidgets::ProgressableView *const progressableView)
MantidQt::MantidWidgets::ProgressableView *const m_progressableView
void doReport(const std::string &) override
Pure virtual method that does the progress reporting, to be overridden.
virtual ~ProgressPresenter()=default