-
Notifications
You must be signed in to change notification settings - Fork 13
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
Support for returning array / std::vector in EVerest interfaces #79
Conversation
@@ -81,6 +81,12 @@ public: | |||
{% elif 'object_type' in cmd.result %} | |||
json retval_json = result.value(); | |||
{{ result_type(cmd.result) }} retval = retval_json; | |||
{% elif 'array_type' in cmd.result %} | |||
auto array = {{ var_to_cpp(cmd.result) }}(result.value()); |
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 think this line here shouldn't be necessary. It should also work if you use result.value()
inside the for loop instead of array
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.
There are still a lot of issues with the array and type handling. But if it fulfills current needs, it might be ok.
3f95bd9
to
7a10619
Compare
…ion of default return value {} for vector Signed-off-by: pietfried <[email protected]> Signed-off-by: Fabian Klemm <[email protected]>
Signed-off-by: aw <[email protected]> Signed-off-by: Fabian Klemm <[email protected]>
7a10619
to
c91710b
Compare
Signed-off-by: Fabian Klemm <[email protected]>
rebased that, bumped the version and did a minor correction in the helpers.py; about the discussion above: I think Piet already had addressed the comment (I am not sure about the mentioned "for loop", however this I applies in the current template for enums and I assume the construction via begin()....end() is better suited here) |
Co-authored-by: Andreas Heinrich <[email protected]> Signed-off-by: Fabian Klemm <[email protected]>
@a-w50 : as discussed today, tested on branch refactor/ocpp-interface with config "config-sil-ocpp-custom-extension.yaml" that spins up an "OCPPExtensionExample" module (which then uses the auto-generated caller code and requests a a vector of elements) - this seems to work fine! |
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.
Looks good to me, will test/use it in my use case EVerest/everest-core#447
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.
💯
please squash before commit
fixed generation of vector return type in interface and allow generation of default return value {} for vector