-
Notifications
You must be signed in to change notification settings - Fork 412
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
Fix std::function disambiguation in Windows #27
Conversation
…ons of create_service. Workaround for http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2132 in Windows
FunctorT, | ||
2, | ||
typename rclcpp::service::Service<ServiceT>::SharedPtr | ||
>::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.
The indentation looks difficult to "parse". Would one of the following be clearer?
typename function_arity
<
FunctorT,
2,
typename rclcpp::service::Service<ServiceT>::SharedPtr
>::type
or
template<typename ServiceT, typename FunctorT>
typename function_arity<
FunctorT,
2,
typename rclcpp::service::Service<ServiceT>::SharedPtr>::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.
I ended reformatting this code with the second style.
Can you explain this a little bit? I'm confused as to why the return type of If we want to merge this I think we should take some time to make it cleaner, focusing if possible on the signature of the method, which is what the users will be exposed to. Maybe we could do a dispatch function which takes either callback and then calls an implementation function which has all of this template magic added. That way the user facing API isn't as busy looking. @esteve do you think it is possible to hide some of this in the implementation? |
@wjwwood this basically checks that the callback passed as the The return type is needed in the I agree with making this more readable and expressive, the generated Doxygen docs will look horrible as it is now. I think we could change this a little bit so that there's only one |
…n the arity of the callback function
I refactored the code a little bit and now |
I ended up adding support for checking the types of the arguments of the callback passed as well, this should make |
@dirk-thomas @tfoote @wjwwood when you have a moment, please have a look at the latest changes. The Windows slave builds fine now: http://54.183.26.131:8080/view/ros2/job/ros2_batch_ci_windows/212/ Thanks. |
639865d
to
faba591
Compare
|
||
/* Create and return a Service. */ | ||
template<typename ServiceT> | ||
template<typename ServiceT, typename F> |
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.
Can we rename F
to something "longer" like CallbackT
?
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 agree that a more verbose name would be good.
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.
Done.
Looks much cleaner to me: +1 |
I had to remove the check for the third argument for callbacks that take a request header because it failed with simpler callbacks. Apparently checking for arity is not enough and |
This is the code I had to disable: |
+1 The API looks much cleaner now. |
Fix std::function disambiguation in Windows
lgtm |
+1 Please squash before merging. |
* ros2GH-61 Read topic directly from message when playing and allow to play multiple topics * ros2GH-61 Add test for SqliteStorage and update old ones * ros2GH-62 Extend function to poll for any number of specified topics * ros2GH-62 Allow subscription to several topics * ros2GH-61 Obtain the topic name directly from the database - Uses a JOIN instead of mapping the topic_id to the name in code * ros2GH-61 Cache read row in result iterator This allows repeated dereferencing on same row without quering the database again. * ros2GH-62 Change demo-record to allow specifying multiple topics * ros2GH-62 Add test to write non-string topic + refactoring * ros2GH-62 Add test for subscription to multiple topics * ros2GH-62 Cleanup * ros2GH-62 Simplify test setup * ros2GH-61 Cleanup * ros2GH-61 consolidate storage integration test * ros2GH-62 Consolidate write integration tests * ros2GH-61 enhance read integration test to check multiple topics * ros2GH-62 Improve rosbag integration test * ros2GH-62: Polish rosbag2_rosbag_node_test * ros2GH-62 Fix cpplint * ros2GH-62 Fix memory leak in rosbag helper * ros2GH-62 Cleanup of subscriptions * ros2GH-62 do not use flaky timers in rosbag2_write_integration_test * ros2GH-62 Use rmw_serialize_message_t consistently in test helper classes * ros2GH-73 Use test_msgs in read_integration_test * ros2GH-26 Cleanup: fix alphabetic orderung
* ros2GH-27 Implement discovery for new topics after startup - this allows new topics to be discovered also after startup. - as a consquence, ros2 bag record won't throw any exception anymore if the specified topics are not available at startup - each time the recorder subscribes to a new topic, this will be logged to console * ros2GH-27 Provide polling frequency as option - make option available in RecordOptions - set to 100ms for now * ros2GH-27 Stop topic polling if subscription setup is complete * ros2GH-27 Minor refactoring for readability * ros2GH-27 Fix build after rebase * ros2GH-145 add no-discovery option to ros2 bag record * ros2GH-27 Refactor subscribing mechanism - use set for subscribed topics instead of vector - perform the asynchronous call only when discovery is needed * ros2GH-27 Expose polling-interval as cli option * ros2GH-27 Minor refactoring * ros2GH-27 Refactor recorder - naming of methods - emphasize similarity between first subscription and discovery loop * small touch ups * remove launch from function name
Workaround for http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2132 in Windows
Connects to ros2/examples#20
@dirk-thomas @tfoote @wjwwood