src/model/RunPeriodControlSpecialDays.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #ifndef MODEL_RUNPERIODCONTROLSPECIALDAYS_HPP | ||
| 7 | #define MODEL_RUNPERIODCONTROLSPECIALDAYS_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "ModelObject.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | |||
| 14 | class Date; | ||
| 15 | class MonthOfYear; | ||
| 16 | class NthDayOfWeekInMonth; | ||
| 17 | class DayOfWeek; | ||
| 18 | |||
| 19 | namespace model { | ||
| 20 | |||
| 21 | namespace detail { | ||
| 22 | class RunPeriodControlSpecialDays_Impl; | ||
| 23 | } // namespace detail | ||
| 24 | |||
| 25 | /** RunPeriodControlSpecialDays derives from ModelObject and is an interface to the OpenStudio IDD object named "OS:RunPeriodControl:SpecialDays". | ||
| 26 | */ | ||
| 27 | class MODEL_API RunPeriodControlSpecialDays : public ModelObject | ||
| 28 | { | ||
| 29 | public: | ||
| 30 | /** @name Constructors and Destructors */ | ||
| 31 | //@{ | ||
| 32 | |||
| 33 | /** Constructor with string, will throw if incorrect format. */ | ||
| 34 | RunPeriodControlSpecialDays(const std::string& startDate, Model& model); | ||
| 35 | |||
| 36 | /** Constructor with month of year and day, e.g. Jan, 1. */ | ||
| 37 | RunPeriodControlSpecialDays(const openstudio::MonthOfYear& monthOfYear, unsigned day, Model& model); | ||
| 38 | |||
| 39 | /** Constructor from nth day in month, e.g. 1st Friday in January. */ | ||
| 40 | RunPeriodControlSpecialDays(const openstudio::NthDayOfWeekInMonth& nth, const openstudio::DayOfWeek& dayOfWeek, | ||
| 41 | const openstudio::MonthOfYear& monthOfYear, Model& model); | ||
| 42 | |||
| 43 | 189 | virtual ~RunPeriodControlSpecialDays() override = default; | |
| 44 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 45 | ✗ | RunPeriodControlSpecialDays(const RunPeriodControlSpecialDays& other) = default; | |
| 46 | 80 | RunPeriodControlSpecialDays(RunPeriodControlSpecialDays&& other) = default; | |
| 47 | ✗ | RunPeriodControlSpecialDays& operator=(const RunPeriodControlSpecialDays&) = default; | |
| 48 | 4 | RunPeriodControlSpecialDays& operator=(RunPeriodControlSpecialDays&&) = default; | |
| 49 | |||
| 50 | /** @name Static Methods */ | ||
| 51 | //@{ | ||
| 52 | |||
| 53 | static std::vector<std::string> specialDayTypeValues(); | ||
| 54 | |||
| 55 | // Forwards to specialDayTypeValues() | ||
| 56 | static std::vector<std::string> validSpecialDayTypeValues(); | ||
| 57 | |||
| 58 | //@} | ||
| 59 | /** @name Getters */ | ||
| 60 | //@{ | ||
| 61 | |||
| 62 | openstudio::Date startDate() const; | ||
| 63 | unsigned duration() const; | ||
| 64 | std::string specialDayType() const; | ||
| 65 | |||
| 66 | //@} | ||
| 67 | /** @name Setters */ | ||
| 68 | //@{ | ||
| 69 | |||
| 70 | bool setStartDate(const std::string& startDate); | ||
| 71 | bool setStartDate(const openstudio::MonthOfYear& monthOfYear, unsigned day); | ||
| 72 | bool setStartDate(const openstudio::NthDayOfWeekInMonth& nth, const openstudio::DayOfWeek& dayOfWeek, const openstudio::MonthOfYear& monthOfYear); | ||
| 73 | bool setDuration(unsigned duration); | ||
| 74 | bool setSpecialDayType(const std::string& specialDayType); | ||
| 75 | |||
| 76 | // ensure that this object does not contain the date 2/29 | ||
| 77 | void ensureNoLeapDays(); | ||
| 78 | |||
| 79 | //@} | ||
| 80 | |||
| 81 | /// Returns the IddObjectType. | ||
| 82 | static IddObjectType iddObjectType(); | ||
| 83 | |||
| 84 | protected: | ||
| 85 | /// @cond | ||
| 86 | |||
| 87 | using ImplType = detail::RunPeriodControlSpecialDays_Impl; | ||
| 88 | |||
| 89 | friend class Model; | ||
| 90 | friend class openstudio::IdfObject; | ||
| 91 | |||
| 92 | // constructor | ||
| 93 | explicit RunPeriodControlSpecialDays(std::shared_ptr<detail::RunPeriodControlSpecialDays_Impl> impl); | ||
| 94 | |||
| 95 | private: | ||
| 96 | − | REGISTER_LOGGER("openstudio.model.RunPeriodControlSpecialDays"); | |
| 97 | |||
| 98 | /// @endcond | ||
| 99 | }; | ||
| 100 | |||
| 101 | /** \relates RunPeriodControlSpecialDays */ | ||
| 102 | using OptionalRunPeriodControlSpecialDays = boost::optional<RunPeriodControlSpecialDays>; | ||
| 103 | |||
| 104 | /** \relates RunPeriodControlSpecialDays */ | ||
| 105 | using RunPeriodControlSpecialDaysVector = std::vector<RunPeriodControlSpecialDays>; | ||
| 106 | |||
| 107 | } // namespace model | ||
| 108 | } // namespace openstudio | ||
| 109 | |||
| 110 | #endif // MODEL_RUNPERIODCONTROLSPECIALDAYS_HPP | ||
| 111 |