-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Ruby/Python SWIG API when type is AlfalfaComponent #5298
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -57,4 +57,26 @@ | |||||||
%template(OptionalAlfalfaPoint) boost::optional<openstudio::alfalfa::AlfalfaPoint>; | ||||||||
%template(OptionalAlfalfaComponent) boost::optional<openstudio::alfalfa::AlfalfaComponent>; | ||||||||
|
||||||||
namespace openstudio::alfalfa { | ||||||||
%extend AlfalfaPoint { | ||||||||
void setOutput(const AlfalfaComponentBase& component) { | ||||||||
AlfalfaComponent alfalfa_component(component); | ||||||||
$self->setOutput(alfalfa_component); | ||||||||
Comment on lines
+63
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
} | ||||||||
|
||||||||
void setInput(const AlfalfaComponentBase& component) { | ||||||||
AlfalfaComponent alfalfa_component(component); | ||||||||
$self->setInput(alfalfa_component); | ||||||||
Comment on lines
+68
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
} | ||||||||
} | ||||||||
|
||||||||
%extend AlfalfaJSON { | ||||||||
boost::optional<AlfalfaPoint> AlfalfaJSON::exposeFromComponent(const AlfalfaComponentBase& component, const std::string& display_name = std::string()) { | ||||||||
AlfalfaComponent alfalfa_component(component); | ||||||||
return $self->exposeFromComponent(alfalfa_component, display_name); | ||||||||
Comment on lines
+75
to
+76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
} | ||||||||
} | ||||||||
} | ||||||||
|
||||||||
|
||||||||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,7 @@ namespace alfalfa { | |
class ALFALFA_API AlfalfaComponent | ||
{ | ||
public: | ||
template <typename T, std::enable_if_t<std::is_base_of<AlfalfaComponentBase, T>::value, bool> = true> | ||
AlfalfaComponent(T component) : m_component(std::make_unique<T>(std::move(component))) {} | ||
AlfalfaComponent(const AlfalfaComponentBase& component) : m_component(component.clone()) {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious why you added this one in the main source but the others just in the Alfalfa.i There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't want the ctor exposed to the bindings so i added it here and ignored the ctors for the class in the .i . |
||
|
||
AlfalfaComponent(const AlfalfaComponent& other) : m_component(other.m_component->clone()) {} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These could be moved into the main source if desired.