src/model/ScheduleYear.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_SCHEDULEYEAR_HPP | ||
| 7 | #define MODEL_SCHEDULEYEAR_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "Schedule.hpp" | ||
| 11 | |||
| 12 | namespace openstudio { | ||
| 13 | |||
| 14 | class Date; | ||
| 15 | |||
| 16 | namespace model { | ||
| 17 | |||
| 18 | class ScheduleWeek; | ||
| 19 | |||
| 20 | namespace detail { | ||
| 21 | |||
| 22 | class ScheduleYear_Impl; | ||
| 23 | |||
| 24 | } // namespace detail | ||
| 25 | |||
| 26 | /** ScheduleYear is a Schedule that wraps the OpenStudio IDD object 'OS_Schedule_Year'. */ | ||
| 27 | class MODEL_API ScheduleYear : public Schedule | ||
| 28 | { | ||
| 29 | public: | ||
| 30 | /** @name Constructors and Destructors */ | ||
| 31 | //@{ | ||
| 32 | |||
| 33 | explicit ScheduleYear(const Model& model); | ||
| 34 | |||
| 35 | 152 | virtual ~ScheduleYear() override = default; | |
| 36 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 37 | 47 | ScheduleYear(const ScheduleYear& other) = default; | |
| 38 | 12 | ScheduleYear(ScheduleYear&& other) = default; | |
| 39 | ✗ | ScheduleYear& operator=(const ScheduleYear&) = default; | |
| 40 | ✗ | ScheduleYear& operator=(ScheduleYear&&) = default; | |
| 41 | |||
| 42 | //@} | ||
| 43 | |||
| 44 | static IddObjectType iddObjectType(); | ||
| 45 | |||
| 46 | /** @name Getters */ | ||
| 47 | //@{ | ||
| 48 | |||
| 49 | // DLM@20111018: This almost needs a RunPeriod as an argument to know the year description? | ||
| 50 | /// Returns a vector of dates marking the end of week schedules. | ||
| 51 | /// These dates will be in order and have the same number of elements as scheduleWeeks. | ||
| 52 | std::vector<openstudio::Date> dates() const; | ||
| 53 | |||
| 54 | /// Returns a vector of week schedules in the same order and with the same number of elements as dates. | ||
| 55 | std::vector<ScheduleWeek> scheduleWeeks() const; | ||
| 56 | |||
| 57 | //@} | ||
| 58 | /** @name Setters */ | ||
| 59 | //@{ | ||
| 60 | |||
| 61 | /// Sets the given week schedule to be in effect until (inclusive) the date given starting | ||
| 62 | /// the day after the previous date marker or January 1st if no previous date marker exists. | ||
| 63 | /// Replaces existing scheduleWeek for same date if it exists. | ||
| 64 | bool addScheduleWeek(const openstudio::Date& untilDate, const ScheduleWeek& scheduleWeek); | ||
| 65 | |||
| 66 | /// Clear all week schedules from this schedule. | ||
| 67 | void clearScheduleWeeks(); | ||
| 68 | |||
| 69 | //@} | ||
| 70 | /** @name Other */ | ||
| 71 | //@{ | ||
| 72 | |||
| 73 | // DLM@20111018: Eventually allow "Nth day in Month" and other descriptors | ||
| 74 | /// Returns the week schedule in effect at the given date. | ||
| 75 | boost::optional<ScheduleWeek> getScheduleWeek(const openstudio::Date& date) const; | ||
| 76 | |||
| 77 | //@} | ||
| 78 | protected: | ||
| 79 | /// @cond | ||
| 80 | using ImplType = detail::ScheduleYear_Impl; | ||
| 81 | |||
| 82 | friend class Model; | ||
| 83 | friend class openstudio::IdfObject; | ||
| 84 | friend class detail::ScheduleYear_Impl; | ||
| 85 | |||
| 86 | explicit ScheduleYear(std::shared_ptr<detail::ScheduleYear_Impl> impl); | ||
| 87 | |||
| 88 | /// @endcond | ||
| 89 | private: | ||
| 90 | REGISTER_LOGGER("openstudio.model.ScheduleYear"); | ||
| 91 | }; | ||
| 92 | |||
| 93 | /** \relates ScheduleYear*/ | ||
| 94 | using OptionalScheduleYear = boost::optional<ScheduleYear>; | ||
| 95 | |||
| 96 | /** \relates ScheduleYear*/ | ||
| 97 | using ScheduleYearVector = std::vector<ScheduleYear>; | ||
| 98 | |||
| 99 | } // namespace model | ||
| 100 | } // namespace openstudio | ||
| 101 | |||
| 102 | #endif // MODEL_SCHEDULEYEAR_HPP | ||
| 103 |