//----------------------------------------------------------------------------- // $Id: QtRun/TimestepList.hpp 2017/02/15 14:49:12 philw $ //----------------------------------------------------------------------------- #pragma once #ifndef TimestepListINCLUDED #define TimestepListINCLUDED #ifndef DeltaTimeINCLUDED #include "DeltaTime.hpp" #endif #include #include #include class Timestep { private: DeltaTime _step; QString _text; public: // constructors and destructor Timestep(const DeltaTime& step, const QString& text) : _step(step), _text(text) { } ~Timestep() { /* empty */ } // accessors const DeltaTime& step() const { return _step; } const QString& text() const { return _text; } }; class TimestepList { private: // singleton instance static TimestepList* _instance; const Timestep _tstep1Hour; const Timestep _tstep6Hour; const Timestep _tstep12Hour; const Timestep _tstepDay; const Timestep _tstepWeek; const Timestep _tstepMonth; const Timestep _tstepYear; // Note [Phil, 10-2013, Rw 6.4, Gnats 5207]: We have never properly // supported a weekly timestep; (they always started Tuesday night). // For now, we will show the Weekly timestep item ONLY ON DEMAND, // e.g. from an old model which uses a Weekly run timestep, or for // a SeriesSlot which already has a weekly timestep. QList _timestepsStd; QList _timestepsWithWeekly; protected: // constructors and destructor TimestepList::TimestepList(); virtual ~TimestepList(); public: // singleton methods static const TimestepList& instance(); static void deleteInstance(); static bool isInstantiated(); const QList& timesteps() const { return _timestepsStd; } const QList& timesteps (const DeltaTime& toBeUsedForStep) const; QStringList stringList() const; QStringList stringList(const DeltaTime& toBeUsedForStep) const; // return the timestep text QString text (const DeltaTime& step) const; // return the timestep matching the given text DeltaTime step (const QString& text) const; private: // no bodies provided TimestepList(const TimestepList&); TimestepList& operator= (const TimestepList&); }; #endif //--- (end TimestepList.hpp) ---