Skip to content
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

Merged
merged 4 commits into from
Dec 4, 2023

Conversation

Pietfried
Copy link
Contributor

fixed generation of vector return type in interface and allow generation of default return value {} for vector

@Pietfried Pietfried requested a review from a-w50 September 13, 2023 13:03
@@ -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());
Copy link
Contributor

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

Copy link
Contributor

@a-w50 a-w50 left a 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.

@Pietfried Pietfried closed this Sep 14, 2023
@Pietfried Pietfried reopened this Sep 14, 2023
@Pietfried Pietfried requested a review from a-w50 November 17, 2023 15:51
@Pietfried Pietfried force-pushed the pg-fix-vector-return-type branch from 3f95bd9 to 7a10619 Compare November 17, 2023 16:42
Pietfried and others added 2 commits December 1, 2023 13:48
…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]>
@klemmpnx klemmpnx force-pushed the pg-fix-vector-return-type branch from 7a10619 to c91710b Compare December 1, 2023 12:48
Signed-off-by: Fabian Klemm <[email protected]>
@klemmpnx
Copy link
Contributor

klemmpnx commented Dec 1, 2023

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]>
@klemmpnx
Copy link
Contributor

klemmpnx commented Dec 4, 2023

@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!

@klemmpnx klemmpnx requested a review from andistorm December 4, 2023 09:40
Copy link
Contributor

@andistorm andistorm left a 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

Copy link
Contributor

@a-w50 a-w50 left a 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

@klemmpnx klemmpnx merged commit 4a5ce95 into main Dec 4, 2023
6 checks passed
@klemmpnx klemmpnx deleted the pg-fix-vector-return-type branch December 4, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants