GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 77.3% 51 / 0 / 66
Functions: 75.0% 15 / 0 / 20
Branches: 64.8% 35 / 0 / 54

src/model/LightingSimulationZone.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 "LightingSimulationZone.hpp"
7 #include "LightingSimulationZone_Impl.hpp"
8
9 #include "Model.hpp"
10 #include "Model_Impl.hpp"
11 #include "RenderingColor.hpp"
12 #include "RenderingColor_Impl.hpp"
13 #include "Space.hpp"
14 #include "Space_Impl.hpp"
15
16 #include "../utilities/idf/IdfExtensibleGroup.hpp"
17 #include "ModelExtensibleGroup.hpp"
18 #include <utilities/idd/OS_LightingSimulationZone_FieldEnums.hxx>
19 #include <utilities/idd/IddEnums.hxx>
20
21 #include "../utilities/core/Assert.hpp"
22
23 namespace openstudio {
24 namespace model {
25
26 namespace detail {
27
28 1 LightingSimulationZone_Impl::LightingSimulationZone_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
29 1 : ModelObject_Impl(idfObject, model, keepHandle) {
30
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() == LightingSimulationZone::iddObjectType());
31 1 }
32
33 ✗ LightingSimulationZone_Impl::LightingSimulationZone_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model,
34 ✗ bool keepHandle)
35 ✗ : ModelObject_Impl(other, model, keepHandle) {
36 ✗ OS_ASSERT(other.iddObject().type() == LightingSimulationZone::iddObjectType());
37 ✗ }
38
39 ✗ LightingSimulationZone_Impl::LightingSimulationZone_Impl(const LightingSimulationZone_Impl& other, Model_Impl* model, bool keepHandle)
40 ✗ : ModelObject_Impl(other, model, keepHandle) {}
41
42 ✗ const std::vector<std::string>& LightingSimulationZone_Impl::outputVariableNames() const {
43 ✗ static const std::vector<std::string> result;
44 ✗ return result;
45 }
46
47 ✗ IddObjectType LightingSimulationZone_Impl::iddObjectType() const {
48 ✗ return LightingSimulationZone::iddObjectType();
49 }
50
51 4 boost::optional<RenderingColor> LightingSimulationZone_Impl::renderingColor() const {
52
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 return getObject<ModelObject>().getModelObjectTarget<RenderingColor>(OS_LightingSimulationZoneFields::GroupRenderingName);
53 }
54
55 1 bool LightingSimulationZone_Impl::setRenderingColor(const RenderingColor& renderingColor) {
56
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 return setPointer(OS_LightingSimulationZoneFields::GroupRenderingName, renderingColor.handle());
57 }
58
59 1 void LightingSimulationZone_Impl::resetRenderingColor() {
60
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 setString(OS_LightingSimulationZoneFields::GroupRenderingName, "");
61 1 }
62
63 7 std::vector<Space> LightingSimulationZone_Impl::spaces() const {
64 7 std::vector<Space> result;
65
66
4/4
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 12 taken 8 times.
✓ Branch 13 taken 7 times.
15 for (const ModelExtensibleGroup& group : castVector<ModelExtensibleGroup>(extensibleGroups())) {
67
1/1
✓ Branch 1 taken 8 times.
8 boost::optional<Space> space = group.getModelObjectTarget<Space>(0);
68
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 4 not taken.
8 OS_ASSERT(space);
69
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 result.push_back(*space);
70 15 }
71
72 7 return result;
73 ✗ }
74
75 2 bool LightingSimulationZone_Impl::addSpace(const Space& space) {
76
1/1
✓ Branch 1 taken 2 times.
2 boost::optional<std::string> spaceName = space.name();
77
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
2 if (!spaceName) {
78 ✗ return false;
79 }
80 2 std::vector<std::string> values;
81
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 values.push_back(space.name().get());
82
1/1
✓ Branch 1 taken 2 times.
2 IdfExtensibleGroup group = pushExtensibleGroup(values);
83
84
1/1
✓ Branch 1 taken 2 times.
2 return (!group.empty());
85 2 }
86
87 1 void LightingSimulationZone_Impl::resetSpaces() {
88
1/1
✓ Branch 1 taken 1 time.
1 clearExtensibleGroups();
89
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
1 OS_ASSERT(numExtensibleGroups() == 0);
90 1 }
91
92 } // namespace detail
93
94 1 LightingSimulationZone::LightingSimulationZone(const Model& model) : ModelObject(LightingSimulationZone::iddObjectType(), model) {
95
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 5 not taken.
1 OS_ASSERT(getImpl<detail::LightingSimulationZone_Impl>());
96 1 }
97
98 7600 IddObjectType LightingSimulationZone::iddObjectType() {
99
1/1
✓ Branch 1 taken 7600 times.
7600 IddObjectType result(IddObjectType::OS_LightingSimulationZone);
100 7600 return result;
101 }
102
103 4 boost::optional<RenderingColor> LightingSimulationZone::renderingColor() const {
104
1/1
✓ Branch 3 taken 4 times.
4 return getImpl<detail::LightingSimulationZone_Impl>()->renderingColor();
105 }
106
107 1 bool LightingSimulationZone::setRenderingColor(const RenderingColor& renderingColor) {
108
1/1
✓ Branch 3 taken 1 time.
1 return getImpl<detail::LightingSimulationZone_Impl>()->setRenderingColor(renderingColor);
109 }
110
111 1 void LightingSimulationZone::resetRenderingColor() {
112
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::LightingSimulationZone_Impl>()->resetRenderingColor();
113 1 }
114
115 7 std::vector<Space> LightingSimulationZone::spaces() const {
116
1/1
✓ Branch 3 taken 7 times.
7 return getImpl<detail::LightingSimulationZone_Impl>()->spaces();
117 }
118
119 2 bool LightingSimulationZone::addSpace(const Space& space) {
120
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::LightingSimulationZone_Impl>()->addSpace(space);
121 }
122
123 1 void LightingSimulationZone::resetSpaces() {
124
1/1
✓ Branch 3 taken 1 time.
1 getImpl<detail::LightingSimulationZone_Impl>()->resetSpaces();
125 1 }
126
127 /// @cond
128 ✗ LightingSimulationZone::LightingSimulationZone(std::shared_ptr<detail::LightingSimulationZone_Impl> impl) : ModelObject(std::move(impl)) {}
129 /// @endcond
130
131 } // namespace model
132 } // namespace openstudio
133