Skip to content

Commit

Permalink
Fix #5290 - rename enums in Alfalfa to avoid clash with Utilities one…
Browse files Browse the repository at this point in the history
…s for C#
  • Loading branch information
jmarrec committed Nov 6, 2024
1 parent cc1e0bb commit cf2ee19
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 35 deletions.
8 changes: 4 additions & 4 deletions src/alfalfa/AlfalfaActuator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ComponentBase> clone() const override {
Expand Down
4 changes: 2 additions & 2 deletions src/alfalfa/AlfalfaComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
4 changes: 2 additions & 2 deletions src/alfalfa/AlfalfaComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions src/alfalfa/AlfalfaConstant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ComponentBase> clone() const override {
Expand Down
8 changes: 4 additions & 4 deletions src/alfalfa/AlfalfaGlobalVariable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ComponentBase> clone() const override {
Expand Down
8 changes: 4 additions & 4 deletions src/alfalfa/AlfalfaMeter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ComponentBase> clone() const override {
Expand Down
8 changes: 4 additions & 4 deletions src/alfalfa/AlfalfaOutputVariable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ComponentBase> clone() const override {
Expand Down
4 changes: 2 additions & 2 deletions src/alfalfa/ComponentBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/alfalfa/ComponentBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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();
Expand Down
11 changes: 6 additions & 5 deletions src/alfalfa/test/AlfalfaJSON_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<ComponentBase> clone() const override {
Expand Down

0 comments on commit cf2ee19

Please sign in to comment.