-
Notifications
You must be signed in to change notification settings - Fork 501
Add RMW listener APIs #1579
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
Merged
wjwwood
merged 39 commits into
ros2:master
from
irobot-ros:irobot/add-rmw-listener-apis
Feb 24, 2022
Merged
Add RMW listener APIs #1579
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
28aadf5
Add RMW listener APIs
9d9d753
split long log into two lines
e4ae5f5
Remove use_previous_event
c1d4a84
Do not set gc listener callback
28dbd07
significant refactor to make callbacks type safe
wjwwood 780d053
Add on_ready callback to waitables, add clear_* functions, add unit-t…
alsora e909eed
add mutex to set and clear listener APIs
f4bb83a
allow to set ipc sub callback from regular subscription
c653699
fix minor failures
alsora a2b0186
fix typos and errors in comments
alsora bd2c5e4
fix comments
alsora 8574237
expose qos listener APIs from pub and sub; add unit-tests
alsora 2bd63c0
add qos event unit-test for invalid callbacks
alsora c1ccb94
Use QoS depth to limit callbacks count
e778449
fix ipc-subscription
alsora 1bdc01d
Rename CallbackMessageT -> ROSMessageType
2d51d08
Set callbacks to Actions
8da3449
changes from upstream
wjwwood 114c4d9
Merge remote-tracking branch 'origin/master' into irobot/add-rmw-list…
wjwwood 1804a60
Unset callback on entities destruction
69d2ae9
Merge pull request #81 from mauropasse/mauro/add-rmw-listener-apis
alsora 8185a23
Merge remote-tracking branch 'upstream/master' into irobot/add-rmw-li…
6d4748e
fix rebase errors
alsora 82a1b46
fix unit-tests
alsora 5af4cb2
Add GuardCondition on trigger callback
9d0ac6c
Add tests for new GuardCondition APIs
8b4b7f2
Merge pull request #83 from mauropasse/mauro/add-rclcpp-guard-cond-ca…
alsora acae886
Fix windows CI
49b0669
Merge pull request #84 from mauropasse/mauro/add-rmw-listener-apis-fix
alsora 540e6bb
Action unset callbacks only if were set
4a1dc68
Merge pull request #85 from mauropasse/mauro/add-rmw-listener-apis-fix
alsora e5937db
add missing include rcl event callback include directive
alsora 4ccf875
Merge remote-tracking branch 'upstream/master' into irobot/add-rmw-li…
df55696
typos
wjwwood 0b0659e
remove listener reference
wjwwood 89b8cb3
remove references to listener and move a method closer to impl
wjwwood d930902
cpplint
wjwwood f51a1be
Fix qos history check in subscription_intra_process.hpp
ec54f15
Merge remote-tracking branch 'upstream/master' into irobot/add-rmw-li…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| // Copyright 2021 Open Source Robotics Foundation, Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #ifndef RCLCPP__DETAIL__CPP_CALLBACK_TRAMPOLINE_HPP_ | ||
| #define RCLCPP__DETAIL__CPP_CALLBACK_TRAMPOLINE_HPP_ | ||
|
|
||
| #include <functional> | ||
|
|
||
| namespace rclcpp | ||
| { | ||
|
|
||
| namespace detail | ||
| { | ||
|
|
||
| /// Trampoline pattern for wrapping std::function into C-style callbacks. | ||
| /** | ||
| * A common pattern in C is for a function to take a function pointer and a | ||
| * void pointer for "user data" which is passed to the function pointer when it | ||
| * is called from within C. | ||
| * | ||
| * It works by using the user data pointer to store a pointer to a | ||
| * std::function instance. | ||
| * So when called from C, this function will cast the user data to the right | ||
| * std::function type and call it. | ||
| * | ||
| * This should allow you to use free functions, lambdas with and without | ||
| * captures, and various kinds of std::bind instances. | ||
| * | ||
| * The interior of this function is likely to be executed within a C runtime, | ||
| * so no exceptions should be thrown at this point, and doing so results in | ||
| * undefined behavior. | ||
| * | ||
| * \tparam UserDataT Deduced type based on what is passed for user data, | ||
| * usually this type is either `void *` or `const void *`. | ||
| * \tparam Args the arguments being passed to the callback | ||
| * \tparam ReturnT the return type of this function and the callback, default void | ||
| * \param user_data the function pointer, possibly type erased | ||
| * \returns whatever the callback returns, if anything | ||
| */ | ||
| template< | ||
| typename UserDataT, | ||
| typename ... Args, | ||
| typename ReturnT = void | ||
| > | ||
| ReturnT | ||
| cpp_callback_trampoline(UserDataT user_data, Args ... args) noexcept | ||
| { | ||
| auto & actual_callback = *reinterpret_cast<const std::function<ReturnT(Args...)> *>(user_data); | ||
| return actual_callback(args ...); | ||
| } | ||
|
|
||
| } // namespace detail | ||
|
|
||
| } // namespace rclcpp | ||
|
|
||
| #endif // RCLCPP__DETAIL__CPP_CALLBACK_TRAMPOLINE_HPP_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.