From cf2ee1968575e924815d651d29f37ac5bc418de1 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 6 Nov 2024 14:15:58 +0100 Subject: [PATCH 1/9] Fix #5290 - rename enums in Alfalfa to avoid clash with Utilities ones for C# --- src/alfalfa/AlfalfaActuator.hpp | 8 ++++---- src/alfalfa/AlfalfaComponent.cpp | 4 ++-- src/alfalfa/AlfalfaComponent.hpp | 4 ++-- src/alfalfa/AlfalfaConstant.hpp | 8 ++++---- src/alfalfa/AlfalfaGlobalVariable.hpp | 8 ++++---- src/alfalfa/AlfalfaMeter.hpp | 8 ++++---- src/alfalfa/AlfalfaOutputVariable.hpp | 8 ++++---- src/alfalfa/ComponentBase.cpp | 4 ++-- src/alfalfa/ComponentBase.hpp | 8 ++++---- src/alfalfa/test/AlfalfaJSON_GTest.cpp | 11 ++++++----- 10 files changed, 36 insertions(+), 35 deletions(-) diff --git a/src/alfalfa/AlfalfaActuator.hpp b/src/alfalfa/AlfalfaActuator.hpp index 9bc82dccb2..92858b91bc 100644 --- a/src/alfalfa/AlfalfaActuator.hpp +++ b/src/alfalfa/AlfalfaActuator.hpp @@ -26,12 +26,12 @@ namespace alfalfa { Json::Value toJSON() const override; - ComponentCapability capability() const override { - return ComponentCapability::Bidirectional; + AlfalfaComponentCapability capability() const override { + return AlfalfaComponentCapability::Bidirectional; } - ComponentType type() const override { - return ComponentType::Actuator; + AlfalfaComponentType type() const override { + return AlfalfaComponentType::Actuator; } std::unique_ptr clone() const override { diff --git a/src/alfalfa/AlfalfaComponent.cpp b/src/alfalfa/AlfalfaComponent.cpp index 6b10d5bf70..bde3cae703 100644 --- a/src/alfalfa/AlfalfaComponent.cpp +++ b/src/alfalfa/AlfalfaComponent.cpp @@ -6,11 +6,11 @@ namespace alfalfa { return m_component->toJSON(); } - ComponentCapability AlfalfaComponent::capability() const { + AlfalfaComponentCapability AlfalfaComponent::capability() const { return m_component->capability(); } - ComponentType AlfalfaComponent::type() const { + AlfalfaComponentType AlfalfaComponent::type() const { return m_component->type(); } diff --git a/src/alfalfa/AlfalfaComponent.hpp b/src/alfalfa/AlfalfaComponent.hpp index b87b3ef510..acd170f2eb 100644 --- a/src/alfalfa/AlfalfaComponent.hpp +++ b/src/alfalfa/AlfalfaComponent.hpp @@ -32,9 +32,9 @@ namespace alfalfa { Json::Value toJSON() const; - ComponentCapability capability() const; + AlfalfaComponentCapability capability() const; - ComponentType type() const; + AlfalfaComponentType type() const; std::string typeName() const; diff --git a/src/alfalfa/AlfalfaConstant.hpp b/src/alfalfa/AlfalfaConstant.hpp index 1d74e8b622..c366064f48 100644 --- a/src/alfalfa/AlfalfaConstant.hpp +++ b/src/alfalfa/AlfalfaConstant.hpp @@ -19,12 +19,12 @@ namespace alfalfa { Json::Value toJSON() const override; - ComponentCapability capability() const override { - return ComponentCapability::Output; + AlfalfaComponentCapability capability() const override { + return AlfalfaComponentCapability::Output; } - ComponentType type() const override { - return ComponentType::Constant; + AlfalfaComponentType type() const override { + return AlfalfaComponentType::Constant; } std::unique_ptr clone() const override { diff --git a/src/alfalfa/AlfalfaGlobalVariable.hpp b/src/alfalfa/AlfalfaGlobalVariable.hpp index 3f389bb08a..251d377027 100644 --- a/src/alfalfa/AlfalfaGlobalVariable.hpp +++ b/src/alfalfa/AlfalfaGlobalVariable.hpp @@ -27,12 +27,12 @@ namespace alfalfa { Json::Value toJSON() const override; - ComponentCapability capability() const override { - return ComponentCapability::Bidirectional; + AlfalfaComponentCapability capability() const override { + return AlfalfaComponentCapability::Bidirectional; } - ComponentType type() const override { - return ComponentType::GlobalVariable; + AlfalfaComponentType type() const override { + return AlfalfaComponentType::GlobalVariable; } std::unique_ptr clone() const override { diff --git a/src/alfalfa/AlfalfaMeter.hpp b/src/alfalfa/AlfalfaMeter.hpp index 51001bf47a..fed14359e6 100644 --- a/src/alfalfa/AlfalfaMeter.hpp +++ b/src/alfalfa/AlfalfaMeter.hpp @@ -27,12 +27,12 @@ namespace alfalfa { Json::Value toJSON() const override; - ComponentCapability capability() const override { - return ComponentCapability::Output; + AlfalfaComponentCapability capability() const override { + return AlfalfaComponentCapability::Output; } - ComponentType type() const override { - return ComponentType::Meter; + AlfalfaComponentType type() const override { + return AlfalfaComponentType::Meter; } std::unique_ptr clone() const override { diff --git a/src/alfalfa/AlfalfaOutputVariable.hpp b/src/alfalfa/AlfalfaOutputVariable.hpp index bf6b010a86..1b640d9672 100644 --- a/src/alfalfa/AlfalfaOutputVariable.hpp +++ b/src/alfalfa/AlfalfaOutputVariable.hpp @@ -27,12 +27,12 @@ namespace alfalfa { Json::Value toJSON() const override; - ComponentCapability capability() const override { - return ComponentCapability::Output; + AlfalfaComponentCapability capability() const override { + return AlfalfaComponentCapability::Output; } - ComponentType type() const override { - return ComponentType::OutputVariable; + AlfalfaComponentType type() const override { + return AlfalfaComponentType::OutputVariable; } std::unique_ptr clone() const override { diff --git a/src/alfalfa/ComponentBase.cpp b/src/alfalfa/ComponentBase.cpp index 4ed339d05d..e019eb612f 100644 --- a/src/alfalfa/ComponentBase.cpp +++ b/src/alfalfa/ComponentBase.cpp @@ -4,11 +4,11 @@ namespace openstudio { namespace alfalfa { bool ComponentBase::canInput() const { - return capability() == ComponentCapability::Bidirectional || capability() == ComponentCapability::Input; + return capability() == AlfalfaComponentCapability::Bidirectional || capability() == AlfalfaComponentCapability::Input; } bool ComponentBase::canOutput() const { - return capability() == ComponentCapability::Bidirectional || capability() == ComponentCapability::Output; + return capability() == AlfalfaComponentCapability::Bidirectional || capability() == AlfalfaComponentCapability::Output; } } // namespace alfalfa diff --git a/src/alfalfa/ComponentBase.hpp b/src/alfalfa/ComponentBase.hpp index c85ba31788..c52e1aa642 100644 --- a/src/alfalfa/ComponentBase.hpp +++ b/src/alfalfa/ComponentBase.hpp @@ -10,9 +10,9 @@ namespace openstudio { namespace alfalfa { - OPENSTUDIO_ENUM(ComponentCapability, ((Input))((Output))((Bidirectional))) + OPENSTUDIO_ENUM(AlfalfaComponentCapability, ((Input))((Output))((Bidirectional))) - OPENSTUDIO_ENUM(ComponentType, ((Actuator))((Constant))((Meter))((OutputVariable))((GlobalVariable))) + OPENSTUDIO_ENUM(AlfalfaComponentType, ((Actuator))((Constant))((Meter))((OutputVariable))((GlobalVariable))) class ALFALFA_API ComponentBase { @@ -21,9 +21,9 @@ namespace alfalfa { virtual Json::Value toJSON() const = 0; - virtual ComponentCapability capability() const = 0; + virtual AlfalfaComponentCapability capability() const = 0; - virtual ComponentType type() const = 0; + virtual AlfalfaComponentType type() const = 0; virtual std::string typeName() const { return type().valueName(); diff --git a/src/alfalfa/test/AlfalfaJSON_GTest.cpp b/src/alfalfa/test/AlfalfaJSON_GTest.cpp index 6b5e568871..b2684904e2 100644 --- a/src/alfalfa/test/AlfalfaJSON_GTest.cpp +++ b/src/alfalfa/test/AlfalfaJSON_GTest.cpp @@ -201,7 +201,8 @@ TEST(AlfalfaJSON, json_serialization) { TEST(AlfalfaJSON, point_exceptions_logging) { const std::string ID_VALID_CHARS_MSG = "IDs can only contain letters, numbers, and the following special characters _-[]():"; - const std::string DISPLAY_NAME_VALID_CHARS_MSG = "Display name '{}' does not produce a valid point ID. Manually set a valid ID or export will fail."; + const std::string DISPLAY_NAME_VALID_CHARS_MSG = + "Display name '{}' does not produce a valid point ID. Manually set a valid ID or export will fail."; const std::string LOG_CHANNEL = "openstudio.AlfalfaPoint"; StringStreamLogSink ss; ss.setLogLevel(Warn); @@ -307,12 +308,12 @@ class InputComponent : public ComponentBase { public: InputComponent() = default; - ComponentCapability capability() const override { - return ComponentCapability::Input; + AlfalfaComponentCapability capability() const override { + return AlfalfaComponentCapability::Input; } - openstudio::alfalfa::ComponentType type() const override { - return openstudio::alfalfa::ComponentType::Constant; + openstudio::alfalfa::AlfalfaComponentType type() const override { + return openstudio::alfalfa::AlfalfaComponentType::Constant; } std::unique_ptr clone() const override { From 21af047654434e7f44a6882da45322686837b484 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 6 Nov 2024 14:32:55 +0100 Subject: [PATCH 2/9] Rename ComponentBase to AlfalfaComponentBase for consistency with the rest --- src/alfalfa/Alfalfa.i | 4 ++-- src/alfalfa/AlfalfaActuator.hpp | 6 +++--- src/alfalfa/AlfalfaComponent.hpp | 6 +++--- src/alfalfa/{ComponentBase.cpp => AlfalfaComponentBase.cpp} | 6 +++--- src/alfalfa/{ComponentBase.hpp => AlfalfaComponentBase.hpp} | 6 +++--- src/alfalfa/AlfalfaConstant.hpp | 6 +++--- src/alfalfa/AlfalfaGlobalVariable.hpp | 6 +++--- src/alfalfa/AlfalfaMeter.hpp | 6 +++--- src/alfalfa/AlfalfaOutputVariable.hpp | 6 +++--- src/alfalfa/CMakeLists.txt | 4 ++-- src/alfalfa/test/AlfalfaJSON_GTest.cpp | 4 ++-- 11 files changed, 30 insertions(+), 30 deletions(-) rename src/alfalfa/{ComponentBase.cpp => AlfalfaComponentBase.cpp} (72%) rename src/alfalfa/{ComponentBase.hpp => AlfalfaComponentBase.hpp} (84%) diff --git a/src/alfalfa/Alfalfa.i b/src/alfalfa/Alfalfa.i index 1c3956b2b5..511433a830 100644 --- a/src/alfalfa/Alfalfa.i +++ b/src/alfalfa/Alfalfa.i @@ -33,7 +33,7 @@ using namespace openstudio::alfalfa; %} -%ignore openstudio::alfalfa::ComponentBase; +%ignore openstudio::alfalfa::AlfalfaComponentBase; %ignore openstudio::alfalfa::AlfalfaActuator::clone; %ignore openstudio::alfalfa::AlfalfaConstant::clone; %ignore openstudio::alfalfa::AlfalfaMeter::clone; @@ -41,7 +41,7 @@ %ignore openstudio::alfalfa::AlfalfaOutputVariable::clone; %include -%include +%include %include %include %include diff --git a/src/alfalfa/AlfalfaActuator.hpp b/src/alfalfa/AlfalfaActuator.hpp index 92858b91bc..1ce5c05df2 100644 --- a/src/alfalfa/AlfalfaActuator.hpp +++ b/src/alfalfa/AlfalfaActuator.hpp @@ -2,13 +2,13 @@ #define ALFALFA_COMPONENT_ACTUATOR_HPP #include "AlfalfaAPI.hpp" -#include "ComponentBase.hpp" +#include "AlfalfaComponentBase.hpp" #include "../utilities/idf/IdfObject.hpp" namespace openstudio { namespace alfalfa { - class ALFALFA_API AlfalfaActuator : public ComponentBase + class ALFALFA_API AlfalfaActuator : public AlfalfaComponentBase { public: /** @@ -34,7 +34,7 @@ namespace alfalfa { return AlfalfaComponentType::Actuator; } - std::unique_ptr clone() const override { + std::unique_ptr clone() const override { return std::make_unique(*this); } diff --git a/src/alfalfa/AlfalfaComponent.hpp b/src/alfalfa/AlfalfaComponent.hpp index acd170f2eb..951ed4516f 100644 --- a/src/alfalfa/AlfalfaComponent.hpp +++ b/src/alfalfa/AlfalfaComponent.hpp @@ -5,14 +5,14 @@ #include #include "AlfalfaAPI.hpp" -#include "ComponentBase.hpp" +#include "AlfalfaComponentBase.hpp" namespace openstudio { namespace alfalfa { class ALFALFA_API AlfalfaComponent { public: - template ::value, bool> = true> + template ::value, bool> = true> AlfalfaComponent(T component) : m_component(std::make_unique(std::move(component))) {} AlfalfaComponent(const AlfalfaComponent& other) : m_component(other.m_component->clone()) {} @@ -46,7 +46,7 @@ namespace alfalfa { private: AlfalfaComponent() = default; - std::unique_ptr m_component; + std::unique_ptr m_component; }; inline bool operator==(const AlfalfaComponent& lhs, const AlfalfaComponent& rhs) { diff --git a/src/alfalfa/ComponentBase.cpp b/src/alfalfa/AlfalfaComponentBase.cpp similarity index 72% rename from src/alfalfa/ComponentBase.cpp rename to src/alfalfa/AlfalfaComponentBase.cpp index e019eb612f..1e114f07ce 100644 --- a/src/alfalfa/ComponentBase.cpp +++ b/src/alfalfa/AlfalfaComponentBase.cpp @@ -1,13 +1,13 @@ -#include "ComponentBase.hpp" +#include "AlfalfaComponentBase.hpp" namespace openstudio { namespace alfalfa { - bool ComponentBase::canInput() const { + bool AlfalfaComponentBase::canInput() const { return capability() == AlfalfaComponentCapability::Bidirectional || capability() == AlfalfaComponentCapability::Input; } - bool ComponentBase::canOutput() const { + bool AlfalfaComponentBase::canOutput() const { return capability() == AlfalfaComponentCapability::Bidirectional || capability() == AlfalfaComponentCapability::Output; } diff --git a/src/alfalfa/ComponentBase.hpp b/src/alfalfa/AlfalfaComponentBase.hpp similarity index 84% rename from src/alfalfa/ComponentBase.hpp rename to src/alfalfa/AlfalfaComponentBase.hpp index c52e1aa642..6375782d00 100644 --- a/src/alfalfa/ComponentBase.hpp +++ b/src/alfalfa/AlfalfaComponentBase.hpp @@ -14,10 +14,10 @@ namespace alfalfa { OPENSTUDIO_ENUM(AlfalfaComponentType, ((Actuator))((Constant))((Meter))((OutputVariable))((GlobalVariable))) - class ALFALFA_API ComponentBase + class ALFALFA_API AlfalfaComponentBase { public: - virtual ~ComponentBase() = default; + virtual ~AlfalfaComponentBase() = default; virtual Json::Value toJSON() const = 0; @@ -31,7 +31,7 @@ namespace alfalfa { virtual std::string deriveName() const = 0; - virtual std::unique_ptr clone() const = 0; + virtual std::unique_ptr clone() const = 0; virtual bool canInput() const; diff --git a/src/alfalfa/AlfalfaConstant.hpp b/src/alfalfa/AlfalfaConstant.hpp index c366064f48..e07403fe38 100644 --- a/src/alfalfa/AlfalfaConstant.hpp +++ b/src/alfalfa/AlfalfaConstant.hpp @@ -3,11 +3,11 @@ #include "AlfalfaAPI.hpp" -#include "ComponentBase.hpp" +#include "AlfalfaComponentBase.hpp" namespace openstudio { namespace alfalfa { - class ALFALFA_API AlfalfaConstant : public ComponentBase + class ALFALFA_API AlfalfaConstant : public AlfalfaComponentBase { public: /** @@ -27,7 +27,7 @@ namespace alfalfa { return AlfalfaComponentType::Constant; } - std::unique_ptr clone() const override { + std::unique_ptr clone() const override { return std::make_unique(*this); } diff --git a/src/alfalfa/AlfalfaGlobalVariable.hpp b/src/alfalfa/AlfalfaGlobalVariable.hpp index 251d377027..e62efa171c 100644 --- a/src/alfalfa/AlfalfaGlobalVariable.hpp +++ b/src/alfalfa/AlfalfaGlobalVariable.hpp @@ -3,13 +3,13 @@ #include "AlfalfaAPI.hpp" -#include "ComponentBase.hpp" +#include "AlfalfaComponentBase.hpp" #include "../utilities/idf/IdfObject.hpp" namespace openstudio { namespace alfalfa { - class ALFALFA_API AlfalfaGlobalVariable : public ComponentBase + class ALFALFA_API AlfalfaGlobalVariable : public AlfalfaComponentBase { public: /** @@ -35,7 +35,7 @@ namespace alfalfa { return AlfalfaComponentType::GlobalVariable; } - std::unique_ptr clone() const override { + std::unique_ptr clone() const override { return std::make_unique(*this); } diff --git a/src/alfalfa/AlfalfaMeter.hpp b/src/alfalfa/AlfalfaMeter.hpp index fed14359e6..8d2593764b 100644 --- a/src/alfalfa/AlfalfaMeter.hpp +++ b/src/alfalfa/AlfalfaMeter.hpp @@ -3,13 +3,13 @@ #include "AlfalfaAPI.hpp" -#include "ComponentBase.hpp" +#include "AlfalfaComponentBase.hpp" #include "../utilities/idf/IdfObject.hpp" namespace openstudio { namespace alfalfa { - class ALFALFA_API AlfalfaMeter : public ComponentBase + class ALFALFA_API AlfalfaMeter : public AlfalfaComponentBase { public: /** @@ -35,7 +35,7 @@ namespace alfalfa { return AlfalfaComponentType::Meter; } - std::unique_ptr clone() const override { + std::unique_ptr clone() const override { return std::make_unique(*this); } diff --git a/src/alfalfa/AlfalfaOutputVariable.hpp b/src/alfalfa/AlfalfaOutputVariable.hpp index 1b640d9672..c8d85d8ea7 100644 --- a/src/alfalfa/AlfalfaOutputVariable.hpp +++ b/src/alfalfa/AlfalfaOutputVariable.hpp @@ -3,13 +3,13 @@ #include "AlfalfaAPI.hpp" -#include "ComponentBase.hpp" +#include "AlfalfaComponentBase.hpp" #include "../utilities/idf/IdfObject.hpp" namespace openstudio { namespace alfalfa { - class ALFALFA_API AlfalfaOutputVariable : public ComponentBase + class ALFALFA_API AlfalfaOutputVariable : public AlfalfaComponentBase { public: /** @@ -35,7 +35,7 @@ namespace alfalfa { return AlfalfaComponentType::OutputVariable; } - std::unique_ptr clone() const override { + std::unique_ptr clone() const override { return std::make_unique(*this); } diff --git a/src/alfalfa/CMakeLists.txt b/src/alfalfa/CMakeLists.txt index c87da18b12..bb335fbefb 100644 --- a/src/alfalfa/CMakeLists.txt +++ b/src/alfalfa/CMakeLists.txt @@ -5,8 +5,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}/) set(${target_name}_src AlfalfaAPI.hpp - ComponentBase.cpp - ComponentBase.hpp + AlfalfaComponentBase.cpp + AlfalfaComponentBase.hpp AlfalfaComponent.hpp AlfalfaComponent.cpp AlfalfaConstant.hpp diff --git a/src/alfalfa/test/AlfalfaJSON_GTest.cpp b/src/alfalfa/test/AlfalfaJSON_GTest.cpp index b2684904e2..e51b7a0219 100644 --- a/src/alfalfa/test/AlfalfaJSON_GTest.cpp +++ b/src/alfalfa/test/AlfalfaJSON_GTest.cpp @@ -304,7 +304,7 @@ TEST(AlfalfaJSON, point_exceptions_logging) { ASSERT_EQ(ss.logMessages().size(), 0); } -class InputComponent : public ComponentBase +class InputComponent : public AlfalfaComponentBase { public: InputComponent() = default; @@ -316,7 +316,7 @@ class InputComponent : public ComponentBase return openstudio::alfalfa::AlfalfaComponentType::Constant; } - std::unique_ptr clone() const override { + std::unique_ptr clone() const override { return std::make_unique(*this); } From 74645975fbeda93a73327330d0d3feac6a46a7aa Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 6 Nov 2024 15:29:48 +0100 Subject: [PATCH 3/9] Fixup the SWIG files --- src/alfalfa/Alfalfa.i | 4 ++-- src/measure/Measure.i | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/alfalfa/Alfalfa.i b/src/alfalfa/Alfalfa.i index 511433a830..ebe639c05a 100644 --- a/src/alfalfa/Alfalfa.i +++ b/src/alfalfa/Alfalfa.i @@ -6,6 +6,8 @@ #endif %include +#define ALFALFA_API + %include %import %import @@ -13,7 +15,6 @@ %ignore openstudio::alfalfa::detail; %{ - #include #include #include #include @@ -40,7 +41,6 @@ %ignore openstudio::alfalfa::AlfalfaGlobalVariable::clone; %ignore openstudio::alfalfa::AlfalfaOutputVariable::clone; -%include %include %include %include diff --git a/src/measure/Measure.i b/src/measure/Measure.i index 3b074944e1..18b1d5e841 100644 --- a/src/measure/Measure.i +++ b/src/measure/Measure.i @@ -7,10 +7,10 @@ %include -%include #define MODEL_API #define STANDARDSINTERFACE_API #define MEASURE_API +#define ALFALFA_API %include %import From c9414168580491724fc3eb38f18f2fbf59d8fe20 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 6 Nov 2024 15:29:58 +0100 Subject: [PATCH 4/9] Update workflow runners --- .github/workflows/buildCSharp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buildCSharp.yml b/.github/workflows/buildCSharp.yml index 67bd5d7d54..ffaeafc2ad 100644 --- a/.github/workflows/buildCSharp.yml +++ b/.github/workflows/buildCSharp.yml @@ -23,9 +23,9 @@ jobs: name: [Ubuntu, macOS, macOS_arm64, Windows64, Windows32] include: - name: Ubuntu - os: ubuntu-20.04 + os: ubuntu-22.04 - name: macOS - os: macos-11 + os: macos-13 - name: macOS_arm64 os: macos-14 - name: Windows64 From db608bfecb59b0c05b493aa0a9f315894a9efcda Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 6 Nov 2024 16:56:18 +0100 Subject: [PATCH 5/9] Move Alfalfa enums into Utilities to avoid "duplicate symbol '_CSharp_OpenStudio_LeftShift__SWIG_1'" --- src/alfalfa/AlfalfaComponentBase.hpp | 6 +----- src/utilities/data/Data.i | 4 ++++ src/utilities/data/DataEnums.hpp | 26 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/alfalfa/AlfalfaComponentBase.hpp b/src/alfalfa/AlfalfaComponentBase.hpp index 6375782d00..b5239deb29 100644 --- a/src/alfalfa/AlfalfaComponentBase.hpp +++ b/src/alfalfa/AlfalfaComponentBase.hpp @@ -3,17 +3,13 @@ #include "AlfalfaAPI.hpp" -#include "../utilities/core/Enum.hpp" +#include "../utilities/data/DataEnums.hpp" #include namespace openstudio { namespace alfalfa { - OPENSTUDIO_ENUM(AlfalfaComponentCapability, ((Input))((Output))((Bidirectional))) - - OPENSTUDIO_ENUM(AlfalfaComponentType, ((Actuator))((Constant))((Meter))((OutputVariable))((GlobalVariable))) - class ALFALFA_API AlfalfaComponentBase { public: diff --git a/src/utilities/data/Data.i b/src/utilities/data/Data.i index 348095d4fa..ea034806c3 100644 --- a/src/utilities/data/Data.i +++ b/src/utilities/data/Data.i @@ -37,6 +37,10 @@ %template(OptionalAppGFuelType) boost::optional; %template(ComponentTypeVector) std::vector; %template(OptionalComponentType) boost::optional; +%template(AlfalfaComponentTypeVector) std::vector; +%template(OptionalAlfalfaComponentType) boost::optional; +%template(AlfalfaComponentCapabilityVector) std::vector; +%template(OptionalAlfalfaComponentCapability) boost::optional; %include %include diff --git a/src/utilities/data/DataEnums.hpp b/src/utilities/data/DataEnums.hpp index c64d977243..cbe9d7e992 100644 --- a/src/utilities/data/DataEnums.hpp +++ b/src/utilities/data/DataEnums.hpp @@ -290,6 +290,32 @@ using OptionalComponentType = boost::optional; /** \relates ComponentType */ using ComponentTypeVector = std::vector; + +OPENSTUDIO_ENUM(AlfalfaComponentCapability, + ((Input)) + ((Output)) + ((Bidirectional)) +) +/** \relates AlfalfaComponentCapability */ +using OptionalAlfalfaComponentCapability = boost::optional; + +/** \relates AlfalfaComponentCapability */ +using AlfalfaComponentCapabilityVector = std::vector; + + +OPENSTUDIO_ENUM(AlfalfaComponentType, + ((Actuator)) + ((Constant)) + ((Meter)) + ((OutputVariable)) + ((GlobalVariable)) +) +/** \relates AlfalfaComponentType */ +using OptionalAlfalfaComponentType = boost::optional; + +/** \relates AlfalfaComponentType */ +using AlfalfaComponentTypeVector = std::vector; + // clang-format on inline UTILITIES_API AppGFuelType convertFuelTypeToAppG(FuelType fuelType) { From bbc0a94f81d0193db3d21522c00b334ade6cb4c1 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 6 Nov 2024 16:57:21 +0100 Subject: [PATCH 6/9] Place Alfalfa C# in model between OSVersion and Measure --- ProjectMacros.cmake | 1 + csharp/CMakeLists.txt | 1 + src/alfalfa/CMakeLists.txt | 2 +- src/measure/CMakeLists.txt | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ProjectMacros.cmake b/ProjectMacros.cmake index cf944fa06a..3ca827748e 100644 --- a/ProjectMacros.cmake +++ b/ProjectMacros.cmake @@ -532,6 +532,7 @@ macro(MAKE_SWIG_TARGET NAME SIMPLENAME KEY_I_FILE I_FILES PARENT_TARGET PARENT_S set( model_names OpenStudioMeasure + OpenStudioAlfalfa OpenStudioModel OpenStudioModelAirflow OpenStudioModelAvailabilityManager diff --git a/csharp/CMakeLists.txt b/csharp/CMakeLists.txt index 995b65987f..4bffd5e51a 100644 --- a/csharp/CMakeLists.txt +++ b/csharp/CMakeLists.txt @@ -83,6 +83,7 @@ set(translator_wrappers set(model_wrappers csharp_OpenStudioMeasure_wrap.cxx + csharp_OpenStudioAlfalfa_wrap.cxx csharp_OpenStudioModel_wrap.cxx csharp_OpenStudioModelAirflow_wrap.cxx csharp_OpenStudioModelAvailabilityManager_wrap.cxx diff --git a/src/alfalfa/CMakeLists.txt b/src/alfalfa/CMakeLists.txt index bb335fbefb..9fe7e350d1 100644 --- a/src/alfalfa/CMakeLists.txt +++ b/src/alfalfa/CMakeLists.txt @@ -58,4 +58,4 @@ if(BUILD_TESTING) endif() -MAKE_SWIG_TARGET(OpenStudioAlfalfa alfalfa "${CMAKE_CURRENT_SOURCE_DIR}/Alfalfa.i" "${${target_name}_swig_src}" ${target_name} OpenStudioModel) +MAKE_SWIG_TARGET(OpenStudioAlfalfa alfalfa "${CMAKE_CURRENT_SOURCE_DIR}/Alfalfa.i" "${${target_name}_swig_src}" ${target_name} OpenStudioOSVersion) diff --git a/src/measure/CMakeLists.txt b/src/measure/CMakeLists.txt index 36b249dd11..03c3c771d8 100644 --- a/src/measure/CMakeLists.txt +++ b/src/measure/CMakeLists.txt @@ -67,4 +67,4 @@ endif() CREATE_TEST_TARGETS(${target_name} "${${target_name}_test_src}" "${${target_name}_test_depends}") -MAKE_SWIG_TARGET(OpenStudioMeasure measure "${CMAKE_CURRENT_SOURCE_DIR}/Measure.i" "${${target_name}_swig_src}" ${target_name} "OpenStudioOSVersion;OpenStudioAlfalfa") +MAKE_SWIG_TARGET(OpenStudioMeasure measure "${CMAKE_CURRENT_SOURCE_DIR}/Measure.i" "${${target_name}_swig_src}" ${target_name} OpenStudioAlfalfa) From d865b871337132919a8f9b7a8d95aa8d659d11e3 Mon Sep 17 00:00:00 2001 From: TShapinsky Date: Wed, 6 Nov 2024 13:23:56 -0700 Subject: [PATCH 7/9] Fix namesapce for types in GTest --- src/alfalfa/test/AlfalfaJSON_GTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/alfalfa/test/AlfalfaJSON_GTest.cpp b/src/alfalfa/test/AlfalfaJSON_GTest.cpp index e51b7a0219..eca8a69338 100644 --- a/src/alfalfa/test/AlfalfaJSON_GTest.cpp +++ b/src/alfalfa/test/AlfalfaJSON_GTest.cpp @@ -312,8 +312,8 @@ class InputComponent : public AlfalfaComponentBase return AlfalfaComponentCapability::Input; } - openstudio::alfalfa::AlfalfaComponentType type() const override { - return openstudio::alfalfa::AlfalfaComponentType::Constant; + AlfalfaComponentType type() const override { + return AlfalfaComponentType::Constant; } std::unique_ptr clone() const override { From c6666556c9d6e0087638e9e41d59212773a06c68 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 7 Nov 2024 12:12:22 +0100 Subject: [PATCH 8/9] Adjust includes: C# MSVC fails to compile this file as it doesn't know "string" --- src/gltf/GltfMaterialData.cpp | 2 +- src/gltf/GltfMaterialData.hpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gltf/GltfMaterialData.cpp b/src/gltf/GltfMaterialData.cpp index 589737fec3..3a7dc4c026 100644 --- a/src/gltf/GltfMaterialData.cpp +++ b/src/gltf/GltfMaterialData.cpp @@ -26,7 +26,7 @@ #include -#include +#include #include #include #include diff --git a/src/gltf/GltfMaterialData.hpp b/src/gltf/GltfMaterialData.hpp index 36eeb9f30c..531ad5aea7 100644 --- a/src/gltf/GltfMaterialData.hpp +++ b/src/gltf/GltfMaterialData.hpp @@ -8,7 +8,7 @@ #include "GltfAPI.hpp" -#include +#include #include #include @@ -36,7 +36,7 @@ namespace gltf { /** Standard constructor */ constexpr GltfMaterialData(std::string_view materialName, int r, int g, int b, double a, bool isDoubleSided = false) - : m_materialName(materialName), m_r(r), m_g(g), m_b(b), m_a(a), m_isDoubleSided(isDoubleSided){}; + : m_materialName(materialName), m_r(r), m_g(g), m_b(b), m_a(a), m_isDoubleSided(isDoubleSided) {}; static std::vector buildMaterials(const model::Model& model); //@} From 31f12bea8d09279a9a91fbbf833736e304ff2fc4 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 7 Nov 2024 14:21:42 +0100 Subject: [PATCH 9/9] [skip ci] clang format --- src/gltf/GltfMaterialData.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gltf/GltfMaterialData.hpp b/src/gltf/GltfMaterialData.hpp index 531ad5aea7..675ad6783c 100644 --- a/src/gltf/GltfMaterialData.hpp +++ b/src/gltf/GltfMaterialData.hpp @@ -36,7 +36,7 @@ namespace gltf { /** Standard constructor */ constexpr GltfMaterialData(std::string_view materialName, int r, int g, int b, double a, bool isDoubleSided = false) - : m_materialName(materialName), m_r(r), m_g(g), m_b(b), m_a(a), m_isDoubleSided(isDoubleSided) {}; + : m_materialName(materialName), m_r(r), m_g(g), m_b(b), m_a(a), m_isDoubleSided(isDoubleSided){}; static std::vector buildMaterials(const model::Model& model); //@}