src/model/ProgramControl.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 "ProgramControl.hpp" | ||
| 7 | #include "ProgramControl_Impl.hpp" | ||
| 8 | |||
| 9 | #include <utilities/idd/OS_ProgramControl_FieldEnums.hxx> | ||
| 10 | #include <utilities/idd/IddEnums.hxx> | ||
| 11 | |||
| 12 | #include "../utilities/core/Assert.hpp" | ||
| 13 | |||
| 14 | namespace openstudio { | ||
| 15 | namespace model { | ||
| 16 | |||
| 17 | namespace detail { | ||
| 18 | |||
| 19 | 14 | ProgramControl_Impl::ProgramControl_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 20 | 14 | : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 21 |
4/6✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 14 times.
✗ Branch 13 not taken.
|
14 | OS_ASSERT(idfObject.iddObject().type() == ProgramControl::iddObjectType()); |
| 22 | 14 | } | |
| 23 | |||
| 24 | 14 | ProgramControl_Impl::ProgramControl_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 25 | 14 | : ModelObject_Impl(other, model, keepHandle) { | |
| 26 |
4/6✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 14 times.
✗ Branch 13 not taken.
|
14 | OS_ASSERT(other.iddObject().type() == ProgramControl::iddObjectType()); |
| 27 | 14 | } | |
| 28 | |||
| 29 | 45 | ProgramControl_Impl::ProgramControl_Impl(const ProgramControl_Impl& other, Model_Impl* model, bool keepHandle) | |
| 30 | 45 | : ModelObject_Impl(other, model, keepHandle) {} | |
| 31 | |||
| 32 | ✗ | const std::vector<std::string>& ProgramControl_Impl::outputVariableNames() const { | |
| 33 | ✗ | static const std::vector<std::string> result; | |
| 34 | ✗ | return result; | |
| 35 | } | ||
| 36 | |||
| 37 | ✗ | IddObjectType ProgramControl_Impl::iddObjectType() const { | |
| 38 | ✗ | return ProgramControl::iddObjectType(); | |
| 39 | } | ||
| 40 | |||
| 41 | ✗ | boost::optional<int> ProgramControl_Impl::numberofThreadsAllowed() const { | |
| 42 | ✗ | return getInt(OS_ProgramControlFields::NumberofThreadsAllowed, true); | |
| 43 | } | ||
| 44 | |||
| 45 | ✗ | bool ProgramControl_Impl::setNumberofThreadsAllowed(boost::optional<int> numberofThreadsAllowed) { | |
| 46 | ✗ | bool result(false); | |
| 47 | ✗ | if (numberofThreadsAllowed) { | |
| 48 | ✗ | result = setInt(OS_ProgramControlFields::NumberofThreadsAllowed, numberofThreadsAllowed.get()); | |
| 49 | } else { | ||
| 50 | ✗ | resetNumberofThreadsAllowed(); | |
| 51 | ✗ | result = true; | |
| 52 | } | ||
| 53 | ✗ | return result; | |
| 54 | } | ||
| 55 | |||
| 56 | ✗ | void ProgramControl_Impl::resetNumberofThreadsAllowed() { | |
| 57 | ✗ | bool result = setString(OS_ProgramControlFields::NumberofThreadsAllowed, ""); | |
| 58 | ✗ | OS_ASSERT(result); | |
| 59 | ✗ | } | |
| 60 | |||
| 61 | } // namespace detail | ||
| 62 | |||
| 63 | ✗ | ProgramControl::ProgramControl(const Model& model) : ModelObject(ProgramControl::iddObjectType(), model) { | |
| 64 | ✗ | OS_ASSERT(getImpl<detail::ProgramControl_Impl>()); | |
| 65 | |||
| 66 | // TODO: Appropriately handle the following required object-list fields. | ||
| 67 | ✗ | bool ok = true; | |
| 68 | // ok = setHandle(); | ||
| 69 | ✗ | OS_ASSERT(ok); | |
| 70 | ✗ | } | |
| 71 | |||
| 72 | 7627 | IddObjectType ProgramControl::iddObjectType() { | |
| 73 |
1/1✓ Branch 1 taken 7627 times.
|
7627 | return {IddObjectType::OS_ProgramControl}; |
| 74 | } | ||
| 75 | |||
| 76 | ✗ | boost::optional<int> ProgramControl::numberofThreadsAllowed() const { | |
| 77 | ✗ | return getImpl<detail::ProgramControl_Impl>()->numberofThreadsAllowed(); | |
| 78 | } | ||
| 79 | |||
| 80 | ✗ | bool ProgramControl::setNumberofThreadsAllowed(int numberofThreadsAllowed) { | |
| 81 | ✗ | return getImpl<detail::ProgramControl_Impl>()->setNumberofThreadsAllowed(numberofThreadsAllowed); | |
| 82 | } | ||
| 83 | |||
| 84 | ✗ | void ProgramControl::resetNumberofThreadsAllowed() { | |
| 85 | ✗ | getImpl<detail::ProgramControl_Impl>()->resetNumberofThreadsAllowed(); | |
| 86 | ✗ | } | |
| 87 | |||
| 88 | /// @cond | ||
| 89 | ✗ | ProgramControl::ProgramControl(std::shared_ptr<detail::ProgramControl_Impl> impl) : ModelObject(std::move(impl)) {} | |
| 90 | /// @endcond | ||
| 91 | |||
| 92 | } // namespace model | ||
| 93 | } // namespace openstudio | ||
| 94 |