src/model/SkyTemperature.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 "SkyTemperature.hpp" | ||
| 7 | #include "SkyTemperature_Impl.hpp" | ||
| 8 | #include "Site.hpp" | ||
| 9 | #include "Site_Impl.hpp" | ||
| 10 | #include "RunPeriod.hpp" | ||
| 11 | #include "RunPeriod_Impl.hpp" | ||
| 12 | #include "SizingPeriod.hpp" | ||
| 13 | #include "SizingPeriod_Impl.hpp" | ||
| 14 | |||
| 15 | #include "Model.hpp" | ||
| 16 | #include "Model_Impl.hpp" | ||
| 17 | |||
| 18 | #include <utilities/idd/OS_WeatherProperty_SkyTemperature_FieldEnums.hxx> | ||
| 19 | #include <utilities/idd/IddEnums.hxx> | ||
| 20 | |||
| 21 | #include "../utilities/core/Assert.hpp" | ||
| 22 | |||
| 23 | namespace openstudio { | ||
| 24 | namespace model { | ||
| 25 | |||
| 26 | namespace detail { | ||
| 27 | |||
| 28 | 8 | SkyTemperature_Impl::SkyTemperature_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 29 | 8 | : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 30 |
4/6✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 8 times.
✗ Branch 13 not taken.
|
8 | OS_ASSERT(idfObject.iddObject().type() == SkyTemperature::iddObjectType()); |
| 31 | 8 | } | |
| 32 | |||
| 33 | ✗ | SkyTemperature_Impl::SkyTemperature_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 34 | ✗ | : ModelObject_Impl(other, model, keepHandle) { | |
| 35 | ✗ | OS_ASSERT(other.iddObject().type() == SkyTemperature::iddObjectType()); | |
| 36 | ✗ | } | |
| 37 | |||
| 38 | ✗ | SkyTemperature_Impl::SkyTemperature_Impl(const SkyTemperature_Impl& other, Model_Impl* model, bool keepHandle) | |
| 39 | ✗ | : ModelObject_Impl(other, model, keepHandle) {} | |
| 40 | |||
| 41 | // return the parent object in the hierarchy | ||
| 42 | 27 | boost::optional<ParentObject> SkyTemperature_Impl::parent() const { | |
| 43 | // if Name field not blank, that is the parent | ||
| 44 |
2/2✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
|
27 | OptionalParentObject result = getObject<ModelObject>().getModelObjectTarget<ParentObject>(OS_WeatherProperty_SkyTemperatureFields::Name); |
| 45 | // if it is blank, parent is Site | ||
| 46 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 2 taken 7 times.
|
27 | if (!result) { |
| 47 |
3/3✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
|
20 | result = OptionalParentObject(model().getOptionalUniqueModelObject<Site>()); |
| 48 | } | ||
| 49 | 27 | return result; | |
| 50 | ✗ | } | |
| 51 | |||
| 52 | // set the parent, child may have to call methods on the parent | ||
| 53 | 6 | bool SkyTemperature_Impl::setParent(ParentObject& newParent) { | |
| 54 |
4/5✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 6 times.
|
6 | if (!(newParent.model() == model())) { |
| 55 | ✗ | return false; | |
| 56 | } | ||
| 57 | |||
| 58 |
2/3✓ Branch 1 taken 6 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
12 | if (newParent.optionalCast<Site>()) { |
| 59 | // nullify the field | ||
| 60 | ✗ | return setPointer(OS_WeatherProperty_SkyTemperatureFields::Name, Handle()); | |
| 61 |
9/16✓ Branch 1 taken 6 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 3 times.
✓ Branch 13 taken 3 times.
✓ Branch 15 taken 6 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 6 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
|
15 | } else if (newParent.optionalCast<RunPeriod>() || newParent.optionalCast<SizingPeriod>()) { |
| 62 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | return setPointer(OS_WeatherProperty_SkyTemperatureFields::Name, newParent.handle()); |
| 63 | } | ||
| 64 | |||
| 65 | ✗ | return false; | |
| 66 | } | ||
| 67 | |||
| 68 | // Get all output variable names that could be associated with this object. | ||
| 69 | ✗ | const std::vector<std::string>& SkyTemperature_Impl::outputVariableNames() const { | |
| 70 | ✗ | static const std::vector<std::string> result; | |
| 71 | ✗ | return result; | |
| 72 | } | ||
| 73 | |||
| 74 | ✗ | IddObjectType SkyTemperature_Impl::iddObjectType() const { | |
| 75 | ✗ | return SkyTemperature::iddObjectType(); | |
| 76 | } | ||
| 77 | |||
| 78 | } // namespace detail | ||
| 79 | |||
| 80 | /// constructor | ||
| 81 | 8 | SkyTemperature::SkyTemperature(const Model& model) : ModelObject(SkyTemperature::iddObjectType(), model) { | |
| 82 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
✗ Branch 5 not taken.
|
8 | OS_ASSERT(getImpl<detail::SkyTemperature_Impl>()); |
| 83 | 8 | } | |
| 84 | |||
| 85 | // constructor | ||
| 86 |
1/1✓ Branch 3 taken 22 times.
|
22 | SkyTemperature::SkyTemperature(std::shared_ptr<detail::SkyTemperature_Impl> impl) : ModelObject(std::move(impl)) {} |
| 87 | |||
| 88 | 7697 | IddObjectType SkyTemperature::iddObjectType() { | |
| 89 |
1/1✓ Branch 1 taken 7697 times.
|
7697 | IddObjectType result(IddObjectType::OS_WeatherProperty_SkyTemperature); |
| 90 | 7697 | return result; | |
| 91 | } | ||
| 92 | |||
| 93 | } // namespace model | ||
| 94 | } // namespace openstudio | ||
| 95 |