Skip to content

Use const& signature for read-only sub callbacks - #2297

Merged
clalancette merged 1 commit into
rollingfrom
aprotyas/const_ref_sub_callbacks
Feb 9, 2022
Merged

clalancette merged 1 commit into
rollingfrom
aprotyas/const_ref_sub_callbacks

Conversation

@aprotyas

@aprotyas aprotyas commented Feb 8, 2022

Copy link
Copy Markdown
Member

The constant reference message signatures should be preferred over the
shared pointer to constant message signatures for read-only subscriber
callbacks, as discussed in ros2/rclcpp#1598.

As such, it makes sense to migrate to said signatures in documentation.

Signed-off-by: Abrar Rahman Protyasha [email protected]

The constant reference message signatures should be preferred over the
shared pointer to constant message signatures for read-only subscriber
callbacks, as discussed in ros2/rclcpp#1598.

As such, it makes sense to migrate to said signatures in documentation.

Signed-off-by: Abrar Rahman Protyasha <[email protected]>

@clalancette clalancette left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In short, I'm fine with this change, but @aprotyas did you test out these tutorials on Foxy, Galactic, and Rolling to ensure that they still work?

@aprotyas

aprotyas commented Feb 9, 2022

Copy link
Copy Markdown
Member Author

In short, I'm fine with this change, but @aprotyas did you test out these tutorials on Foxy, Galactic, and Rolling to ensure that they still work?

Yes, I forgot to mention. I've tested and these tutorials only work on Rolling and Galactic because the const & callback signature doesn't exist in Foxy.

Also, since users will download code from ros2/examples in the simple pubsub tutorial, another PR is needed to reflect the changes in minimal_subscriber/member_function.cpp. I will open that shortly.

@clalancette

Copy link
Copy Markdown
Contributor

Yes, I forgot to mention. I've tested and these tutorials only work on Rolling and Galactic because the const & callback signature doesn't exist in Foxy.

Ah, excellent. Thanks for letting me know. In that case, I'm going to approve and merge this one, and backport to only Galactic.

@clalancette
clalancette merged commit e4cd3cb into rolling Feb 9, 2022
@delete-merged-branch
delete-merged-branch Bot deleted the aprotyas/const_ref_sub_callbacks branch February 9, 2022 15:38
mergify Bot pushed a commit that referenced this pull request Feb 9, 2022
The constant reference message signatures should be preferred over the
shared pointer to constant message signatures for read-only subscriber
callbacks, as discussed in ros2/rclcpp#1598.

As such, it makes sense to migrate to said signatures in documentation.

Signed-off-by: Abrar Rahman Protyasha <[email protected]>
(cherry picked from commit e4cd3cb)

# Conflicts:
#	source/Tutorials/Custom-ROS2-Interfaces.rst
#	source/Tutorials/FastDDS-Configuration/FastDDS-Configuration.rst
#	source/Tutorials/Tf2/Writing-A-Tf2-Broadcaster-Cpp.rst
#	source/Tutorials/Writing-A-Simple-Cpp-Publisher-And-Subscriber.rst
clalancette added a commit that referenced this pull request Feb 9, 2022
…2298)

* Use `const&` signature for read-only sub callbacks (#2297)

The constant reference message signatures should be preferred over the
shared pointer to constant message signatures for read-only subscriber
callbacks, as discussed in ros2/rclcpp#1598.

As such, it makes sense to migrate to said signatures in documentation.

Signed-off-by: Abrar Rahman Protyasha <[email protected]>
(cherry picked from commit e4cd3cb)

Co-authored-by: Chris Lalancette <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants