-
Notifications
You must be signed in to change notification settings - Fork 33
Select between introspection_c and introspection_cpp #133
Conversation
find_package(rosidl_typesupport_introspection_cpp) | ||
if(NOT rosidl_typesupport_introspection_cpp_FOUND) | ||
if(NOT rosidl_typesupport_introspection_cpp_FOUND AND NOT rosidl_typesupport_introspection_c) |
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.
Lacks _FOUND
suffix?
That's how we roll. |
I'm starting CI for this to see that it doesn't break anything. Locally testing with test_rclcpp worked. http://ci.ros2.org/job/ci_linux/978 I haven't tested this with C yet though. I'll make a differently named branch to enable building rcl for Connext Dynamic. |
4285dc6
to
f976b85
Compare
Alright, I fixed some stuff with strings and started a branch in rcl that enables the dynamic test again. |
06e4282
to
024aa4b
Compare
I made some style fixes, relaunched with only Connext Dynamic enabled (hope that works). |
c0b80dd
to
7260481
Compare
f2edc65
to
27440bb
Compare
Fixed a warning on OSX and Windows. http://ci.ros2.org/job/ci_osx/827/ I think the failed tests on Windows also appear on the nightly build. I think we should fix those failures before merging this, but we should start review on this now. I separated the new macros into a macros.hpp file so that the diff isn't impossible to view in the browser. |
if (using_introspection_c_typesupport(typesupport)) { | ||
CREATE_TYPENAME_PREFIX(INTROSPECTION_C_TYPE) | ||
} else if (using_introspection_cpp_typesupport(typesupport)) { | ||
CREATE_TYPENAME_PREFIX(INTROSPECTION_CPP_TYPE) |
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.
Since both macros have the code to access the fields of members
in common I would suggest to let the macro only define the members
variable and continue to handle accessing the fields package_name_
and message_name_
outside.
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.
Then the macro could also be renamed to something like GET_TYPED_MEMBERS
.
After some thought I created a branch with a different approach that is more concise than this one (although I'm still not sure if it's the best): https://github.com/ros2/rmw_connext/compare/introspection_template Unfortunately I'm running into a compile error that I can't quite figure out, due to 7e8232e. Looks like feature isn't going to make it into this release, if the pull request in the current state is stylistically unacceptable. |
@jacquelinekay thanks for trying to get it in. If you need someone to review it, then I can lend a hand after the alpha. We can try to get it merged asap after the release. |
7861a0a
to
7ae7e7f
Compare
alright, I took a pretty different approach that is more concise and I reset this branch to reflect it. (the old approach is still around, in https://github.com/ros2/rmw_connext/compare/introspection_cpp_old) http://ci.ros2.org/job/ci_linux/1020/ |
|
||
bool using_introspection_c_typesupport(const char * typesupport_identifier) | ||
{ | ||
return strcmp(typesupport_identifier, rosidl_typesupport_introspection_c__identifier) == 0; |
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.
The should not use string comparison since it is a pretty expensive operation. See the previously used macro: https://github.com/ros2/rmw/blob/55254b66ddb0f7c5ff8f05fb8c0c60378fb3b2da/rmw/include/rmw/impl/cpp/macros.hpp#L70
Same below.
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.
everything here is a const char *, so using the equality operator should be okay.
return _create_type_name<rosidl_typesupport_introspection_cpp::MessageMembers>(untyped_members, | ||
sep); | ||
} | ||
RMW_SET_ERROR_MSG("service members handle is null"); |
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.
The error message doesn't match the error case.
Same below.
To simplify the code further I think there should be only one list of field types (in C) and C++ should use the same constant. The C++ part could still define "nicer" constants in a namespace (based on the C constants) but the rmw impl. would only need to deal with the C constants. |
Overall this looks much nicer then the previous branch. |
I agree that the C/C++ introspection APIs should share some types; I see no reason why they need separate definitions--that was the most frustrating thing about making this change... I suppose the current scheme is better if we wanted to avoid a dependency of rosidl_typesupport_introspection_cpp on rosidl_typesupport_introspection_c, but I think most dynamic RMW implementations will want to support both C and C++ introspection and will therefore depend on both packages. So introducing a dependency between the two introspection packages is not a big deal. |
Oh, I understand now, changes to the introspection packages aren't necessarily needed, I believe the field type enums from either package can be used in the switch statements that I currently have macros for. |
I realized why sharing the enum definitions would be nice to have. ros2/rosidl#94 |
CI for the new approach, with only connext dynamic enabled. http://ci.ros2.org/job/ci_linux/1029 |
+1 |
Since @esteve gave his +1 I'll merge these PRs today unless there are any objections. |
5672492
to
23c6170
Compare
23c6170
to
b76d1f2
Compare
Select between introspection_c and introspection_cpp
🎆 🎉 🎈 |
These changes are necessary to use rcl with Connext Dynamic.