Turn Calculator into a singletome and move the list of timesteps inside calculator.

This commit is contained in:
Gerhard Hoffmann 2024-01-23 10:51:25 +01:00
parent 17ae11212a
commit 9af39fa83f

View File

@ -13,9 +13,23 @@
using namespace std; using namespace std;
class Calculator { class Calculator {
public: mutable QList<int> m_timeSteps;
protected:
explicit Calculator() = default; explicit Calculator() = default;
public:
Calculator(Calculator const &other) = delete;
void operator=(Calculator const &) = delete;
static Calculator &GetInstance() {
static Calculator c;
return c;
}
void ResetTimeSteps() { m_timeSteps.clear(); }
QList<int> timeSteps() const { return m_timeSteps; }
/// <summary> /// <summary>
/// Gets duration in seconds from cost /// Gets duration in seconds from cost
/// </summary> /// </summary>