-
Notifications
You must be signed in to change notification settings - Fork 508
Open
Description
rclcpp/rclcpp/include/rclcpp/any_service_callback.hpp
Lines 209 to 238 in 1bf4e6a
| using SharedPtrCallback = std::function< | |
| void ( | |
| std::shared_ptr<typename ServiceT::Request>, | |
| std::shared_ptr<typename ServiceT::Response> | |
| )>; | |
| using SharedPtrWithRequestHeaderCallback = std::function< | |
| void ( | |
| std::shared_ptr<rmw_request_id_t>, | |
| std::shared_ptr<typename ServiceT::Request>, | |
| std::shared_ptr<typename ServiceT::Response> | |
| )>; | |
| using SharedPtrDeferResponseCallback = std::function< | |
| void ( | |
| std::shared_ptr<rmw_request_id_t>, | |
| std::shared_ptr<typename ServiceT::Request> | |
| )>; | |
| using SharedPtrDeferResponseCallbackWithServiceHandle = std::function< | |
| void ( | |
| std::shared_ptr<rclcpp::Service<ServiceT>>, | |
| std::shared_ptr<rmw_request_id_t>, | |
| std::shared_ptr<typename ServiceT::Request> | |
| )>; | |
| std::variant< | |
| std::monostate, | |
| SharedPtrCallback, | |
| SharedPtrWithRequestHeaderCallback, | |
| SharedPtrDeferResponseCallback, | |
| SharedPtrDeferResponseCallbackWithServiceHandle> callback_; | |
| }; |
Would it be a good idea to support a service callback with a const reference and reference for services? At least for the overload without the request id.
Many services are able to return immediately and does not need the request/response object lifetime to exceed the call site. In general, it's also much cheaper to copy a small struct instead of doing atomic increments/decrements of shared pointers.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels