GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 76.4% 42 / 0 / 55
Functions: 78.6% 11 / 0 / 14
Branches: 32.9% 24 / 0 / 73

src/model/EnergyManagementSystemConstructionIndexVariable.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 "EnergyManagementSystemConstructionIndexVariable.hpp"
7 #include "EnergyManagementSystemConstructionIndexVariable_Impl.hpp"
8
9 #include "Construction.hpp"
10 #include "Construction_Impl.hpp"
11
12 #include <utilities/idd/IddEnums.hxx>
13 #include <utilities/idd/OS_EnergyManagementSystem_ConstructionIndexVariable_FieldEnums.hxx>
14
15 #include "../utilities/core/Assert.hpp"
16
17 namespace openstudio {
18 namespace model {
19
20 namespace detail {
21
22 7 EnergyManagementSystemConstructionIndexVariable_Impl::EnergyManagementSystemConstructionIndexVariable_Impl(const IdfObject& idfObject,
23 7 Model_Impl* model, bool keepHandle)
24 7 : ModelObject_Impl(idfObject, model, keepHandle) {
25
4/6
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 7 times.
✗ Branch 13 not taken.
7 OS_ASSERT(idfObject.iddObject().type() == EnergyManagementSystemConstructionIndexVariable::iddObjectType());
26 7 }
27
28 ✗ EnergyManagementSystemConstructionIndexVariable_Impl::EnergyManagementSystemConstructionIndexVariable_Impl(
29 ✗ const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
30 ✗ : ModelObject_Impl(other, model, keepHandle) {
31 ✗ OS_ASSERT(other.iddObject().type() == EnergyManagementSystemConstructionIndexVariable::iddObjectType());
32 ✗ }
33
34 4 EnergyManagementSystemConstructionIndexVariable_Impl::EnergyManagementSystemConstructionIndexVariable_Impl(
35 4 const EnergyManagementSystemConstructionIndexVariable_Impl& other, Model_Impl* model, bool keepHandle)
36 4 : ModelObject_Impl(other, model, keepHandle) {}
37
38 ✗ const std::vector<std::string>& EnergyManagementSystemConstructionIndexVariable_Impl::outputVariableNames() const {
39 ✗ static const std::vector<std::string> result;
40 ✗ return result;
41 }
42
43 ✗ IddObjectType EnergyManagementSystemConstructionIndexVariable_Impl::iddObjectType() const {
44 ✗ return EnergyManagementSystemConstructionIndexVariable::iddObjectType();
45 }
46
47 5 ModelObject EnergyManagementSystemConstructionIndexVariable_Impl::constructionObject() const {
48
1/1
✓ Branch 1 taken 5 times.
5 boost::optional<ModelObject> value = optionalConstructionObject();
49
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
5 if (!value) {
50 ✗ LOG(Info, " does not have an Construction Object attached.");
51 }
52
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
10 return value.get();
53 5 }
54
55 13 bool EnergyManagementSystemConstructionIndexVariable_Impl::setConstructionObject(const ModelObject& construction) {
56
2/2
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
13 bool result = setPointer(OS_EnergyManagementSystem_ConstructionIndexVariableFields::ConstructionObjectName, construction.handle());
57 13 return result;
58 }
59
60 5 boost::optional<ModelObject> EnergyManagementSystemConstructionIndexVariable_Impl::optionalConstructionObject() const {
61
1/1
✓ Branch 1 taken 5 times.
10 return getObject<ModelObject>().getModelObjectTarget<ModelObject>(
62
1/1
✓ Branch 1 taken 5 times.
10 OS_EnergyManagementSystem_ConstructionIndexVariableFields::ConstructionObjectName);
63 }
64
65 } // namespace detail
66
67 1 EnergyManagementSystemConstructionIndexVariable::EnergyManagementSystemConstructionIndexVariable(const Model& model,
68 1 const Construction& construction)
69 1 : ModelObject(EnergyManagementSystemConstructionIndexVariable::iddObjectType(), model) {
70
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 1 time.
✗ Branch 5 not taken.
1 OS_ASSERT(getImpl<detail::EnergyManagementSystemConstructionIndexVariable_Impl>());
71
1/1
✓ Branch 1 taken 1 time.
1 bool ok = setConstructionObject(construction);
72
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
1 if (!ok) {
73 ✗ remove();
74 ✗ LOG_AND_THROW("Unable to set " << briefDescription() << "'s Construction to " << construction.briefDescription() << ".");
75 }
76 1 }
77
78 6 EnergyManagementSystemConstructionIndexVariable::EnergyManagementSystemConstructionIndexVariable(const Model& model)
79 6 : ModelObject(EnergyManagementSystemConstructionIndexVariable::iddObjectType(), model) {
80
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✗ Branch 5 not taken.
6 OS_ASSERT(getImpl<detail::EnergyManagementSystemConstructionIndexVariable_Impl>());
81
1/1
✓ Branch 1 taken 6 times.
6 Construction construction = Construction(model);
82
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 construction.setName("Generic Construction");
83
1/1
✓ Branch 1 taken 6 times.
6 setConstructionObject(construction);
84 6 }
85
86 7612 IddObjectType EnergyManagementSystemConstructionIndexVariable::iddObjectType() {
87
1/1
✓ Branch 1 taken 7612 times.
7612 return {IddObjectType::OS_EnergyManagementSystem_ConstructionIndexVariable};
88 }
89
90 5 ModelObject EnergyManagementSystemConstructionIndexVariable::constructionObject() const {
91
1/1
✓ Branch 3 taken 5 times.
5 return getImpl<detail::EnergyManagementSystemConstructionIndexVariable_Impl>()->constructionObject();
92 }
93
94 13 bool EnergyManagementSystemConstructionIndexVariable::setConstructionObject(const ModelObject& construction) {
95
1/1
✓ Branch 3 taken 13 times.
13 return getImpl<detail::EnergyManagementSystemConstructionIndexVariable_Impl>()->setConstructionObject(construction);
96 }
97
98 /// @cond
99 4 EnergyManagementSystemConstructionIndexVariable::EnergyManagementSystemConstructionIndexVariable(
100 4 std::shared_ptr<detail::EnergyManagementSystemConstructionIndexVariable_Impl> impl)
101
1/1
✓ Branch 3 taken 4 times.
4 : ModelObject(std::move(impl)) {}
102 /// @endcond
103
104 } // namespace model
105 } // namespace openstudio
106