-
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
Conversation
AlfalfaComponent alfalfa_component(component); | ||
$self->setInput(alfalfa_component); |
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.
AlfalfaComponent alfalfa_component(component); | |
$self->setInput(alfalfa_component); | |
$self->setInput(AlfalfaComponent {component}); |
AlfalfaComponent alfalfa_component(component); | ||
$self->setOutput(alfalfa_component); |
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.
AlfalfaComponent alfalfa_component(component); | |
$self->setOutput(alfalfa_component); | |
$self->setOutput(AlfalfaComponent {component}); |
AlfalfaComponent alfalfa_component(component); | ||
return $self->exposeFromComponent(alfalfa_component, display_name); |
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.
AlfalfaComponent alfalfa_component(component); | |
return $self->exposeFromComponent(alfalfa_component, display_name); | |
return $self->exposeFromComponent(AlfalfaComponent {component}, display_name); |
@@ -57,4 +57,26 @@ | |||
%template(OptionalAlfalfaPoint) boost::optional<openstudio::alfalfa::AlfalfaPoint>; | |||
%template(OptionalAlfalfaComponent) boost::optional<openstudio::alfalfa::AlfalfaComponent>; | |||
|
|||
namespace openstudio::alfalfa { | |||
%extend AlfalfaPoint { |
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.
CI Results for 614d667:
|
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.
I'm liking this AlfalfaComponent / AlfalfaComponentBase template stuff less and less. But this appears to work fine.
@@ -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 comment
The 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 comment
The 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 .
Agreed. If i get some more time before the next release it's something I want to take a look at again. |
@wenyikuang where do we merge this one? |
I haven't merged it yet, maybe in the final? |
@wenyikuang I'm asking because it seems that master is well ahead of develop |
We should merge to develop branch... I probably made a mistake some place. |
Pull request overview
Add additional function in SWIG for
AlfalfaJSON::exposeFromComponent
,AlfalfaPoint::setInput
andAlfalfaPoint::setOutput
which provides a method which takesconst AlfalfaComponentBase&
instead ofAlfalfaComponent
. This is required because it seems like SWIG cannot understand the converting constructor.Pull Request Author
src/model/test
)src/energyplus/Test
)src/osversion/VersionTranslator.cpp
)Labels:
IDDChange
APIChange
Pull Request - Ready for CI
so that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.