GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 69.9% 58 / 0 / 83
Functions: 72.4% 21 / 0 / 29
Branches: 63.0% 29 / 0 / 46

src/model/LifeCycleCostUsePriceEscalation.cpp
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 #include "LifeCycleCostUsePriceEscalation.hpp"
7 #include "LifeCycleCostUsePriceEscalation_Impl.hpp"
8
9 #include "Model_Impl.hpp"
10
11 #include "../utilities/idf/IdfExtensibleGroup.hpp"
12 #include <utilities/idd/OS_LifeCycleCost_UsePriceEscalation_FieldEnums.hxx>
13 #include <utilities/idd/IddEnums.hxx>
14
15 #include "../utilities/core/Assert.hpp"
16
17 #include <boost/algorithm/string.hpp>
18
19 namespace openstudio {
20 namespace model {
21 namespace detail {
22
23 1 LifeCycleCostUsePriceEscalation_Impl::LifeCycleCostUsePriceEscalation_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
24 1 : ParentObject_Impl(idfObject, model, keepHandle) {
25
4/6
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 time.
✗ Branch 13 not taken.
1 OS_ASSERT(idfObject.iddObject().type() == LifeCycleCostUsePriceEscalation::iddObjectType());
26 1 }
27
28 ✗ LifeCycleCostUsePriceEscalation_Impl::LifeCycleCostUsePriceEscalation_Impl(const openstudio::detail::WorkspaceObject_Impl& other,
29 ✗ Model_Impl* model, bool keepHandle)
30 ✗ : ParentObject_Impl(other, model, keepHandle) {
31 ✗ OS_ASSERT(other.iddObject().type() == LifeCycleCostUsePriceEscalation::iddObjectType());
32 ✗ }
33
34 ✗ LifeCycleCostUsePriceEscalation_Impl::LifeCycleCostUsePriceEscalation_Impl(const LifeCycleCostUsePriceEscalation_Impl& other, Model_Impl* model,
35 ✗ bool keepHandle)
36 ✗ : ParentObject_Impl(other, model, keepHandle) {}
37
38 7 OptionalInt LifeCycleCostUsePriceEscalation_Impl::escalationStartYear() const {
39 7 return getInt(OS_LifeCycleCost_UsePriceEscalationFields::EscalationStartYear);
40 }
41
42 3 bool LifeCycleCostUsePriceEscalation_Impl::setEscalationStartYear(int num) {
43 3 return setInt(OS_LifeCycleCost_UsePriceEscalationFields::EscalationStartYear, num);
44 ;
45 }
46
47 6 boost::optional<double> LifeCycleCostUsePriceEscalation_Impl::yearEscalation(unsigned index) const {
48
1/1
✓ Branch 1 taken 6 times.
6 IdfExtensibleGroup eg = getExtensibleGroup(index);
49
2/3
✓ Branch 1 taken 6 times.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
6 if (!eg.empty()) {
50
1/1
✓ Branch 1 taken 6 times.
6 return eg.getDouble(OS_LifeCycleCost_UsePriceEscalationExtensibleFields::YearEscalation, true);
51 }
52 ✗ return boost::none;
53 6 }
54
55 3 bool LifeCycleCostUsePriceEscalation_Impl::setYearEscalation(unsigned index, double num) {
56
1/1
✓ Branch 1 taken 3 times.
3 IdfExtensibleGroup eg = getExtensibleGroup(index);
57
3/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 2 times.
3 if (!eg.empty()) {
58
1/1
✓ Branch 1 taken 1 time.
1 return eg.setDouble(OS_LifeCycleCost_UsePriceEscalationExtensibleFields::YearEscalation, num);
59 } else {
60
1/1
✓ Branch 1 taken 2 times.
2 StringVector values(1u);
61
1/1
✓ Branch 1 taken 2 times.
2 eg = insertExtensibleGroup(index, values);
62
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
2 if (!eg.empty()) {
63
1/1
✓ Branch 1 taken 2 times.
2 return eg.setDouble(OS_LifeCycleCost_UsePriceEscalationExtensibleFields::YearEscalation, num);
64 }
65 2 }
66 ✗ return false;
67 3 }
68
69 4 unsigned LifeCycleCostUsePriceEscalation_Impl::numYears() const {
70 4 return numExtensibleGroups();
71 }
72
73 8 OptionalString LifeCycleCostUsePriceEscalation_Impl::resource() const {
74 8 return getString(OS_LifeCycleCost_UsePriceEscalationFields::Resource);
75 }
76
77 3 bool LifeCycleCostUsePriceEscalation_Impl::setResource(const std::string& str) {
78 3 return setString(OS_LifeCycleCost_UsePriceEscalationFields::Resource, str);
79 ;
80 }
81
82 7 OptionalString LifeCycleCostUsePriceEscalation_Impl::escalationStartMonth() const {
83 7 return getString(OS_LifeCycleCost_UsePriceEscalationFields::EscalationStartMonth);
84 }
85
86 3 bool LifeCycleCostUsePriceEscalation_Impl::setEscalationStartMonth(const std::string& str) {
87 3 return setString(OS_LifeCycleCost_UsePriceEscalationFields::EscalationStartMonth, str);
88 ;
89 }
90
91 // return the parent object in the hierarchy
92 ✗ boost::optional<ParentObject> LifeCycleCostUsePriceEscalation_Impl::parent() const {
93 ✗ return {};
94 }
95
96 // set the parent, child may have to call methods on the parent
97 ✗ bool LifeCycleCostUsePriceEscalation_Impl::setParent(ParentObject& /*newParent*/) {
98 //if (newParent.optionalCast<SomeParentClass>() && (newParent.model() == model())) {
99 // return true;
100 //}
101 ✗ return false;
102 }
103
104 // return any children objects in the hierarchy
105 ✗ std::vector<ModelObject> LifeCycleCostUsePriceEscalation_Impl::children() const {
106 ✗ std::vector<ModelObject> result;
107 ✗ return result;
108 }
109
110 ✗ std::vector<IddObjectType> LifeCycleCostUsePriceEscalation_Impl::allowableChildTypes() const {
111 ✗ IddObjectTypeVector result;
112 ✗ return result;
113 }
114
115 // Get all output variable names that could be associated with this object.
116 ✗ const std::vector<std::string>& LifeCycleCostUsePriceEscalation_Impl::outputVariableNames() const {
117 ✗ static const std::vector<std::string> result;
118 // Not appropriate: no specific output variable
119 ✗ return result;
120 }
121
122 } // namespace detail
123
124 /// constructor
125 1 LifeCycleCostUsePriceEscalation::LifeCycleCostUsePriceEscalation(const Model& model)
126 1 : ParentObject(LifeCycleCostUsePriceEscalation::iddObjectType(), model) {
127
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 5 not taken.
1 OS_ASSERT(getImpl<detail::LifeCycleCostUsePriceEscalation_Impl>());
128 1 }
129
130 // constructor
131 ✗ LifeCycleCostUsePriceEscalation::LifeCycleCostUsePriceEscalation(std::shared_ptr<detail::LifeCycleCostUsePriceEscalation_Impl> impl)
132 ✗ : ParentObject(std::move(impl)) {}
133
134 7 OptionalInt LifeCycleCostUsePriceEscalation::escalationStartYear() const {
135
1/1
✓ Branch 3 taken 7 times.
7 return getImpl<detail::LifeCycleCostUsePriceEscalation_Impl>()->escalationStartYear();
136 }
137
138 3 bool LifeCycleCostUsePriceEscalation::setEscalationStartYear(int num) {
139
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::LifeCycleCostUsePriceEscalation_Impl>()->setEscalationStartYear(num);
140 }
141
142 6 boost::optional<double> LifeCycleCostUsePriceEscalation::yearEscalation(unsigned index) const {
143
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::LifeCycleCostUsePriceEscalation_Impl>()->yearEscalation(index);
144 }
145
146 3 bool LifeCycleCostUsePriceEscalation::setYearEscalation(unsigned index, double num) {
147
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::LifeCycleCostUsePriceEscalation_Impl>()->setYearEscalation(index, num);
148 }
149
150 4 unsigned LifeCycleCostUsePriceEscalation::numYears() const {
151
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::LifeCycleCostUsePriceEscalation_Impl>()->numYears();
152 }
153
154 8 OptionalString LifeCycleCostUsePriceEscalation::resource() const {
155
1/1
✓ Branch 3 taken 8 times.
8 return getImpl<detail::LifeCycleCostUsePriceEscalation_Impl>()->resource();
156 }
157
158 3 bool LifeCycleCostUsePriceEscalation::setResource(const std::string& str) {
159
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::LifeCycleCostUsePriceEscalation_Impl>()->setResource(str);
160 }
161
162 7 OptionalString LifeCycleCostUsePriceEscalation::escalationStartMonth() const {
163
1/1
✓ Branch 3 taken 7 times.
7 return getImpl<detail::LifeCycleCostUsePriceEscalation_Impl>()->escalationStartMonth();
164 }
165
166 3 bool LifeCycleCostUsePriceEscalation::setEscalationStartMonth(const std::string& str) {
167
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::LifeCycleCostUsePriceEscalation_Impl>()->setEscalationStartMonth(str);
168 }
169
170 7600 IddObjectType LifeCycleCostUsePriceEscalation::iddObjectType() {
171
1/1
✓ Branch 1 taken 7600 times.
7600 IddObjectType result(IddObjectType::OS_LifeCycleCost_UsePriceEscalation);
172 7600 return result;
173 }
174
175 } // namespace model
176 } // namespace openstudio
177