-
Notifications
You must be signed in to change notification settings - Fork 78
Add support for content filtered topics #302
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
fujitatomoya
merged 14 commits into
ros2:master
from
iuhilnehc-ynos:topic-content_filtered_topic
Mar 21, 2022
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
717009a
To support a feature of content filtered topic
c9cecb8
Update function description
59217b0
Update based on review
4020fdf
update test for subscription option
542e05e
to support reset content filtered topic with empty string.
6bb8e3c
Update the argument type of interface declaration
dbfd2d4
nit
f2922c6
unscrutify fixed
0711a9a
rename interfaces and structure
5f2abd7
update doc for parameters maximun size to fit the DDS specification
643c0d0
index number rather than size
da68d2b
update api comments
8d7d286
use stack memory for rcutils_string_array_t
f7e2abb
use the helper function set directly for copy
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
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,130 @@ | ||
| // 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 RMW__SUBSCRIPTION_CONTENT_FILTER_OPTIONS_H_ | ||
| #define RMW__SUBSCRIPTION_CONTENT_FILTER_OPTIONS_H_ | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" | ||
| { | ||
| #endif | ||
|
|
||
| #include "rcutils/allocator.h" | ||
| #include "rcutils/types.h" | ||
|
|
||
| #include "rmw/macros.h" | ||
| #include "rmw/ret_types.h" | ||
| #include "rmw/visibility_control.h" | ||
|
|
||
| typedef struct RMW_PUBLIC_TYPE rmw_subscription_content_filter_options_s | ||
| { | ||
| /** | ||
| * Specify the criteria to select the data samples of interest. | ||
| * | ||
| * It is similar to the WHERE part of an SQL clause. | ||
| */ | ||
| char * filter_expression; | ||
| /** | ||
| * Give values to the tokens placeholder ‘parameters’ (i.e., "%n" tokens begin from 0) in the | ||
| * filter_expression. The number of supplied parameters must fit with the requested values. | ||
| * | ||
| * It can be NULL if there is no "%n" tokens placeholder in filter_expression. | ||
| * The maximum index number must be smaller than 100. | ||
| */ | ||
| rcutils_string_array_t expression_parameters; | ||
| } rmw_subscription_content_filter_options_t; | ||
|
|
||
|
|
||
| /// Get zero initialized content filter options. | ||
| RMW_PUBLIC | ||
| rmw_subscription_content_filter_options_t | ||
| rmw_get_zero_initialized_content_filter_options(); | ||
|
|
||
|
|
||
| /// Initialize the given content filter options. | ||
| /** | ||
| * \param[in] filter_expression The filter expression. | ||
| * \param[in] expression_parameters_argc The expression parameters argc. | ||
| * \param[in] expression_parameter_argv The expression parameters argv. | ||
| * \param[in] allocator The allocator used when copying data to the content filter options. | ||
| * \param[out] options The content filter options to be set. | ||
| * \returns RMW_RET_INVALID_ARGUMENT, or | ||
| * \returns RMW_RET_BAD_ALLOC, or | ||
| * \returns RMW_RET_OK | ||
| */ | ||
| RMW_PUBLIC | ||
| rmw_ret_t | ||
| rmw_subscription_content_filter_options_init( | ||
| const char * filter_expression, | ||
| size_t expression_parameters_argc, | ||
| const char * expression_parameter_argv[], | ||
| const rcutils_allocator_t * allocator, | ||
| rmw_subscription_content_filter_options_t * options); | ||
|
|
||
| /// Set the given content filter options. | ||
| /** | ||
| * \param[in] filter_expression The filter expression. | ||
| * \param[in] expression_parameters_argc The expression parameters argc. | ||
| * \param[in] expression_parameter_argv The expression parameters argv. | ||
| * \param[in] allocator The allocator used when copying data to the content filter options. | ||
| * \param[out] options The content filter options to be set. | ||
| * \returns RMW_RET_INVALID_ARGUMENT, or | ||
| * \returns RMW_RET_BAD_ALLOC, or | ||
| * \returns RMW_RET_OK | ||
| */ | ||
| RMW_PUBLIC | ||
| rmw_ret_t | ||
| rmw_subscription_content_filter_options_set( | ||
ivanpauno marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const char * filter_expression, | ||
| size_t expression_parameters_argc, | ||
| const char * expression_parameter_argv[], | ||
| const rcutils_allocator_t * allocator, | ||
| rmw_subscription_content_filter_options_t * options); | ||
|
|
||
| /// Copy the given content filter options. | ||
| /** | ||
| * \param[in] src content filter options to be copied. | ||
| * \param[in] allocator allocator used when copying data to the new content filter options. | ||
| * \param[out] dst content filter options to be set. | ||
| * \returns RMW_RET_INVALID_ARGUMENT, or | ||
| * \returns RMW_RET_BAD_ALLOC, or | ||
| * \returns RMW_RET_OK | ||
| */ | ||
| RMW_PUBLIC | ||
| rmw_ret_t | ||
| rmw_subscription_content_filter_options_copy( | ||
| const rmw_subscription_content_filter_options_t * src, | ||
| const rcutils_allocator_t * allocator, | ||
| rmw_subscription_content_filter_options_t * dst); | ||
|
|
||
|
|
||
| /// Finalize the content filter options. | ||
| /** | ||
| * \param[in] options content filter options to be finalized. | ||
| * \param[in] allocator allocator used to deallocate the content filter options. | ||
| * \returns RMW_RET_INVALID_ARGUMENT, or | ||
| * \returns RMW_RET_ERROR, or | ||
| * \returns RMW_RET_OK | ||
| */ | ||
| RMW_PUBLIC | ||
| rmw_ret_t | ||
| rmw_subscription_content_filter_options_fini( | ||
| rmw_subscription_content_filter_options_t * options, | ||
| const rcutils_allocator_t * allocator); | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif // RMW__SUBSCRIPTION_CONTENT_FILTER_OPTIONS_H_ | ||
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.