GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 60.0% 3 / 0 / 5
Functions: 60.0% 3 / 0 / 5
Branches: -% 0 / 0 / 0

src/model/YearDescription.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_YEARDESCRIPTION_HPP
7 #define MODEL_YEARDESCRIPTION_HPP
8
9 #include "ModelAPI.hpp"
10 #include "ParentObject.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
23 class YearDescription_Impl;
24
25 } // namespace detail
26
27 /** YearDescription is a ParentObject that wraps the OpenStudio IDD object 'OS_YearDescription'. */
28 class MODEL_API YearDescription : public ParentObject
29 {
30 public:
31 /** @name Constructors and Destructors */
32 //@{
33
34 5265 virtual ~YearDescription() override = default;
35 // Default the copy and move operators because the virtual dtor is explicit
36 3961 YearDescription(const YearDescription& other) = default;
37 206 YearDescription(YearDescription&& other) = default;
38 ✗ YearDescription& operator=(const YearDescription&) = default;
39 ✗ YearDescription& operator=(YearDescription&&) = default;
40
41 //@}
42 /** @name Static Methods */
43 //@{
44
45 static IddObjectType iddObjectType();
46
47 static std::vector<std::string> validDayofWeekforStartDayValues();
48
49 //@}
50 /** @name Getters */
51 //@{
52
53 boost::optional<int> calendarYear() const;
54
55 std::string dayofWeekforStartDay() const;
56
57 bool isDayofWeekforStartDayDefaulted() const;
58
59 bool isLeapYear() const;
60
61 bool isIsLeapYearDefaulted() const;
62
63 //@}
64 /** @name Setters */
65 //@{
66
67 bool setCalendarYear(int calendarYear);
68
69 void resetCalendarYear();
70
71 bool setDayofWeekforStartDay(const std::string& dayofWeekforStartDay);
72
73 void resetDayofWeekforStartDay();
74
75 bool setIsLeapYear(bool isLeapYear);
76
77 void resetIsLeapYear();
78
79 //@}
80
81 /// Returns assumed year for date calculations.
82 int assumedYear() const;
83
84 /// Returns a date which may be used in this model.
85 /// Will throw if dayOfMonth is not appropriate for monthOfYear.
86 openstudio::Date makeDate(openstudio::MonthOfYear monthOfYear, unsigned dayOfMonth);
87 openstudio::Date makeDate(unsigned monthOfYear, unsigned dayOfMonth);
88
89 /// nth weekday of month generators
90 openstudio::Date makeDate(openstudio::NthDayOfWeekInMonth n, openstudio::DayOfWeek dayOfWeek, openstudio::MonthOfYear monthOfYear);
91
92 /// day of year
93 openstudio::Date makeDate(unsigned dayOfYear);
94
95 protected:
96 /// @cond
97 using ImplType = detail::YearDescription_Impl;
98
99 friend class Model;
100 friend class IdfObject;
101 friend class detail::YearDescription_Impl;
102
103 explicit YearDescription(std::shared_ptr<detail::YearDescription_Impl> impl);
104
105 explicit YearDescription(Model& model);
106
107 /// @endcond
108 private:
109 REGISTER_LOGGER("openstudio.model.YearDescription");
110 };
111
112 /** \relates YearDescription*/
113 using OptionalYearDescription = boost::optional<YearDescription>;
114
115 /** \relates YearDescription*/
116 using YearDescriptionVector = std::vector<YearDescription>;
117
118 } // namespace model
119 } // namespace openstudio
120
121 #endif // MODEL_YEARDESCRIPTION_HPP
122