SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
Loading...
Searching...
No Matches
analysishost.h
Go to the documentation of this file.
1// SedSAT3 – Sediment Source Assessment Tool, version 3
2// U.S. Geological Survey. See LICENSE.md and DISCLAIMER.md in the repository root.
3
4#ifndef ANALYSISHOST_H
5#define ANALYSISHOST_H
6
7#include <string>
8
10
31{
32public:
33 virtual ~AnalysisHost() = default;
34
44 virtual void ShowWarning(const std::string& message) = 0;
45
57 virtual ProgressReporter* CreateProgressReporter(int number_of_panels = 1,
58 bool extra_label_and_progressbar = false) = 0;
59
67 virtual void DisposeProgressReporter(ProgressReporter* reporter) = 0;
68};
69
80{
81public:
83 int number_of_panels = 1,
84 bool extra_label_and_progressbar = false)
85 : host_(host),
86 reporter_(host ? host->CreateProgressReporter(number_of_panels,
87 extra_label_and_progressbar)
88 : nullptr)
89 {
90 }
91
93 {
94 if (host_)
95 host_->DisposeProgressReporter(reporter_);
96 }
97
100
101 ProgressReporter* Get() const { return reporter_; }
103 operator ProgressReporter*() const { return reporter_; }
104
105private:
108};
109
110#endif // ANALYSISHOST_H
Abstract environment that an analysis runs inside.
virtual ~AnalysisHost()=default
virtual void ShowWarning(const std::string &message)=0
Reports a condition that prevented an analysis from running.
virtual void DisposeProgressReporter(ProgressReporter *reporter)=0
Releases a reporter previously obtained from this host.
virtual ProgressReporter * CreateProgressReporter(int number_of_panels=1, bool extra_label_and_progressbar=false)=0
Creates a progress reporter for a long-running analysis.
Abstract sink for progress information produced by a running analysis.
ScopedProgressReporter(AnalysisHost *host, int number_of_panels=1, bool extra_label_and_progressbar=false)
ScopedProgressReporter(const ScopedProgressReporter &)=delete
ScopedProgressReporter & operator=(const ScopedProgressReporter &)=delete
ProgressReporter * Get() const
ProgressReporter * operator->() const
ProgressReporter * reporter_