| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Should the bytes be signed or unsigned? I've done unsigned in the past, but I'm not sure that it matters.
Sorry, something went wrong.
There was a problem hiding this comment.
This matches the code generated in ParameterValue_Struct.h from ParameterValue.msg, but I'd prefer uint8_t myself.
Sorry, something went wrong.
There was a problem hiding this comment.
It should indeed be uint8 to follow our message parser which defines all the types: https://github.com/ros2/rosidl/blob/master/rosidl_parser/rosidl_parser/__init__.py#L484-L485
Probably the ParameterValue message needs to be updated to change bytes_value to int8[].
Sorry, something went wrong.
There was a problem hiding this comment.
I replaced int8[] with byte[] in ParameterValue as it's semantically more accurate:ros2/rcl_interfaces@ee983f3
Sorry, something went wrong.
|
Overall this looks good. I'm a little worried about implicitly creating the executor inside. This is something we should review going forward. But we can use this for now. +1 |
Sorry, something went wrong.
There was a problem hiding this comment.
Why is friend needed here? It seems to only use the public constructor.
Sorry, something went wrong.
There was a problem hiding this comment.
Executor may need private/protected members in this class? Not sure though.
Sorry, something went wrong.
There was a problem hiding this comment.
Removed. This was a remnant of a quick test.
Sorry, something went wrong.
|
I've renamed ParameterListResult and ParameterSetResult to ListParametersResult and SetParametersResult respectively in ros2/rcl_interfaces#3 |
Sorry, something went wrong.
|
Currently the API uses multiple template specializations of get_value with different return types. So the user must always specify the template type. Do we want to provide methods which contain the type in the name (additionally or instead)? We might also consider the C-equivalent of this API - will parameters in C and C++ be completely different implementations? Also I think we could still return const std::string & in the case of strings (#26 (comment)). I don't think that the template T prevents us from specializing it for const std::string &? |
Sorry, something went wrong.
|
@dirk-thomas I've changed it so that the user only needs to pass the ParameterType value to get_value<> instead of using types. I think this could be improved if we didn't require the storage to be a ParameterValue, which is completely an implementation detail. Then we could declare all the constructors as constexpr as well as get_type and it'll be less cumbersome: auto value = p.get_value<p.get_type()>() or we might even get rid of p.get_type and just use p.get_value |
Sorry, something went wrong.
|
There's precedence in other API's for have something like .asString, .asInt, and .asDouble rather than .as<std::string>, .as<int64_t>, and .as<double>, especially when there are a finite set of options. I don't really mind one way or the other. As for it being aligned with the style of the C api, I think it's fine if they are not one to one. If it makes more sense to use a template in the C++ and an expanded name in C that's fine. It can be made similar and familiar without being exactly the same. |
Sorry, something went wrong.
|
+1 to as_string, as_int, etc. instead of templatized get_value |
Sorry, something went wrong.
|
I've added the as_* versions of the get_value method, so when we reach a consensus I'll just remove the one that less popular. My vote goes for the as_* methods. |
Sorry, something went wrong.
There was a problem hiding this comment.
With get_value<> not returning a const reference but a temporary object this won't work I guess?
Sorry, something went wrong.
There was a problem hiding this comment.
get_value<> returns a const reference https://github.com/ros2/rclcpp/pull/28/files#diff-b54f433d1e964fc09df27a3262119169R133
Sorry, something went wrong.
There was a problem hiding this comment.
Should we do the same for std::vector<uint8_t>?
Sorry, something went wrong.
There was a problem hiding this comment.
Done.
Sorry, something went wrong.
Asoragna/merge conflicts
| Back | FazBrowse Home | New Git URL |
Connects to ros2/ros2#28
@dirk-thomas @tfoote @wjwwood