GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 49.6% 64 / 0 / 129
Functions: 76.5% 26 / 0 / 34
Branches: 36.6% 41 / 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 758 DefaultSurfaceConstructions_Impl::DefaultSurfaceConstructions_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
25 758 : ResourceObject_Impl(idfObject, model, keepHandle) {
26
4/6
✓ Branch 1 taken 758 times.
✓ Branch 4 taken 758 times.
✓ Branch 7 taken 758 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 758 times.
✗ Branch 13 not taken.
758 OS_ASSERT(idfObject.iddObject().type() == DefaultSurfaceConstructions::iddObjectType());
27 758 }
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 486 DefaultSurfaceConstructions_Impl::DefaultSurfaceConstructions_Impl(const DefaultSurfaceConstructions_Impl& other, Model_Impl* model,
36 486 bool keepHandle)
37 486 : 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 3496 boost::optional<ConstructionBase> DefaultSurfaceConstructions_Impl::floorConstruction() const {
49
2/2
✓ Branch 1 taken 3496 times.
✓ Branch 4 taken 3496 times.
3496 return getObject<ModelObject>().getModelObjectTarget<ConstructionBase>(OS_DefaultSurfaceConstructionsFields::FloorConstructionName);
50 }
51
52 14270 boost::optional<ConstructionBase> DefaultSurfaceConstructions_Impl::wallConstruction() const {
53
2/2
✓ Branch 1 taken 14270 times.
✓ Branch 4 taken 14270 times.
14270 return getObject<ModelObject>().getModelObjectTarget<ConstructionBase>(OS_DefaultSurfaceConstructionsFields::WallConstructionName);
54 }
55
56 2909 boost::optional<ConstructionBase> DefaultSurfaceConstructions_Impl::roofCeilingConstruction() const {
57
2/2
✓ Branch 1 taken 2909 times.
✓ Branch 4 taken 2909 times.
2909 return getObject<ModelObject>().getModelObjectTarget<ConstructionBase>(OS_DefaultSurfaceConstructionsFields::RoofCeilingConstructionName);
58 }
59
60 341 bool DefaultSurfaceConstructions_Impl::setFloorConstruction(const ConstructionBase& construction) {
61
2/2
✓ Branch 1 taken 341 times.
✓ Branch 4 taken 341 times.
341 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 346 bool DefaultSurfaceConstructions_Impl::setWallConstruction(const ConstructionBase& construction) {
69
2/2
✓ Branch 1 taken 346 times.
✓ Branch 4 taken 346 times.
346 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 356 bool DefaultSurfaceConstructions_Impl::setRoofCeilingConstruction(const ConstructionBase& construction) {
77
2/2
✓ Branch 1 taken 356 times.
✓ Branch 4 taken 356 times.
356 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 ✗ void DefaultSurfaceConstructions_Impl::merge(const DefaultSurfaceConstructions& other) {
85 ✗ boost::optional<ConstructionBase> construction;
86
87 ✗ if (!(this->floorConstruction())) {
88 ✗ construction = other.floorConstruction();
89 ✗ if (construction) {
90 ✗ this->setFloorConstruction(*construction);
91 }
92 }
93
94 ✗ if (!(this->wallConstruction())) {
95 ✗ construction = other.wallConstruction();
96 ✗ if (construction) {
97 ✗ this->setWallConstruction(*construction);
98 }
99 }
100
101 ✗ if (!(this->roofCeilingConstruction())) {
102 ✗ construction = other.roofCeilingConstruction();
103 ✗ if (construction) {
104 ✗ this->setRoofCeilingConstruction(*construction);
105 }
106 }
107 ✗ }
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 522 DefaultSurfaceConstructions::DefaultSurfaceConstructions(const Model& model) : ResourceObject(DefaultSurfaceConstructions::iddObjectType(), model) {
181
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 522 times.
✗ Branch 5 not taken.
522 OS_ASSERT(getImpl<detail::DefaultSurfaceConstructions_Impl>());
182 522 }
183
184 9118 IddObjectType DefaultSurfaceConstructions::iddObjectType() {
185
1/1
✓ Branch 1 taken 9118 times.
9118 IddObjectType result(IddObjectType::OS_DefaultSurfaceConstructions);
186 9118 return result;
187 }
188
189 3496 boost::optional<ConstructionBase> DefaultSurfaceConstructions::floorConstruction() const {
190
1/1
✓ Branch 3 taken 3496 times.
3496 return getImpl<detail::DefaultSurfaceConstructions_Impl>()->floorConstruction();
191 }
192
193 14270 boost::optional<ConstructionBase> DefaultSurfaceConstructions::wallConstruction() const {
194
1/1
✓ Branch 3 taken 14270 times.
14270 return getImpl<detail::DefaultSurfaceConstructions_Impl>()->wallConstruction();
195 }
196
197 2909 boost::optional<ConstructionBase> DefaultSurfaceConstructions::roofCeilingConstruction() const {
198
1/1
✓ Branch 3 taken 2909 times.
2909 return getImpl<detail::DefaultSurfaceConstructions_Impl>()->roofCeilingConstruction();
199 }
200
201 341 bool DefaultSurfaceConstructions::setFloorConstruction(const ConstructionBase& construction) {
202
1/1
✓ Branch 3 taken 341 times.
341 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 346 bool DefaultSurfaceConstructions::setWallConstruction(const ConstructionBase& construction) {
210
1/1
✓ Branch 3 taken 346 times.
346 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 356 bool DefaultSurfaceConstructions::setRoofCeilingConstruction(const ConstructionBase& construction) {
218
1/1
✓ Branch 3 taken 356 times.
356 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 ✗ void DefaultSurfaceConstructions::merge(const DefaultSurfaceConstructions& other) {
226 ✗ return getImpl<detail::DefaultSurfaceConstructions_Impl>()->merge(other);
227 }
228
229 /// @cond
230 20692 DefaultSurfaceConstructions::DefaultSurfaceConstructions(std::shared_ptr<detail::DefaultSurfaceConstructions_Impl> impl)
231
1/1
✓ Branch 3 taken 20692 times.
20692 : ResourceObject(std::move(impl)) {}
232 /// @endcond
233
234 } // namespace model
235 } // namespace openstudio
236