GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 65.8% 25 / 0 / 38
Functions: 64.3% 9 / 0 / 14
Branches: 41.7% 15 / 0 / 36

src/model/OutputSchedules.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 "OutputSchedules.hpp"
7 #include "OutputSchedules_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_Schedules_FieldEnums.hxx>
15
16 #include "../utilities/idf/WorkspaceExtensibleGroup.hpp"
17 #include "../utilities/core/Assert.hpp"
18
19 namespace openstudio {
20 namespace model {
21
22 namespace detail {
23
24 5 OutputSchedules_Impl::OutputSchedules_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
25 5 : ModelObject_Impl(idfObject, model, keepHandle) {
26
4/6
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 5 times.
✗ Branch 13 not taken.
5 OS_ASSERT(idfObject.iddObject().type() == OutputSchedules::iddObjectType());
27 5 }
28
29 ✗ OutputSchedules_Impl::OutputSchedules_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
30 ✗ : ModelObject_Impl(other, model, keepHandle) {
31 ✗ OS_ASSERT(other.iddObject().type() == OutputSchedules::iddObjectType());
32 ✗ }
33
34 4 OutputSchedules_Impl::OutputSchedules_Impl(const OutputSchedules_Impl& other, Model_Impl* model, bool keepHandle)
35 4 : ModelObject_Impl(other, model, keepHandle) {}
36
37 ✗ const std::vector<std::string>& OutputSchedules_Impl::outputVariableNames() const {
38 ✗ static const std::vector<std::string> result;
39 ✗ return result;
40 }
41
42 ✗ IddObjectType OutputSchedules_Impl::iddObjectType() const {
43 ✗ return OutputSchedules::iddObjectType();
44 }
45
46 8 std::string OutputSchedules_Impl::keyField() const {
47
1/1
✓ Branch 1 taken 8 times.
8 boost::optional<std::string> value = getString(OS_Output_SchedulesFields::KeyField, true);
48
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 4 not taken.
8 OS_ASSERT(value);
49
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
16 return value.get();
50 8 }
51
52 10 bool OutputSchedules_Impl::setKeyField(const std::string& keyField) {
53 10 bool result = setString(OS_Output_SchedulesFields::KeyField, keyField);
54 10 return result;
55 }
56
57 } // namespace detail
58
59 7753 IddObjectType OutputSchedules::iddObjectType() {
60
1/1
✓ Branch 1 taken 7753 times.
7753 return {IddObjectType::OS_Output_Schedules};
61 }
62
63 ✗ std::vector<std::string> OutputSchedules::keyFieldValues() {
64 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_Output_SchedulesFields::KeyField);
65 }
66
67 ✗ std::vector<std::string> OutputSchedules::validKeyFieldValues() {
68 ✗ return keyFieldValues();
69 }
70
71 8 std::string OutputSchedules::keyField() const {
72
1/1
✓ Branch 3 taken 8 times.
8 return getImpl<detail::OutputSchedules_Impl>()->keyField();
73 }
74
75 10 bool OutputSchedules::setKeyField(const std::string& keyField) {
76
1/1
✓ Branch 3 taken 10 times.
10 return getImpl<detail::OutputSchedules_Impl>()->setKeyField(keyField);
77 }
78
79 /// @cond
80
1/1
✓ Branch 2 taken 10 times.
10 OutputSchedules::OutputSchedules(std::shared_ptr<detail::OutputSchedules_Impl> impl) : ModelObject(impl) {}
81 5 OutputSchedules::OutputSchedules(Model& model) : ModelObject(OutputSchedules::iddObjectType(), model) {
82
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 bool ok = setKeyField("Hourly");
83
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
5 OS_ASSERT(ok);
84 5 }
85
86 /// @endcond
87
88 } // namespace model
89 } // namespace openstudio
90