GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 77.4% 41 / 0 / 53
Functions: 77.8% 14 / 0 / 18
Branches: 44.4% 24 / 0 / 54

src/model/OutputSQLite.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 "OutputSQLite.hpp"
7 #include "OutputSQLite_Impl.hpp"
8
9 #include "Model.hpp"
10 #include "Model_Impl.hpp"
11
12 #include <utilities/idd/IddFactory.hxx>
13 #include <utilities/idd/IddEnums.hxx>
14 #include <utilities/idd/OS_Output_SQLite_FieldEnums.hxx>
15
16 #include "../utilities/core/Assert.hpp"
17
18 namespace openstudio {
19 namespace model {
20
21 namespace detail {
22
23 39 OutputSQLite_Impl::OutputSQLite_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
24 39 : ModelObject_Impl(idfObject, model, keepHandle) {
25
4/6
✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
✓ Branch 7 taken 39 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 39 times.
✗ Branch 13 not taken.
39 OS_ASSERT(idfObject.iddObject().type() == OutputSQLite::iddObjectType());
26 39 }
27
28 ✗ OutputSQLite_Impl::OutputSQLite_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
29 ✗ : ModelObject_Impl(other, model, keepHandle) {
30 ✗ OS_ASSERT(other.iddObject().type() == OutputSQLite::iddObjectType());
31 ✗ }
32
33 5 OutputSQLite_Impl::OutputSQLite_Impl(const OutputSQLite_Impl& other, Model_Impl* model, bool keepHandle)
34 5 : ModelObject_Impl(other, model, keepHandle) {}
35
36 ✗ const std::vector<std::string>& OutputSQLite_Impl::outputVariableNames() const {
37 ✗ static const std::vector<std::string> result;
38 ✗ if (result.empty()) {
39 }
40 ✗ return result;
41 }
42
43 2 IddObjectType OutputSQLite_Impl::iddObjectType() const {
44 2 return OutputSQLite::iddObjectType();
45 }
46
47 7 std::string OutputSQLite_Impl::optionType() const {
48
1/1
✓ Branch 1 taken 7 times.
7 boost::optional<std::string> value = getString(OS_Output_SQLiteFields::OptionType, true);
49
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 4 not taken.
7 OS_ASSERT(value);
50
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
14 return value.get();
51 7 }
52
53 8 std::string OutputSQLite_Impl::unitConversionforTabularData() const {
54
1/1
✓ Branch 1 taken 8 times.
8 boost::optional<std::string> value = getString(OS_Output_SQLiteFields::UnitConversionforTabularData, true);
55
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 4 not taken.
8 OS_ASSERT(value);
56
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
16 return value.get();
57 8 }
58
59 77 bool OutputSQLite_Impl::setOptionType(const std::string& optionType) {
60 77 bool result = setString(OS_Output_SQLiteFields::OptionType, optionType);
61 77 return result;
62 }
63
64 78 bool OutputSQLite_Impl::setUnitConversionforTabularData(const std::string& unitConversionforTabularData) {
65 78 bool result = setString(OS_Output_SQLiteFields::UnitConversionforTabularData, unitConversionforTabularData);
66 78 return result;
67 }
68
69 } // namespace detail
70
71 8567 IddObjectType OutputSQLite::iddObjectType() {
72
1/1
✓ Branch 1 taken 8567 times.
8567 return IddObjectType(IddObjectType::OS_Output_SQLite);
73 }
74
75 ✗ std::vector<std::string> OutputSQLite::optionTypeValues() {
76 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Output_SQLiteFields::OptionType);
77 }
78
79 ✗ std::vector<std::string> OutputSQLite::unitConversionforTabularDataValues() {
80 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Output_SQLiteFields::UnitConversionforTabularData);
81 }
82
83 7 std::string OutputSQLite::optionType() const {
84
1/1
✓ Branch 3 taken 7 times.
7 return getImpl<detail::OutputSQLite_Impl>()->optionType();
85 }
86
87 8 std::string OutputSQLite::unitConversionforTabularData() const {
88
1/1
✓ Branch 3 taken 8 times.
8 return getImpl<detail::OutputSQLite_Impl>()->unitConversionforTabularData();
89 }
90
91 77 bool OutputSQLite::setOptionType(const std::string& optionType) {
92
1/1
✓ Branch 3 taken 77 times.
77 return getImpl<detail::OutputSQLite_Impl>()->setOptionType(optionType);
93 }
94
95 78 bool OutputSQLite::setUnitConversionforTabularData(const std::string& unitConversionforTabularData) {
96
1/1
✓ Branch 3 taken 78 times.
78 return getImpl<detail::OutputSQLite_Impl>()->setUnitConversionforTabularData(unitConversionforTabularData);
97 }
98
99 /// @cond
100
1/1
✓ Branch 2 taken 12 times.
12 OutputSQLite::OutputSQLite(std::shared_ptr<detail::OutputSQLite_Impl> impl) : ModelObject(impl) {}
101 39 OutputSQLite::OutputSQLite(Model& model) : ModelObject(OutputSQLite::iddObjectType(), model) {
102
2/2
✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
39 bool ok = setOptionType("SimpleAndTabular");
103
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 39 times.
✗ Branch 3 not taken.
39 OS_ASSERT(ok);
104
2/2
✓ Branch 1 taken 39 times.
✓ Branch 4 taken 39 times.
39 ok = setUnitConversionforTabularData("UseOutputControlTableStyle");
105
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 39 times.
✗ Branch 3 not taken.
39 OS_ASSERT(ok);
106 39 }
107
108 /// @endcond
109
110 } // namespace model
111 } // namespace openstudio
112