-
Notifications
You must be signed in to change notification settings - Fork 77
Adding required structs and methods to get a list of publishers or subscribers with their respective qos #186
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
Changes from 26 commits
cce521a
8fe5fd2
69744dd
20bedc2
94b27b3
ed9651e
5c5ccbf
06c5d4c
a5e113b
1714008
583687e
91a5668
091988c
ad84fb3
9b22c98
383e4a6
5e0e27f
1d9e1fe
cbd91b3
e24e1f4
272a2dc
c00ad69
3e8f892
a1c35de
747c4c9
06bb093
c82859b
702aef2
8ddb815
6d9675a
2915b73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,130 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 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__GET_TOPIC_INFO_H_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #define RMW__GET_TOPIC_INFO_H_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #ifdef __cplusplus | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| extern "C" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include "rmw/topic_info_array.h" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include "rmw/visibility_control.h" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Retrieves the information for all publishers to a given topic. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
wjwwood marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The retrieved information will contain the publisher's node name, node namespace, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * associated topic type, publisher gid and qos profile. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The node parameter must not be `NULL` and must point to a valid node. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The topic_name parameter must not be `NULL` and must follow the topic naming rules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * mentioned at http://design.ros2.org/articles/topic_and_service_names.html | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Non existent topic names are allowed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
wjwwood marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * In that case, this function will return an empty array. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds like they are allowed? Why not an error case?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure what error code to use in this case (a generic Also, this function shouldn't be used for detecting the existence of a topic; that feels like it is encroaching on the purpose of
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry this comment doesn't make since if "non-existent topic" just means a topic that isn't on the graph. I was still thinking an empty string, in which case it should create an error, just like if it violated any of the other rules in the topic name rules set. I think this can be resolved without changes. Though a follow up question is what happens if the value for There is already this function: rmw/rmw/include/rmw/validate_full_topic_name.h Lines 37 to 90 in 813b94d
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * It is the responsibility of the caller to ensure that `publishers_info` parameter points | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * to a valid struct of type rmw_topic_info_array_t. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The `count` field inside the struct must be set to 0 and the `info_array` field inside | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * the struct must be set to null. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
wjwwood marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @see rmw_get_zero_initialized_topic_info_array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
wjwwood marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The `allocator` will be used to allocate memory to the `info_array` member | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * inside of `publishers_info`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Moreover, every const char * member inside of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
wjwwood marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * rmw_topic_info_t will be assigned a copied value on allocated memory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @see rmw_topic_info_set_topic_type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @see rmw_topic_info_set_node_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @see rmw_topic_info_set_node_namespace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * However, it is the responsibility of the caller to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * reclaim any allocated resources to `publishers_info` to avoid leaking memory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @see rmw_topic_info_array_fini | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \param[in] node the handle to the node being used to query the ROS graph. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \param[in] allocator the allocator to be used when allocating space for the array. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \param[in] topic_name the name of the topic for which the list of publishers will be retrieved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \param[in] no_mangle if true, the topic name will not be mangled. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \param[out] publishers_info an array of rmw_topic_info_t. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \return `RMW_RET_OK` if the query was successful, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \return `RMW_RET_INVALID_ARGUMENT` if the node is invalid, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \return `RMW_RET_INVALID_ARGUMENT` if any arguments are invalid, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \return `RMW_RET_BAD_ALLOC` if memory allocation fails, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \return `RMW_RET_ERROR` if an unspecified error occurs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RMW_PUBLIC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RMW_WARN_UNUSED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rmw_ret_t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rmw_get_publishers_info_by_topic( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const rmw_node_t * node, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rcutils_allocator_t * allocator, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const char * topic_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool no_mangle, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rmw_topic_info_array_t * publishers_info); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// Retrieves the information for all subscriptions to a given topic. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The retrieved information will contain the subscriptions's node name, node namespace, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * associated topic type, subscription gid and qos profile. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The node parameter must not be `NULL` and must point to a valid node. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The topic_name parameter must not be `NULL` and must follow the topic naming rules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * mentioned at http://design.ros2.org/articles/topic_and_service_names.html | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Non existent topic names are allowed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * They will return an empty array. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * It is the responsibility of the caller to ensure that `subscriptions_info` parameter points | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * to a valid struct of type rmw_topic_info_array_t. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The `count` field inside the struct must be set to 0 and the `info_array` field inside | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * the struct must be set to null. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @see rmw_get_zero_initialized_topic_info_array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * The `allocator` will be used to allocate memory to the `info_array` member | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * inside of `publishers_info`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Moreover, every const char * member inside of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * rmw_topic_info_t will be assigned a copied value on allocated memory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @see rmw_topic_info_set_topic_type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @see rmw_topic_info_set_node_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @see rmw_topic_info_set_node_namespace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * However, it is the responsibility of the caller to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * reclaim any allocated resources to `publishers_info` to avoid leaking memory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @see rmw_topic_info_array_fini | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \param[in] node the handle to the node being used to query the ROS graph. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \param[in] allocator the allocator to be used when allocating space for the array. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \param[in] topic_name the name of the topic for which the list of subscriptions will be retrieved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \param[in] no_mangle if true, the topic name will not be mangled. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \param[out] subscriptions_info an array of rmw_topic_info_t.. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \return `RMW_RET_OK` if the query was successful, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \return `RMW_RET_INVALID_ARGUMENT` if the node is invalid, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \return `RMW_RET_INVALID_ARGUMENT` if any arguments are invalid, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \return `RMW_RET_BAD_ALLOC` if memory allocation fails, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * \return `RMW_RET_ERROR` if an unspecified error occurs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RMW_PUBLIC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RMW_WARN_UNUSED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rmw_ret_t | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rmw_get_subscriptions_info_by_topic( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
wjwwood marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const rmw_node_t * node, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rcutils_allocator_t * allocator, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const char * topic_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool no_mangle, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rmw_topic_info_array_t * subscriptions_info); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #ifdef __cplusplus | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #endif // RMW__GET_TOPIC_INFO_H_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,219 @@ | ||
| // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // | ||
| // 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__TOPIC_INFO_H_ | ||
| #define RMW__TOPIC_INFO_H_ | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" | ||
| { | ||
| #endif | ||
|
|
||
| #include "rcutils/allocator.h" | ||
| #include "rmw/types.h" | ||
| #include "rmw/visibility_control.h" | ||
|
|
||
| /// A structure that encapsulates the name, namespace, topic_type, gid and qos_profile | ||
| /// of publishers and subscriptions for a topic | ||
wjwwood marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| typedef struct RMW_PUBLIC_TYPE rmw_topic_info_t | ||
wjwwood marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| /// Name of the node | ||
| const char * node_name; | ||
| /// Namespace of the node | ||
| const char * node_namespace; | ||
| /// The associated topic type | ||
| const char * topic_type; | ||
| /// The GID of the node | ||
| uint8_t gid[RMW_GID_STORAGE_SIZE]; | ||
| /// Qos profile of the node | ||
wjwwood marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| rmw_qos_profile_t qos_profile; | ||
| } rmw_topic_info_t; | ||
|
|
||
| /// Return a rmw_topic_info_t struct with members initialized to `NULL`. | ||
| RMW_PUBLIC | ||
| RMW_WARN_UNUSED | ||
| rmw_topic_info_t | ||
| rmw_get_zero_initialized_topic_info(void); | ||
|
|
||
| /// Finalize a rmw_topic_info_t object. | ||
| /** | ||
| * The rmw_topic_info_t struct has members which require memory to be allocated to them before | ||
| * setting values. | ||
| * This function reclaims any allocated resources within the object and zeroes out all other | ||
| * members. | ||
| * | ||
| * \param[inout] topic_info object to be finalized | ||
| * \param[in] allocator the allocator used to allocate memory to the object | ||
| * \returns `RMW_RET_OK` on successfully reclaiming memory, or | ||
| * \returns `RMW_RET_INVALID_ARGUMENT` if any parameters are NULL, or | ||
| * \returns `RMW_RET_ERROR` when an unspecified error occurs. | ||
| */ | ||
| RMW_PUBLIC | ||
| RMW_WARN_UNUSED | ||
| rmw_ret_t | ||
| rmw_topic_info_fini( | ||
| rmw_topic_info_t * topic_info, | ||
| rcutils_allocator_t * allocator); | ||
|
|
||
| /// Set the topic_type in rmw_topic_info_t. | ||
| /** | ||
| * rmw_topic_info_t has a member topic_type of type const char *; | ||
| * this function allocates memory and copies the value of param passed to it. | ||
| * | ||
| * \param[inout] topic_info pointer to an initialized instance of rmw_topic_info_t | ||
| * \param[in] topic_type the topic_type value to set in rmw_topic_info_t | ||
| * \param[in] allocator the allocator that will be used to allocate memory | ||
| * \returns `RMW_RET_OK` on successfully setting the topic_type, or | ||
| * \returns `RMW_RET_INVALID_ARGUMENT` if any parameters are NULL, or | ||
| * \returns `RMW_RET_ERROR` when an unspecified error occurs. | ||
| */ | ||
| RMW_PUBLIC | ||
| RMW_WARN_UNUSED | ||
| rmw_ret_t | ||
| rmw_topic_info_set_topic_type( | ||
| rmw_topic_info_t * topic_info, | ||
| const char * topic_type, | ||
| rcutils_allocator_t * allocator); | ||
|
|
||
| /// Set the node_name in rmw_topic_info_t. | ||
| /** | ||
| * rmw_topic_info_t has a member node_name of type const char *; | ||
| * this function allocates memory and copies the value of param passed to it. | ||
| * | ||
| * \param[inout] topic_info pointer to an initialized instance of rmw_topic_info_t | ||
| * \param[in] node_name the node_name value to set in rmw_topic_info_t | ||
| * \param[in] allocator the allocator that will be used to allocate memory | ||
| * \returns `RMW_RET_OK` on successfully setting the node_name, or | ||
| * \returns `RMW_RET_INVALID_ARGUMENT` if any parameters are NULL, or | ||
| * \returns `RMW_RET_ERROR` when an unspecified error occurs. | ||
| */ | ||
| RMW_PUBLIC | ||
| RMW_WARN_UNUSED | ||
| rmw_ret_t | ||
| rmw_topic_info_set_node_name( | ||
| rmw_topic_info_t * topic_info, | ||
| const char * node_name, | ||
| rcutils_allocator_t * allocator); | ||
|
|
||
| /// Set the node_namespace in rmw_topic_info_t. | ||
| /** | ||
| * rmw_topic_info_t has a member node_namespace of type const char *; | ||
| * this function allocates memory and copies the value of param passed to it. | ||
| * | ||
| * \param[inout] topic_info pointer to an initialized instance of rmw_topic_info_t | ||
| * \param[in] node_namespace the node_namespace value to set in rmw_topic_info_t | ||
| * \param[in] allocator the allocator that will be used to allocate memory | ||
| * \returns `RMW_RET_OK` on successfully setting the node_namespace, or | ||
| * \returns `RMW_RET_INVALID_ARGUMENT` if any parameters are NULL, or | ||
| * \returns `RMW_RET_ERROR` when an unspecified error occurs. | ||
| */ | ||
| RMW_PUBLIC | ||
| RMW_WARN_UNUSED | ||
| rmw_ret_t | ||
| rmw_topic_info_set_node_namespace( | ||
| rmw_topic_info_t * topic_info, | ||
| const char * node_namespace, | ||
| rcutils_allocator_t * allocator); | ||
|
|
||
| /// Set the qos_profile in rmw_topic_info_t. | ||
| /** | ||
| * rmw_topic_info_t has a member qos_profile of type const rmw_qos_profile_t *. | ||
| * This function assigns the passed qos_profile pointer to the member. | ||
| * | ||
| * \param[inout] topic_info pointer to an initialized instance of rmw_topic_info_t | ||
| * \param[in] qos_profile the qos_profile to set in rmw_topic_info_t | ||
| * \returns `RMW_RET_OK` on successfully setting the qos_profile, or | ||
| * \returns `RMW_RET_INVALID_ARGUMENT` if any parameters are NULL, or | ||
| * \returns `RMW_RET_ERROR` when an unspecified error occurs. | ||
| */ | ||
| RMW_PUBLIC | ||
| RMW_WARN_UNUSED | ||
| rmw_ret_t | ||
| rmw_topic_info_set_qos_profile( | ||
| rmw_topic_info_t * topic_info, | ||
| const rmw_qos_profile_t * qos_profile); | ||
|
|
||
| /// Set the gid in rmw_topic_info_t. | ||
| /** | ||
| * Copies the values from gid into the gid member inside topic_info. | ||
| * | ||
| * \param[inout] topic_info pointer to an initialized instance of rmw_topic_info_t | ||
| * \param[in] gid the gid value to set in rmw_topic_info_t | ||
| * \param[in] size the size of the gid param | ||
| * \returns `RMW_RET_OK` on successfully setting the gid, or | ||
| * \returns `RMW_RET_INVALID_ARGUMENT` if any parameters are NULL, or | ||
| * \returns `RMW_RET_INVALID_ARGUMENT` size is greater than RMW_GID_STORAGE_SIZE, or | ||
| * \returns `RMW_RET_ERROR` when an unspecified error occurs. | ||
| */ | ||
| RMW_PUBLIC | ||
| RMW_WARN_UNUSED | ||
| rmw_ret_t | ||
| rmw_topic_info_set_gid( | ||
| rmw_topic_info_t * topic_info, | ||
| const uint8_t gid[], | ||
| size_t size); | ||
|
|
||
| /// Free the memory which was allocated for topic_info.node_name | ||
| /** | ||
| * | ||
| * \param[inout] topic_info pointer to an initialized instance of rmw_topic_info_t | ||
| * \param[in] allocator the allocator that was used to allocate memory | ||
| * \returns `RMW_RET_OK` on successfully freeing the memory, or | ||
| * \returns `RMW_RET_INVALID_ARGUMENT` if any parameters are NULL, or | ||
| * \returns `RMW_RET_ERROR` when an unspecified error occurs. | ||
| */ | ||
| RMW_PUBLIC | ||
| RMW_WARN_UNUSED | ||
| rmw_ret_t | ||
| rmw_topic_info_fini_node_name( | ||
jaisontj marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| rmw_topic_info_t * topic_info, | ||
| rcutils_allocator_t * allocator); | ||
|
|
||
| /// Free the memory which was allocated for topic_info.node_namespace | ||
| /** | ||
| * | ||
| * \param[inout] topic_info pointer to an initialized instance of rmw_topic_info_t | ||
| * \param[in] allocator the allocator that was used to allocate memory | ||
| * \returns `RMW_RET_OK` on successfully freeing the memory, or | ||
| * \returns `RMW_RET_INVALID_ARGUMENT` if any parameters are NULL, or | ||
| * \returns `RMW_RET_ERROR` when an unspecified error occurs. | ||
| */ | ||
| RMW_PUBLIC | ||
| RMW_WARN_UNUSED | ||
| rmw_ret_t | ||
| rmw_topic_info_fini_node_namespace( | ||
| rmw_topic_info_t * topic_info, | ||
| rcutils_allocator_t * allocator); | ||
|
|
||
| /// Free the memory which was allocated for topic_info.topic_type | ||
| /** | ||
| * | ||
| * \param[inout] topic_info pointer to an initialized instance of rmw_topic_info_t | ||
| * \param[in] allocator the allocator that was used to allocate memory | ||
| * \returns `RMW_RET_OK` on successfully freeing the memory, or | ||
| * \returns `RMW_RET_INVALID_ARGUMENT` if any parameters are NULL, or | ||
| * \returns `RMW_RET_ERROR` when an unspecified error occurs. | ||
| */ | ||
| RMW_PUBLIC | ||
| RMW_WARN_UNUSED | ||
| rmw_ret_t | ||
| rmw_topic_info_fini_topic_type( | ||
| rmw_topic_info_t * topic_info, | ||
| rcutils_allocator_t * allocator); | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif // RMW__TOPIC_INFO_H_ | ||
Uh oh!
There was an error while loading. Please reload this page.