src/model/ExternalInterface.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 "ExternalInterface.hpp" | ||
| 7 | #include "ExternalInterface_Impl.hpp" | ||
| 8 | |||
| 9 | #include <utilities/idd/IddFactory.hxx> | ||
| 10 | #include <utilities/idd/IddEnums.hxx> | ||
| 11 | #include <utilities/idd/OS_ExternalInterface_FieldEnums.hxx> | ||
| 12 | |||
| 13 | #include "../utilities/core/Assert.hpp" | ||
| 14 | |||
| 15 | namespace openstudio { | ||
| 16 | namespace model { | ||
| 17 | |||
| 18 | namespace detail { | ||
| 19 | |||
| 20 | 4 | ExternalInterface_Impl::ExternalInterface_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 21 | 4 | : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 22 |
4/6✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 13 not taken.
|
4 | OS_ASSERT(idfObject.iddObject().type() == ExternalInterface::iddObjectType()); |
| 23 | 4 | } | |
| 24 | |||
| 25 | ✗ | ExternalInterface_Impl::ExternalInterface_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 26 | ✗ | : ModelObject_Impl(other, model, keepHandle) { | |
| 27 | ✗ | OS_ASSERT(other.iddObject().type() == ExternalInterface::iddObjectType()); | |
| 28 | ✗ | } | |
| 29 | |||
| 30 | 3 | ExternalInterface_Impl::ExternalInterface_Impl(const ExternalInterface_Impl& other, Model_Impl* model, bool keepHandle) | |
| 31 | 3 | : ModelObject_Impl(other, model, keepHandle) {} | |
| 32 | |||
| 33 | ✗ | const std::vector<std::string>& ExternalInterface_Impl::outputVariableNames() const { | |
| 34 | ✗ | static const std::vector<std::string> result; | |
| 35 | ✗ | return result; | |
| 36 | } | ||
| 37 | |||
| 38 | ✗ | IddObjectType ExternalInterface_Impl::iddObjectType() const { | |
| 39 | ✗ | return ExternalInterface::iddObjectType(); | |
| 40 | } | ||
| 41 | |||
| 42 | 4 | std::string ExternalInterface_Impl::nameofExternalInterface() const { | |
| 43 |
1/1✓ Branch 1 taken 4 times.
|
4 | boost::optional<std::string> value = getString(OS_ExternalInterfaceFields::NameofExternalInterface, true); |
| 44 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (value) { |
| 45 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | return value.get(); |
| 46 | } | ||
| 47 | ✗ | return ""; | |
| 48 | 4 | } | |
| 49 | |||
| 50 | 3 | bool ExternalInterface_Impl::setNameofExternalInterface(const std::string& nameofExternalInterface) { | |
| 51 | 3 | bool result = setString(OS_ExternalInterfaceFields::NameofExternalInterface, nameofExternalInterface); | |
| 52 | 3 | return result; | |
| 53 | } | ||
| 54 | |||
| 55 | } // namespace detail | ||
| 56 | |||
| 57 | 7616 | IddObjectType ExternalInterface::iddObjectType() { | |
| 58 |
1/1✓ Branch 1 taken 7616 times.
|
7616 | return {IddObjectType::OS_ExternalInterface}; |
| 59 | } | ||
| 60 | |||
| 61 | ✗ | std::vector<std::string> ExternalInterface::nameofExternalInterfaceValues() { | |
| 62 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ExternalInterfaceFields::NameofExternalInterface); | |
| 63 | } | ||
| 64 | |||
| 65 | 4 | std::string ExternalInterface::nameofExternalInterface() const { | |
| 66 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::ExternalInterface_Impl>()->nameofExternalInterface(); |
| 67 | } | ||
| 68 | |||
| 69 | 3 | bool ExternalInterface::setNameofExternalInterface(const std::string& nameofExternalInterface) { | |
| 70 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::ExternalInterface_Impl>()->setNameofExternalInterface(nameofExternalInterface); |
| 71 | } | ||
| 72 | |||
| 73 | /// @cond | ||
| 74 |
1/1✓ Branch 2 taken 6 times.
|
6 | ExternalInterface::ExternalInterface(std::shared_ptr<detail::ExternalInterface_Impl> impl) : ModelObject(impl) {} |
| 75 | 4 | ExternalInterface::ExternalInterface(Model& model) : ModelObject(ExternalInterface::iddObjectType(), model) {} | |
| 76 | |||
| 77 | /// @endcond | ||
| 78 | |||
| 79 | } // namespace model | ||
| 80 | } // namespace openstudio | ||
| 81 |