GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 80.0% 60 / 0 / 75
Functions: 85.0% 17 / 0 / 20
Branches: 39.7% 31 / 0 / 78

src/model/ExternalInterfaceFunctionalMockupUnitExportFromVariable.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 "ExternalInterfaceFunctionalMockupUnitExportFromVariable.hpp"
7 #include "ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl.hpp"
8
9 #include <utilities/idd/IddEnums.hxx>
10 #include <utilities/idd/OS_ExternalInterface_FunctionalMockupUnitExport_From_Variable_FieldEnums.hxx>
11
12 #include "../utilities/core/Assert.hpp"
13
14 namespace openstudio {
15 namespace model {
16
17 namespace detail {
18
19 2 ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl::ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl(
20 2 const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
21 2 : ModelObject_Impl(idfObject, model, keepHandle) {
22
4/6
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
✗ Branch 13 not taken.
2 OS_ASSERT(idfObject.iddObject().type() == ExternalInterfaceFunctionalMockupUnitExportFromVariable::iddObjectType());
23 2 }
24
25 ✗ ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl::ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl(
26 ✗ const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
27 ✗ : ModelObject_Impl(other, model, keepHandle) {
28 ✗ OS_ASSERT(other.iddObject().type() == ExternalInterfaceFunctionalMockupUnitExportFromVariable::iddObjectType());
29 ✗ }
30
31 1 ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl::ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl(
32 1 const ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl& other, Model_Impl* model, bool keepHandle)
33 1 : ModelObject_Impl(other, model, keepHandle) {}
34
35 ✗ const std::vector<std::string>& ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl::outputVariableNames() const {
36 ✗ static const std::vector<std::string> result;
37 ✗ return result;
38 }
39
40 ✗ IddObjectType ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl::iddObjectType() const {
41 ✗ return ExternalInterfaceFunctionalMockupUnitExportFromVariable::iddObjectType();
42 }
43
44 3 std::string ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl::outputVariableIndexKeyName() const {
45 boost::optional<std::string> value =
46
1/1
✓ Branch 1 taken 3 times.
3 getString(OS_ExternalInterface_FunctionalMockupUnitExport_From_VariableFields::Output_VariableIndexKeyName, true);
47
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (value) {
48
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 return value.get();
49 }
50 ✗ return "";
51 3 }
52
53 3 std::string ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl::outputVariableName() const {
54
1/1
✓ Branch 1 taken 3 times.
3 boost::optional<std::string> value = getString(OS_ExternalInterface_FunctionalMockupUnitExport_From_VariableFields::Output_VariableName, true);
55
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (value) {
56
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 return value.get();
57 }
58 ✗ return "";
59 3 }
60
61 3 std::string ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl::fMUVariableName() const {
62
1/1
✓ Branch 1 taken 3 times.
3 boost::optional<std::string> value = getString(OS_ExternalInterface_FunctionalMockupUnitExport_From_VariableFields::FMUVariableName, true);
63
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
3 if (value) {
64
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 return value.get();
65 }
66 ✗ return "";
67 3 }
68
69 3 bool ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl::setOutputVariableIndexKeyName(const std::string& outputVariableIndexKeyName) {
70 bool result =
71 3 setString(OS_ExternalInterface_FunctionalMockupUnitExport_From_VariableFields::Output_VariableIndexKeyName, outputVariableIndexKeyName);
72
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 OS_ASSERT(result);
73 3 return result;
74 }
75
76 3 bool ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl::setOutputVariableName(const std::string& outputVariableName) {
77 3 bool result = setString(OS_ExternalInterface_FunctionalMockupUnitExport_From_VariableFields::Output_VariableName, outputVariableName);
78 3 return result;
79 }
80
81 3 bool ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl::setFMUVariableName(const std::string& fMUVariableName) {
82 3 bool result = setString(OS_ExternalInterface_FunctionalMockupUnitExport_From_VariableFields::FMUVariableName, fMUVariableName);
83
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 OS_ASSERT(result);
84 3 return result;
85 }
86
87 } // namespace detail
88
89 2 ExternalInterfaceFunctionalMockupUnitExportFromVariable::ExternalInterfaceFunctionalMockupUnitExportFromVariable(
90 2 const Model& model, const std::string& outputVariableIndexKeyName, const std::string& outputVariableName, const std::string& fMUVariableName)
91 2 : ModelObject(ExternalInterfaceFunctionalMockupUnitExportFromVariable::iddObjectType(), model) {
92
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 5 not taken.
2 OS_ASSERT(getImpl<detail::ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl>());
93
94
1/1
✓ Branch 1 taken 2 times.
2 setOutputVariableIndexKeyName(outputVariableIndexKeyName);
95
1/1
✓ Branch 1 taken 2 times.
2 bool ok = setOutputVariableName(outputVariableName);
96
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (!ok) {
97 ✗ remove();
98 ✗ LOG_AND_THROW("Unable to set " << briefDescription() << "'s OutputVariableName to " << outputVariableName << ".");
99 }
100
1/1
✓ Branch 1 taken 2 times.
2 setFMUVariableName(fMUVariableName);
101 2 }
102
103 7732 IddObjectType ExternalInterfaceFunctionalMockupUnitExportFromVariable::iddObjectType() {
104
1/1
✓ Branch 1 taken 7732 times.
7732 return {IddObjectType::OS_ExternalInterface_FunctionalMockupUnitExport_From_Variable};
105 }
106
107 3 std::string ExternalInterfaceFunctionalMockupUnitExportFromVariable::outputVariableIndexKeyName() const {
108
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl>()->outputVariableIndexKeyName();
109 }
110
111 3 std::string ExternalInterfaceFunctionalMockupUnitExportFromVariable::outputVariableName() const {
112
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl>()->outputVariableName();
113 }
114
115 3 std::string ExternalInterfaceFunctionalMockupUnitExportFromVariable::fMUVariableName() const {
116
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl>()->fMUVariableName();
117 }
118
119 3 bool ExternalInterfaceFunctionalMockupUnitExportFromVariable::setOutputVariableIndexKeyName(const std::string& outputVariableIndexKeyName) {
120
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl>()->setOutputVariableIndexKeyName(outputVariableIndexKeyName);
121 }
122
123 3 bool ExternalInterfaceFunctionalMockupUnitExportFromVariable::setOutputVariableName(const std::string& outputVariableName) {
124
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl>()->setOutputVariableName(outputVariableName);
125 }
126
127 3 bool ExternalInterfaceFunctionalMockupUnitExportFromVariable::setFMUVariableName(const std::string& fMUVariableName) {
128
1/1
✓ Branch 3 taken 3 times.
3 return getImpl<detail::ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl>()->setFMUVariableName(fMUVariableName);
129 }
130
131 /// @cond
132 1 ExternalInterfaceFunctionalMockupUnitExportFromVariable::ExternalInterfaceFunctionalMockupUnitExportFromVariable(
133 1 std::shared_ptr<detail::ExternalInterfaceFunctionalMockupUnitExportFromVariable_Impl> impl)
134
1/1
✓ Branch 2 taken 1 time.
1 : ModelObject(impl) {}
135 /// @endcond
136
137 } // namespace model
138 } // namespace openstudio
139