src/model/ScheduleRule_Impl.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_SCHEDULERULE_IMPL_HPP | ||
| 7 | #define MODEL_SCHEDULERULE_IMPL_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "ParentObject_Impl.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | |||
| 14 | class Date; | ||
| 15 | |||
| 16 | namespace model { | ||
| 17 | |||
| 18 | class ScheduleRuleset; | ||
| 19 | class ScheduleDay; | ||
| 20 | |||
| 21 | namespace detail { | ||
| 22 | |||
| 23 | /** ScheduleRule_Impl is a ParentObject_Impl that is the implementation class for ScheduleRule.*/ | ||
| 24 | class MODEL_API ScheduleRule_Impl : public ParentObject_Impl | ||
| 25 | { | ||
| 26 | |||
| 27 | public: | ||
| 28 | /** @name Constructors and Destructors */ | ||
| 29 | //@{ | ||
| 30 | |||
| 31 | ScheduleRule_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle); | ||
| 32 | |||
| 33 | ScheduleRule_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle); | ||
| 34 | |||
| 35 | ScheduleRule_Impl(const ScheduleRule_Impl& other, Model_Impl* model, bool keepHandle); | ||
| 36 | |||
| 37 | 6094 | virtual ~ScheduleRule_Impl() override = default; | |
| 38 | |||
| 39 | //@} | ||
| 40 | /** @name Virtual Methods */ | ||
| 41 | //@{ | ||
| 42 | |||
| 43 | virtual boost::optional<ParentObject> parent() const override; | ||
| 44 | |||
| 45 | virtual bool setParent(ParentObject& newParent) override; | ||
| 46 | |||
| 47 | virtual std::vector<ResourceObject> resources() const override; | ||
| 48 | |||
| 49 | virtual std::vector<ModelObject> children() const override; | ||
| 50 | |||
| 51 | virtual std::vector<IdfObject> remove() override; | ||
| 52 | |||
| 53 | virtual const std::vector<std::string>& outputVariableNames() const override; | ||
| 54 | |||
| 55 | virtual IddObjectType iddObjectType() const override; | ||
| 56 | |||
| 57 | //@} | ||
| 58 | /** @name Getters */ | ||
| 59 | //@{ | ||
| 60 | |||
| 61 | ScheduleRuleset scheduleRuleset() const; | ||
| 62 | |||
| 63 | int ruleIndex() const; | ||
| 64 | |||
| 65 | ScheduleDay daySchedule() const; | ||
| 66 | |||
| 67 | bool applySunday() const; | ||
| 68 | |||
| 69 | bool applyMonday() const; | ||
| 70 | |||
| 71 | bool applyTuesday() const; | ||
| 72 | |||
| 73 | bool applyWednesday() const; | ||
| 74 | |||
| 75 | bool applyThursday() const; | ||
| 76 | |||
| 77 | bool applyFriday() const; | ||
| 78 | |||
| 79 | bool applySaturday() const; | ||
| 80 | |||
| 81 | // Note: there is no applyHoliday, instead that's implemented at the ScheduleRule's level | ||
| 82 | |||
| 83 | std::string dateSpecificationType() const; | ||
| 84 | |||
| 85 | /// Returns the start date of the date range if set. | ||
| 86 | /// A start date > end date indicates that the range wraps around the year. | ||
| 87 | boost::optional<openstudio::Date> startDate() const; | ||
| 88 | |||
| 89 | /// Returns the end date of the date range if set. | ||
| 90 | /// A start date > end date indicates that the range wraps around the year. | ||
| 91 | boost::optional<openstudio::Date> endDate() const; | ||
| 92 | |||
| 93 | /// Returns the specific dates specified if any. | ||
| 94 | std::vector<openstudio::Date> specificDates() const; | ||
| 95 | |||
| 96 | //@} | ||
| 97 | /** @name Setters */ | ||
| 98 | //@{ | ||
| 99 | |||
| 100 | bool setRuleIndex(int index); | ||
| 101 | |||
| 102 | bool setApplySunday(bool applySunday); | ||
| 103 | |||
| 104 | bool setApplyMonday(bool applyMonday); | ||
| 105 | |||
| 106 | bool setApplyTuesday(bool applyTuesday); | ||
| 107 | |||
| 108 | bool setApplyWednesday(bool applyWednesday); | ||
| 109 | |||
| 110 | bool setApplyThursday(bool applyThursday); | ||
| 111 | |||
| 112 | bool setApplyFriday(bool applyFriday); | ||
| 113 | |||
| 114 | bool setApplySaturday(bool applySaturday); | ||
| 115 | |||
| 116 | /// Sets the start date of the date range, will delete any specific dates specified. | ||
| 117 | /// A start date > end date indicates that the range wraps around the year. | ||
| 118 | bool setStartDate(const openstudio::Date& date); | ||
| 119 | |||
| 120 | /// Sets the end date of the date range, will delete any specific dates specified. | ||
| 121 | /// A start date > end date indicates that the range wraps around the year. | ||
| 122 | bool setEndDate(const openstudio::Date& date); | ||
| 123 | |||
| 124 | /// Adds a specific date, will delete start and end dates. | ||
| 125 | bool addSpecificDate(const openstudio::Date& date); | ||
| 126 | |||
| 127 | // ensure that this object does not contain the date 2/29 | ||
| 128 | void ensureNoLeapDays(); | ||
| 129 | |||
| 130 | //@} | ||
| 131 | |||
| 132 | /// Returns true if this rule covers the given date. | ||
| 133 | bool containsDate(const openstudio::Date& date); | ||
| 134 | |||
| 135 | /// Returns whether or not this rule covers each given date. | ||
| 136 | std::vector<bool> containsDates(const std::vector<openstudio::Date>& dates); | ||
| 137 | |||
| 138 | // Convenience methods | ||
| 139 | bool applyAllDays() const; | ||
| 140 | bool applyWeekdays() const; | ||
| 141 | bool applyWeekends() const; | ||
| 142 | |||
| 143 | bool setApplyAllDays(bool applyAllDays); | ||
| 144 | bool setApplyWeekdays(bool applyWeekdays); | ||
| 145 | bool setApplyWeekends(bool applyWeekends); | ||
| 146 | |||
| 147 | protected: | ||
| 148 | private: | ||
| 149 | − | REGISTER_LOGGER("openstudio.model.ScheduleRule"); | |
| 150 | |||
| 151 | boost::optional<ScheduleDay> optionalDaySchedule() const; | ||
| 152 | }; | ||
| 153 | |||
| 154 | } // namespace detail | ||
| 155 | |||
| 156 | } // namespace model | ||
| 157 | } // namespace openstudio | ||
| 158 | |||
| 159 | #endif // MODEL_SCHEDULERULE_IMPL_HPP | ||
| 160 |