GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 61.3% 19 / 0 / 31
Functions: 70.0% 7 / 0 / 10
Branches: 22.9% 8 / 0 / 35

src/model/SizingPeriod.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 "SizingPeriod.hpp"
7 #include "SizingPeriod_Impl.hpp"
8 #include "Site.hpp"
9 #include "Site_Impl.hpp"
10 #include "SkyTemperature.hpp"
11 #include "SkyTemperature_Impl.hpp"
12
13 #include "Model.hpp"
14 #include "Model_Impl.hpp"
15
16 #include "../utilities/core/Assert.hpp"
17
18 namespace openstudio {
19 namespace model {
20
21 namespace detail {
22
23 544 SizingPeriod_Impl::SizingPeriod_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
24 544 : ParentObject_Impl(idfObject, model, keepHandle) {}
25
26 154 SizingPeriod_Impl::SizingPeriod_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
27 154 : ParentObject_Impl(other, model, keepHandle) {}
28
29 484 SizingPeriod_Impl::SizingPeriod_Impl(const SizingPeriod_Impl& other, Model_Impl* model, bool keepHandle)
30 484 : ParentObject_Impl(other, model, keepHandle) {}
31
32 // return the parent object in the hierarchy
33 8 boost::optional<ParentObject> SizingPeriod_Impl::parent() const {
34
3/3
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
8 boost::optional<ParentObject> result(model().getOptionalUniqueModelObject<Site>());
35 8 return result;
36 }
37
38 // set the parent, child may have to call methods on the parent
39 ✗ bool SizingPeriod_Impl::setParent(ParentObject& newParent) {
40 ✗ if (newParent.optionalCast<Site>() && (newParent.model() == model())) {
41 ✗ return true;
42 }
43 ✗ return false;
44 }
45
46 // return any children objects in the hierarchy
47 169 std::vector<ModelObject> SizingPeriod_Impl::children() const {
48 169 std::vector<ModelObject> result;
49
2/2
✓ Branch 1 taken 169 times.
✓ Branch 4 taken 169 times.
169 SkyTemperatureVector sts = getObject<ModelObject>().getModelObjectSources<SkyTemperature>();
50
1/1
✓ Branch 5 taken 169 times.
169 result.insert(result.end(), sts.begin(), sts.end());
51 338 return result;
52 169 }
53
54 ✗ std::vector<IddObjectType> SizingPeriod_Impl::allowableChildTypes() const {
55 ✗ IddObjectTypeVector result;
56 ✗ result.push_back(SkyTemperature::iddObjectType());
57 ✗ return result;
58 ✗ }
59
60 } // namespace detail
61
62 /// constructor
63 387 SizingPeriod::SizingPeriod(IddObjectType type, const Model& model) : ParentObject(type, model) {
64
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 387 times.
✗ Branch 5 not taken.
387 OS_ASSERT(getImpl<detail::SizingPeriod_Impl>());
65 387 }
66
67 // constructor
68
1/1
✓ Branch 3 taken 1000 times.
1000 SizingPeriod::SizingPeriod(std::shared_ptr<detail::SizingPeriod_Impl> impl) : ParentObject(std::move(impl)) {}
69
70 // ensure that this object does not contain the date 2/29
71 ✗ void SizingPeriod::ensureNoLeapDays() {
72 ✗ getImpl<detail::SizingPeriod_Impl>()->ensureNoLeapDays();
73 ✗ }
74
75 } // namespace model
76 } // namespace openstudio
77