src/model/PythonPluginTrendVariable.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 "PythonPluginTrendVariable.hpp" | ||
| 7 | #include "PythonPluginTrendVariable_Impl.hpp" | ||
| 8 | |||
| 9 | #include "PythonPluginVariable.hpp" | ||
| 10 | #include "PythonPluginVariable_Impl.hpp" | ||
| 11 | |||
| 12 | #include "Model.hpp" | ||
| 13 | |||
| 14 | #include <utilities/idd/IddEnums.hxx> | ||
| 15 | #include <utilities/idd/OS_PythonPlugin_TrendVariable_FieldEnums.hxx> | ||
| 16 | |||
| 17 | #include "../utilities/core/Assert.hpp" | ||
| 18 | |||
| 19 | namespace openstudio { | ||
| 20 | namespace model { | ||
| 21 | |||
| 22 | namespace detail { | ||
| 23 | |||
| 24 | 5 | PythonPluginTrendVariable_Impl::PythonPluginTrendVariable_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() == PythonPluginTrendVariable::iddObjectType()); |
| 27 | 5 | } | |
| 28 | |||
| 29 | ✗ | PythonPluginTrendVariable_Impl::PythonPluginTrendVariable_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, | |
| 30 | ✗ | bool keepHandle) | |
| 31 | ✗ | : ModelObject_Impl(other, model, keepHandle) { | |
| 32 | ✗ | OS_ASSERT(other.iddObject().type() == PythonPluginTrendVariable::iddObjectType()); | |
| 33 | ✗ | } | |
| 34 | |||
| 35 | 8 | PythonPluginTrendVariable_Impl::PythonPluginTrendVariable_Impl(const PythonPluginTrendVariable_Impl& other, Model_Impl* model, bool keepHandle) | |
| 36 | 8 | : ModelObject_Impl(other, model, keepHandle) {} | |
| 37 | |||
| 38 | ✗ | const std::vector<std::string>& PythonPluginTrendVariable_Impl::outputVariableNames() const { | |
| 39 | ✗ | static std::vector<std::string> result; | |
| 40 | ✗ | if (result.empty()) { | |
| 41 | } | ||
| 42 | ✗ | return result; | |
| 43 | } | ||
| 44 | |||
| 45 | ✗ | IddObjectType PythonPluginTrendVariable_Impl::iddObjectType() const { | |
| 46 | ✗ | return PythonPluginTrendVariable::iddObjectType(); | |
| 47 | } | ||
| 48 | |||
| 49 | 8 | boost::optional<PythonPluginVariable> PythonPluginTrendVariable_Impl::optionalPythonPluginVariable() const { | |
| 50 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | return getObject<ModelObject>().getModelObjectTarget<PythonPluginVariable>(OS_PythonPlugin_TrendVariableFields::NameofaPythonPluginVariable); |
| 51 | } | ||
| 52 | |||
| 53 | 8 | PythonPluginVariable PythonPluginTrendVariable_Impl::pythonPluginVariable() const { | |
| 54 |
1/1✓ Branch 1 taken 8 times.
|
8 | boost::optional<PythonPluginVariable> value = optionalPythonPluginVariable(); |
| 55 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
|
8 | if (!value) { |
| 56 | ✗ | LOG_AND_THROW(briefDescription() << " does not have a PythonPluginVariable attached."); | |
| 57 | } | ||
| 58 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
16 | return value.get(); |
| 59 | 8 | } | |
| 60 | |||
| 61 | 5 | int PythonPluginTrendVariable_Impl::numberofTimestepstobeLogged() const { | |
| 62 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<int> value = getInt(OS_PythonPlugin_TrendVariableFields::NumberofTimestepstobeLogged, true); |
| 63 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 4 not taken.
|
5 | OS_ASSERT(value); |
| 64 |
1/1✓ Branch 1 taken 5 times.
|
10 | return value.get(); |
| 65 | } | ||
| 66 | |||
| 67 | 8 | bool PythonPluginTrendVariable_Impl::setPythonPluginVariable(const PythonPluginVariable& pythonPluginVariable) { | |
| 68 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | bool result = setPointer(OS_PythonPlugin_TrendVariableFields::NameofaPythonPluginVariable, pythonPluginVariable.handle()); |
| 69 | 8 | return result; | |
| 70 | } | ||
| 71 | |||
| 72 | 10 | bool PythonPluginTrendVariable_Impl::setNumberofTimestepstobeLogged(int numberofTimestepstobeLogged) { | |
| 73 | 10 | bool result = setInt(OS_PythonPlugin_TrendVariableFields::NumberofTimestepstobeLogged, numberofTimestepstobeLogged); | |
| 74 | 10 | return result; | |
| 75 | } | ||
| 76 | |||
| 77 | } // namespace detail | ||
| 78 | |||
| 79 | 5 | PythonPluginTrendVariable::PythonPluginTrendVariable(const PythonPluginVariable& pythonPluginVariable) | |
| 80 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | : ModelObject(PythonPluginTrendVariable::iddObjectType(), pythonPluginVariable.model()) { |
| 81 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 5 not taken.
|
5 | OS_ASSERT(getImpl<detail::PythonPluginTrendVariable_Impl>()); |
| 82 | |||
| 83 | 5 | bool ok = true; | |
| 84 |
1/1✓ Branch 1 taken 5 times.
|
5 | ok = setPythonPluginVariable(pythonPluginVariable); |
| 85 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
|
5 | OS_ASSERT(ok); |
| 86 |
1/1✓ Branch 1 taken 5 times.
|
5 | ok = setNumberofTimestepstobeLogged(4); |
| 87 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
|
5 | OS_ASSERT(ok); |
| 88 | 5 | } | |
| 89 | |||
| 90 | 7762 | IddObjectType PythonPluginTrendVariable::iddObjectType() { | |
| 91 |
1/1✓ Branch 1 taken 7762 times.
|
7762 | return {IddObjectType::OS_PythonPlugin_TrendVariable}; |
| 92 | } | ||
| 93 | |||
| 94 | 8 | PythonPluginVariable PythonPluginTrendVariable::pythonPluginVariable() const { | |
| 95 |
1/1✓ Branch 3 taken 8 times.
|
8 | return getImpl<detail::PythonPluginTrendVariable_Impl>()->pythonPluginVariable(); |
| 96 | } | ||
| 97 | |||
| 98 | 5 | int PythonPluginTrendVariable::numberofTimestepstobeLogged() const { | |
| 99 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::PythonPluginTrendVariable_Impl>()->numberofTimestepstobeLogged(); |
| 100 | } | ||
| 101 | |||
| 102 | 8 | bool PythonPluginTrendVariable::setPythonPluginVariable(const PythonPluginVariable& pythonPluginVariable) { | |
| 103 |
1/1✓ Branch 3 taken 8 times.
|
8 | return getImpl<detail::PythonPluginTrendVariable_Impl>()->setPythonPluginVariable(pythonPluginVariable); |
| 104 | } | ||
| 105 | |||
| 106 | 10 | bool PythonPluginTrendVariable::setNumberofTimestepstobeLogged(int numberofTimestepstobeLogged) { | |
| 107 |
1/1✓ Branch 3 taken 10 times.
|
10 | return getImpl<detail::PythonPluginTrendVariable_Impl>()->setNumberofTimestepstobeLogged(numberofTimestepstobeLogged); |
| 108 | } | ||
| 109 | |||
| 110 | /// @cond | ||
| 111 |
1/1✓ Branch 3 taken 30 times.
|
30 | PythonPluginTrendVariable::PythonPluginTrendVariable(std::shared_ptr<detail::PythonPluginTrendVariable_Impl> impl) : ModelObject(std::move(impl)) {} |
| 112 | /// @endcond | ||
| 113 | |||
| 114 | } // namespace model | ||
| 115 | } // namespace openstudio | ||
| 116 |