From 0b901954aa7634aa152d2ff93d2a0b0e762e113b Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Thu, 18 Jan 2024 14:49:56 +0100 Subject: [PATCH] Add members m_start and m_timeStepCompensation (used for Neuhauser, Galtuer (745) at the moment). Add several setters/getters. --- .../include/mobilisis/calculator_functions.h | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/library/include/mobilisis/calculator_functions.h b/library/include/mobilisis/calculator_functions.h index 1354e4a..57d8b02 100644 --- a/library/include/mobilisis/calculator_functions.h +++ b/library/include/mobilisis/calculator_functions.h @@ -12,9 +12,37 @@ #include using namespace std; -class Calculator -{ +class Calculator { + QDateTime m_start; + mutable uint16_t m_timeStepCompensation = 0; public: + explicit Calculator() = default; + explicit Calculator(QDateTime const start) : m_start(start) { + m_start.setTime(QTime(start.time().hour(), start.time().minute(), 0)); + qCritical() << "init m_start time:" << m_start.toString(Qt::ISODate); + } + + void setStartDateTime(QDateTime const &start) { + m_start = start; + m_start.setTime(QTime(start.time().hour(), start.time().minute(), 0)); + qCritical() << "set m_start time:" << m_start.toString(Qt::ISODate); + } + + QDateTime const &getStartDateTime() const { + return m_start; + } + + QDateTime &getStartDateTime() { + return m_start; + } + + void setTimeStepCompensation(uint16_t timeStepCompensation) { + m_timeStepCompensation = timeStepCompensation; + } + + uint16_t getTimeStepCompensation() const { + return m_timeStepCompensation; + } /// /// Gets duration in seconds from cost @@ -60,6 +88,7 @@ public: cfg->SpecialDaysWorktime.size() == 0); } +// testing public: private: // Introduced for PaymentMethod::Steps (e.g. Schoenau) // For tariff of following structure: only steps, no special days, nonstop.