GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 62.8% 81 / 0 / 129
Functions: 82.4% 28 / 0 / 34
Branches: 58.0% 65 / 0 / 112

src/model/DefaultSurfaceConstructions.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 "DefaultSurfaceConstructions.hpp"
7 #include "DefaultSurfaceConstructions_Impl.hpp"
8
9 #include "Model.hpp"
10 #include "Model_Impl.hpp"
11 #include "ConstructionBase.hpp"
12 #include "ConstructionBase_Impl.hpp"
13
14 #include <utilities/idd/OS_DefaultSurfaceConstructions_FieldEnums.hxx>
15 #include <utilities/idd/IddEnums.hxx>
16
17 #include "../utilities/core/Assert.hpp"
18
19 namespace openstudio {
20 namespace model {
21
22 namespace detail {
23
24 862 DefaultSurfaceConstructions_Impl::DefaultSurfaceConstructions_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
25 862 : ResourceObject_Impl(idfObject, model, keepHandle) {
26
4/6
✓ Branch 1 taken 862 times.
✓ Branch 4 taken 862 times.
✓ Branch 7 taken 862 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 862 times.
✗ Branch 13 not taken.
862 OS_ASSERT(idfObject.iddObject().type() == DefaultSurfaceConstructions::iddObjectType());
27 862 }
28
29 233 DefaultSurfaceConstructions_Impl::DefaultSurfaceConstructions_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model,
30 233 bool keepHandle)
31 233 : ResourceObject_Impl(other, model, keepHandle) {
32
4/6
✓ Branch 1 taken 233 times.
✓ Branch 4 taken 233 times.
✓ Branch 7 taken 233 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 233 times.
✗ Branch 13 not taken.
233 OS_ASSERT(other.iddObject().type() == DefaultSurfaceConstructions::iddObjectType());
33 233 }
34
35 576 DefaultSurfaceConstructions_Impl::DefaultSurfaceConstructions_Impl(const DefaultSurfaceConstructions_Impl& other, Model_Impl* model,
36 576 bool keepHandle)
37 576 : ResourceObject_Impl(other, model, keepHandle) {}
38
39 3 const std::vector<std::string>& DefaultSurfaceConstructions_Impl::outputVariableNames() const {
40
3/4
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
3 static const std::vector<std::string> result;
41 3 return result;
42 }
43
44 3 IddObjectType DefaultSurfaceConstructions_Impl::iddObjectType() const {
45 3 return DefaultSurfaceConstructions::iddObjectType();
46 }
47
48 4112 boost::optional<ConstructionBase> DefaultSurfaceConstructions_Impl::floorConstruction() const {
49
2/2
✓ Branch 1 taken 4112 times.
✓ Branch 4 taken 4112 times.
4112 return getObject<ModelObject>().getModelObjectTarget<ConstructionBase>(OS_DefaultSurfaceConstructionsFields::FloorConstructionName);
50 }
51
52 14817 boost::optional<ConstructionBase> DefaultSurfaceConstructions_Impl::wallConstruction() const {
53
2/2
✓ Branch 1 taken 14817 times.
✓ Branch 4 taken 14817 times.
14817 return getObject<ModelObject>().getModelObjectTarget<ConstructionBase>(OS_DefaultSurfaceConstructionsFields::WallConstructionName);
54 }
55
56 3574 boost::optional<ConstructionBase> DefaultSurfaceConstructions_Impl::roofCeilingConstruction() const {
57
2/2
✓ Branch 1 taken 3574 times.
✓ Branch 4 taken 3574 times.
3574 return getObject<ModelObject>().getModelObjectTarget<ConstructionBase>(OS_DefaultSurfaceConstructionsFields::RoofCeilingConstructionName);
58 }
59
60 356 bool DefaultSurfaceConstructions_Impl::setFloorConstruction(const ConstructionBase& construction) {
61
2/2
✓ Branch 1 taken 356 times.
✓ Branch 4 taken 356 times.
356 return setPointer(OS_DefaultSurfaceConstructionsFields::FloorConstructionName, construction.handle());
62 }
63
64 4 void DefaultSurfaceConstructions_Impl::resetFloorConstruction() {
65
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
8 setString(OS_DefaultSurfaceConstructionsFields::FloorConstructionName, "");
66 4 }
67
68 417 bool DefaultSurfaceConstructions_Impl::setWallConstruction(const ConstructionBase& construction) {
69
2/2
✓ Branch 1 taken 417 times.
✓ Branch 4 taken 417 times.
417 return setPointer(OS_DefaultSurfaceConstructionsFields::WallConstructionName, construction.handle());
70 }
71
72 4 void DefaultSurfaceConstructions_Impl::resetWallConstruction() {
73
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
8 setString(OS_DefaultSurfaceConstructionsFields::WallConstructionName, "");
74 4 }
75
76 421 bool DefaultSurfaceConstructions_Impl::setRoofCeilingConstruction(const ConstructionBase& construction) {
77
2/2
✓ Branch 1 taken 421 times.
✓ Branch 4 taken 421 times.
421 return setPointer(OS_DefaultSurfaceConstructionsFields::RoofCeilingConstructionName, construction.handle());
78 }
79
80 4 void DefaultSurfaceConstructions_Impl::resetRoofCeilingConstruction() {
81
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
8 setString(OS_DefaultSurfaceConstructionsFields::RoofCeilingConstructionName, "");
82 4 }
83
84 37 void DefaultSurfaceConstructions_Impl::merge(const DefaultSurfaceConstructions& other) {
85 37 boost::optional<ConstructionBase> construction;
86
87
3/3
✓ Branch 1 taken 37 times.
✓ Branch 5 taken 36 times.
✓ Branch 6 taken 1 time.
37 if (!(this->floorConstruction())) {
88
1/1
✓ Branch 1 taken 36 times.
36 construction = other.floorConstruction();
89
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 34 times.
36 if (construction) {
90
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 this->setFloorConstruction(*construction);
91 }
92 }
93
94
3/3
✓ Branch 1 taken 37 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 35 times.
37 if (!(this->wallConstruction())) {
95
1/1
✓ Branch 1 taken 2 times.
2 construction = other.wallConstruction();
96
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (construction) {
97
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 this->setWallConstruction(*construction);
98 }
99 }
100
101
3/3
✓ Branch 1 taken 37 times.
✓ Branch 5 taken 35 times.
✓ Branch 6 taken 2 times.
37 if (!(this->roofCeilingConstruction())) {
102
1/1
✓ Branch 1 taken 35 times.
35 construction = other.roofCeilingConstruction();
103
2/2
✓ Branch 0 taken 29 times.
✓ Branch 1 taken 6 times.
35 if (construction) {
104
2/2
✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
29 this->setRoofCeilingConstruction(*construction);
105 }
106 }
107 37 }
108
109 ✗ boost::optional<ModelObject> DefaultSurfaceConstructions_Impl::floorConstructionAsModelObject() const {
110 ✗ OptionalModelObject result;
111 ✗ OptionalConstructionBase intermediate = floorConstruction();
112 ✗ if (intermediate) {
113 ✗ result = *intermediate;
114 }
115 ✗ return result;
116 ✗ }
117
118 ✗ boost::optional<ModelObject> DefaultSurfaceConstructions_Impl::wallConstructionAsModelObject() const {
119 ✗ OptionalModelObject result;
120 ✗ OptionalConstructionBase intermediate = wallConstruction();
121 ✗ if (intermediate) {
122 ✗ result = *intermediate;
123 }
124 ✗ return result;
125 ✗ }
126
127 ✗ boost::optional<ModelObject> DefaultSurfaceConstructions_Impl::roofCeilingConstructionAsModelObject() const {
128 ✗ OptionalModelObject result;
129 ✗ OptionalConstructionBase intermediate = roofCeilingConstruction();
130 ✗ if (intermediate) {
131 ✗ result = *intermediate;
132 }
133 ✗ return result;
134 ✗ }
135
136 ✗ bool DefaultSurfaceConstructions_Impl::setFloorConstructionAsModelObject(boost::optional<ModelObject> modelObject) {
137 ✗ if (modelObject) {
138 ✗ OptionalConstructionBase intermediate = modelObject->optionalCast<ConstructionBase>();
139 ✗ if (intermediate) {
140 ✗ return setFloorConstruction(*intermediate);
141 } else {
142 ✗ return false;
143 }
144 ✗ } else {
145 ✗ resetFloorConstruction();
146 }
147 ✗ return true;
148 }
149
150 ✗ bool DefaultSurfaceConstructions_Impl::setWallConstructionAsModelObject(boost::optional<ModelObject> modelObject) {
151 ✗ if (modelObject) {
152 ✗ OptionalConstructionBase intermediate = modelObject->optionalCast<ConstructionBase>();
153 ✗ if (intermediate) {
154 ✗ return setWallConstruction(*intermediate);
155 } else {
156 ✗ return false;
157 }
158 ✗ } else {
159 ✗ resetWallConstruction();
160 }
161 ✗ return true;
162 }
163
164 ✗ bool DefaultSurfaceConstructions_Impl::setRoofCeilingConstructionAsModelObject(boost::optional<ModelObject> modelObject) {
165 ✗ if (modelObject) {
166 ✗ OptionalConstructionBase intermediate = modelObject->optionalCast<ConstructionBase>();
167 ✗ if (intermediate) {
168 ✗ return setRoofCeilingConstruction(*intermediate);
169 } else {
170 ✗ return false;
171 }
172 ✗ } else {
173 ✗ resetRoofCeilingConstruction();
174 }
175 ✗ return true;
176 }
177
178 } // namespace detail
179
180 626 DefaultSurfaceConstructions::DefaultSurfaceConstructions(const Model& model) : ResourceObject(DefaultSurfaceConstructions::iddObjectType(), model) {
181
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 626 times.
✗ Branch 5 not taken.
626 OS_ASSERT(getImpl<detail::DefaultSurfaceConstructions_Impl>());
182 626 }
183
184 9467 IddObjectType DefaultSurfaceConstructions::iddObjectType() {
185
1/1
✓ Branch 1 taken 9467 times.
9467 IddObjectType result(IddObjectType::OS_DefaultSurfaceConstructions);
186 9467 return result;
187 }
188
189 4075 boost::optional<ConstructionBase> DefaultSurfaceConstructions::floorConstruction() const {
190
1/1
✓ Branch 3 taken 4075 times.
4075 return getImpl<detail::DefaultSurfaceConstructions_Impl>()->floorConstruction();
191 }
192
193 14780 boost::optional<ConstructionBase> DefaultSurfaceConstructions::wallConstruction() const {
194
1/1
✓ Branch 3 taken 14780 times.
14780 return getImpl<detail::DefaultSurfaceConstructions_Impl>()->wallConstruction();
195 }
196
197 3537 boost::optional<ConstructionBase> DefaultSurfaceConstructions::roofCeilingConstruction() const {
198
1/1
✓ Branch 3 taken 3537 times.
3537 return getImpl<detail::DefaultSurfaceConstructions_Impl>()->roofCeilingConstruction();
199 }
200
201 354 bool DefaultSurfaceConstructions::setFloorConstruction(const ConstructionBase& construction) {
202
1/1
✓ Branch 3 taken 354 times.
354 return getImpl<detail::DefaultSurfaceConstructions_Impl>()->setFloorConstruction(construction);
203 }
204
205 4 void DefaultSurfaceConstructions::resetFloorConstruction() {
206
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::DefaultSurfaceConstructions_Impl>()->resetFloorConstruction();
207 }
208
209 415 bool DefaultSurfaceConstructions::setWallConstruction(const ConstructionBase& construction) {
210
1/1
✓ Branch 3 taken 415 times.
415 return getImpl<detail::DefaultSurfaceConstructions_Impl>()->setWallConstruction(construction);
211 }
212
213 4 void DefaultSurfaceConstructions::resetWallConstruction() {
214
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::DefaultSurfaceConstructions_Impl>()->resetWallConstruction();
215 }
216
217 392 bool DefaultSurfaceConstructions::setRoofCeilingConstruction(const ConstructionBase& construction) {
218
1/1
✓ Branch 3 taken 392 times.
392 return getImpl<detail::DefaultSurfaceConstructions_Impl>()->setRoofCeilingConstruction(construction);
219 }
220
221 4 void DefaultSurfaceConstructions::resetRoofCeilingConstruction() {
222
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::DefaultSurfaceConstructions_Impl>()->resetRoofCeilingConstruction();
223 }
224
225 37 void DefaultSurfaceConstructions::merge(const DefaultSurfaceConstructions& other) {
226
1/1
✓ Branch 3 taken 37 times.
37 return getImpl<detail::DefaultSurfaceConstructions_Impl>()->merge(other);
227 }
228
229 /// @cond
230 21501 DefaultSurfaceConstructions::DefaultSurfaceConstructions(std::shared_ptr<detail::DefaultSurfaceConstructions_Impl> impl)
231
1/1
✓ Branch 3 taken 21501 times.
21501 : ResourceObject(std::move(impl)) {}
232 /// @endcond
233
234 } // namespace model
235 } // namespace openstudio
236