Skip to content

Commit

Permalink
Support for returning array / std::vector in EVerest interfaces (#79)
Browse files Browse the repository at this point in the history
* fixed generation of vector return type in interface and allow generation of default return value {} for vector

Signed-off-by: pietfried <[email protected]>
Signed-off-by: Fabian Klemm <[email protected]>

* Minor improvements

Signed-off-by: aw <[email protected]>
Signed-off-by: Fabian Klemm <[email protected]>

* correct helpers; bump version

Signed-off-by: Fabian Klemm <[email protected]>

* Update ev-dev-tools/src/ev_cli/helpers.py

Co-authored-by: Andreas Heinrich <[email protected]>
Signed-off-by: Fabian Klemm <[email protected]>

---------

Signed-off-by: pietfried <[email protected]>
Signed-off-by: Fabian Klemm <[email protected]>
Signed-off-by: aw <[email protected]>
Co-authored-by: aw <[email protected]>
Co-authored-by: Fabian Klemm <[email protected]>
Co-authored-by: Andreas Heinrich <[email protected]>
  • Loading branch information
4 people authored Dec 4, 2023
1 parent f673ca4 commit 4a5ce95
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ev-dev-tools/src/ev_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""EVerest command line utility."""
__version__ = '0.0.23'
__version__ = '0.0.24'
2 changes: 2 additions & 0 deletions ev-dev-tools/src/ev_cli/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ def primitive_to_sample_value(type):
return '"everest"'
elif type == 'object':
return '{}'
elif type == 'array':
return '{}'
else:
raise Exception(f'This json type "{type}" is not known or not implemented')

Expand Down
2 changes: 2 additions & 0 deletions ev-dev-tools/src/ev_cli/templates/interface-Exports.hpp.j2
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ 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 %}
{{ result_type(cmd.result) }} retval (result.value().begin(), result.value().end());
{% else %}
auto retval = {{ var_to_cpp(cmd.result) }}(result.value());
{% endif %}
Expand Down

0 comments on commit 4a5ce95

Please sign in to comment.