From cd7e90ba65b03ffad1b46af6ecacb9d53121691c Mon Sep 17 00:00:00 2001 From: Jaison Titus Date: Tue, 22 Oct 2019 09:15:25 -0700 Subject: [PATCH 1/7] Added stubs for rmw_get_publishers_info_by_topic and rmw_get_subscriptions_info_by_topic. Signed-off-by: Jaison Titus --- rmw_connext_cpp/CMakeLists.txt | 3 +- rmw_connext_cpp/src/rmw_get_topic_info.cpp | 47 +++++++++++++++++++ rmw_connext_dynamic_cpp/src/functions.cpp | 22 +++++++++ rmw_connext_shared_cpp/CMakeLists.txt | 3 +- .../shared_functions.hpp | 1 + .../rmw_connext_shared_cpp/topic_info.hpp | 42 +++++++++++++++++ rmw_connext_shared_cpp/src/topic_info.cpp | 45 ++++++++++++++++++ 7 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 rmw_connext_cpp/src/rmw_get_topic_info.cpp create mode 100644 rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_info.hpp create mode 100644 rmw_connext_shared_cpp/src/topic_info.cpp diff --git a/rmw_connext_cpp/CMakeLists.txt b/rmw_connext_cpp/CMakeLists.txt index 6eedd9c7..7f7a1b4b 100644 --- a/rmw_connext_cpp/CMakeLists.txt +++ b/rmw_connext_cpp/CMakeLists.txt @@ -180,7 +180,8 @@ add_library( src/rmw_trigger_guard_condition.cpp src/rmw_wait.cpp src/rmw_wait_set.cpp - src/serialization_format.cpp) + src/serialization_format.cpp + src/rmw_get_topic_info.cpp) ament_target_dependencies(rmw_connext_cpp "rcutils" "rmw" diff --git a/rmw_connext_cpp/src/rmw_get_topic_info.cpp b/rmw_connext_cpp/src/rmw_get_topic_info.cpp new file mode 100644 index 00000000..3324c8c2 --- /dev/null +++ b/rmw_connext_cpp/src/rmw_get_topic_info.cpp @@ -0,0 +1,47 @@ +// 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. + +#include "rmw/rmw.h" + +#include "rmw_connext_shared_cpp/topic_info.hpp" + +#include "rmw_connext_cpp/identifier.hpp" + +extern "C" +{ +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) +{ + return get_publishers_info_by_topic(rti_connext_identifier, node, allocator, topic_name, + no_mangle, publishers_info); +} + +rmw_ret_t +rmw_get_subscriptions_info_by_topic( + const rmw_node_t * node, + rcutils_allocator_t * allocator, + const char * topic_name, + bool no_mangle, + rmw_topic_info_array_t * subscriptions_info) +{ + + return get_subscriptions_info_by_topic(rti_connext_identifier, node, allocator, topic_name, + no_mangle, subscriptions_info); +} +} // extern "C" diff --git a/rmw_connext_dynamic_cpp/src/functions.cpp b/rmw_connext_dynamic_cpp/src/functions.cpp index e665dc5a..43dc7e44 100644 --- a/rmw_connext_dynamic_cpp/src/functions.cpp +++ b/rmw_connext_dynamic_cpp/src/functions.cpp @@ -2704,6 +2704,28 @@ rmw_count_subscribers( return count_subscribers(rti_connext_dynamic_identifier, node, topic_name, count); } +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) +{ + return get_publishers_info_by_topic(rti_connext_identifier, node, allocator, topic_name, no_mangle, publishers_info); +} + +rmw_ret_t +rmw_get_subscriptions_info_by_topic( + const rmw_node_t * node, + rcutils_allocator_t * allocator, + const char * topic_name, + bool no_mangle, + rmw_topic_info_array_t * subscriptions_info) +{ + return get_subscriptions_info_by_topic(rti_connext_identifier, node, allocator, topic_name, no_mangle, subscriptions_info); +} + rmw_ret_t rmw_get_gid_for_publisher(const rmw_publisher_t * publisher, rmw_gid_t * gid) { diff --git a/rmw_connext_shared_cpp/CMakeLists.txt b/rmw_connext_shared_cpp/CMakeLists.txt index 7afa888c..016b81eb 100644 --- a/rmw_connext_shared_cpp/CMakeLists.txt +++ b/rmw_connext_shared_cpp/CMakeLists.txt @@ -56,7 +56,8 @@ add_library( src/wait_set.cpp src/types/custom_data_reader_listener.cpp src/types/custom_publisher_listener.cpp - src/types/custom_subscriber_listener.cpp) + src/types/custom_subscriber_listener.cpp + src/topic_info.cpp) ament_target_dependencies(rmw_connext_shared_cpp "rcpputils" "rcutils" diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/shared_functions.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/shared_functions.hpp index 8667da22..0532e192 100644 --- a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/shared_functions.hpp +++ b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/shared_functions.hpp @@ -32,5 +32,6 @@ #include "types.hpp" #include "wait.hpp" #include "wait_set.hpp" +#include "topic_info.hpp" #endif // RMW_CONNEXT_SHARED_CPP__SHARED_FUNCTIONS_HPP_ diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_info.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_info.hpp new file mode 100644 index 00000000..a112ddde --- /dev/null +++ b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_info.hpp @@ -0,0 +1,42 @@ +// 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_CONNEXT_SHARED_CPP__TOPIC_INFO_HPP +#define RMW_CONNEXT_SHARED_CPP__TOPIC_INFO_HPP + +#include "rmw/types.h" + +#include "rmw_connext_shared_cpp/visibility_control.h" + +RMW_CONNEXT_SHARED_CPP_PUBLIC +rmw_ret_t +get_publishers_info_by_topic( + const char * identifier, + const rmw_node_t * node, + rcutils_allocator_t * allocator, + const char * topic_name, + bool no_mangle, + rmw_topic_info_array_t * publishers_info); + +RMW_CONNEXT_SHARED_CPP_PUBLIC +rmw_ret_t +get_subscriptions_info_by_topic( + const char * identifier, + const rmw_node_t * node, + rcutils_allocator_t * allocator, + const char * topic_name, + bool no_mangle, + rmw_topic_info_array_t * subscriptions_info); + +#endif // RMW_CONNEXT_SHARED_CPP__TOPIC_INFO_HPP diff --git a/rmw_connext_shared_cpp/src/topic_info.cpp b/rmw_connext_shared_cpp/src/topic_info.cpp new file mode 100644 index 00000000..a24b7ddc --- /dev/null +++ b/rmw_connext_shared_cpp/src/topic_info.cpp @@ -0,0 +1,45 @@ +// 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. + +#include + +#include "rmw_connext_shared_cpp/count.hpp" +#include "rmw_connext_shared_cpp/demangle.hpp" +#include "rmw_connext_shared_cpp/types.hpp" + +#include "rmw/error_handling.h" + +rmw_ret_t +get_publishers_info_by_topic( + const char *, + const rmw_node_t *, + rcutils_allocator_t *, + const char *, + bool, + rmw_topic_info_array_t *) +{ + return RMW_RET_UNSUPPORTED; +} + +rmw_ret_t +get_subscriptions_info_by_topic( + const char *, + const rmw_node_t *, + rcutils_allocator_t * , + const char *, + bool, + rmw_topic_info_array_t *) +{ + return RMW_RET_UNSUPPORTED; +} From 002be3e21216b942901d0178292f84b3899bf7c8 Mon Sep 17 00:00:00 2001 From: Jaison Titus Date: Mon, 18 Nov 2019 13:11:20 -0800 Subject: [PATCH 2/7] Fixed linter issues Signed-off-by: Jaison Titus --- rmw_connext_cpp/src/rmw_get_topic_info.cpp | 1 - .../include/rmw_connext_shared_cpp/topic_info.hpp | 6 +++--- rmw_connext_shared_cpp/src/topic_info.cpp | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/rmw_connext_cpp/src/rmw_get_topic_info.cpp b/rmw_connext_cpp/src/rmw_get_topic_info.cpp index 3324c8c2..b975788f 100644 --- a/rmw_connext_cpp/src/rmw_get_topic_info.cpp +++ b/rmw_connext_cpp/src/rmw_get_topic_info.cpp @@ -40,7 +40,6 @@ rmw_get_subscriptions_info_by_topic( bool no_mangle, rmw_topic_info_array_t * subscriptions_info) { - return get_subscriptions_info_by_topic(rti_connext_identifier, node, allocator, topic_name, no_mangle, subscriptions_info); } diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_info.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_info.hpp index a112ddde..00c66fd9 100644 --- a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_info.hpp +++ b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_info.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef RMW_CONNEXT_SHARED_CPP__TOPIC_INFO_HPP -#define RMW_CONNEXT_SHARED_CPP__TOPIC_INFO_HPP +#ifndef RMW_CONNEXT_SHARED_CPP__TOPIC_INFO_HPP_ +#define RMW_CONNEXT_SHARED_CPP__TOPIC_INFO_HPP_ #include "rmw/types.h" @@ -39,4 +39,4 @@ get_subscriptions_info_by_topic( bool no_mangle, rmw_topic_info_array_t * subscriptions_info); -#endif // RMW_CONNEXT_SHARED_CPP__TOPIC_INFO_HPP +#endif // RMW_CONNEXT_SHARED_CPP__TOPIC_INFO_HPP_ diff --git a/rmw_connext_shared_cpp/src/topic_info.cpp b/rmw_connext_shared_cpp/src/topic_info.cpp index a24b7ddc..5ce0aae7 100644 --- a/rmw_connext_shared_cpp/src/topic_info.cpp +++ b/rmw_connext_shared_cpp/src/topic_info.cpp @@ -36,7 +36,7 @@ rmw_ret_t get_subscriptions_info_by_topic( const char *, const rmw_node_t *, - rcutils_allocator_t * , + rcutils_allocator_t *, const char *, bool, rmw_topic_info_array_t *) From f1449223fb42f864290251448fc34e31b9e4a7fd Mon Sep 17 00:00:00 2001 From: Jaison Titus Date: Tue, 19 Nov 2019 15:47:15 -0800 Subject: [PATCH 3/7] Included required headers in topic_info.cpp Signed-off-by: Jaison Titus --- rmw_connext_shared_cpp/src/topic_info.cpp | 28 +++++++++++------------ 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/rmw_connext_shared_cpp/src/topic_info.cpp b/rmw_connext_shared_cpp/src/topic_info.cpp index 5ce0aae7..2e0d045c 100644 --- a/rmw_connext_shared_cpp/src/topic_info.cpp +++ b/rmw_connext_shared_cpp/src/topic_info.cpp @@ -14,32 +14,30 @@ #include -#include "rmw_connext_shared_cpp/count.hpp" -#include "rmw_connext_shared_cpp/demangle.hpp" -#include "rmw_connext_shared_cpp/types.hpp" +#include "rmw_connext_shared_cpp/topic_info.hpp" #include "rmw/error_handling.h" rmw_ret_t get_publishers_info_by_topic( - const char *, - const rmw_node_t *, - rcutils_allocator_t *, - const char *, - bool, - rmw_topic_info_array_t *) + const char * /* unused_param */, + const rmw_node_t * /* unused_param */, + rcutils_allocator_t * /* unused_param */, + const char * /* unused_param */, + bool /* unused_param */, + rmw_topic_info_array_t * /* unused_param */) { return RMW_RET_UNSUPPORTED; } rmw_ret_t get_subscriptions_info_by_topic( - const char *, - const rmw_node_t *, - rcutils_allocator_t *, - const char *, - bool, - rmw_topic_info_array_t *) + const char * /* unused_param */, + const rmw_node_t * /* unused_param */, + rcutils_allocator_t * /* unused_param */, + const char * /* unused_param */, + bool /* unused_param */, + rmw_topic_info_array_t * /* unused_param */) { return RMW_RET_UNSUPPORTED; } From a176724124fb4869eddfff0d126b46640cb2290a Mon Sep 17 00:00:00 2001 From: Jaison Titus Date: Tue, 26 Nov 2019 17:55:15 -0800 Subject: [PATCH 4/7] Modifications to handle header file changes in rmw Signed-off-by: Jaison Titus --- rmw_connext_cpp/src/rmw_get_topic_info.cpp | 5 ++--- rmw_connext_dynamic_cpp/src/functions.cpp | 2 ++ .../include/rmw_connext_shared_cpp/topic_info.hpp | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rmw_connext_cpp/src/rmw_get_topic_info.cpp b/rmw_connext_cpp/src/rmw_get_topic_info.cpp index b975788f..dea40971 100644 --- a/rmw_connext_cpp/src/rmw_get_topic_info.cpp +++ b/rmw_connext_cpp/src/rmw_get_topic_info.cpp @@ -12,10 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "rmw/rmw.h" - +#include "rmw/get_topic_info.h" +#include "rmw/topic_info_array.h" #include "rmw_connext_shared_cpp/topic_info.hpp" - #include "rmw_connext_cpp/identifier.hpp" extern "C" diff --git a/rmw_connext_dynamic_cpp/src/functions.cpp b/rmw_connext_dynamic_cpp/src/functions.cpp index 43dc7e44..893fb299 100644 --- a/rmw_connext_dynamic_cpp/src/functions.cpp +++ b/rmw_connext_dynamic_cpp/src/functions.cpp @@ -51,9 +51,11 @@ #include "rmw/allocators.h" #include "rmw/error_handling.h" #include "rmw/get_service_names_and_types.h" +#include "rmw/get_topic_info.h" #include "rmw/get_topic_names_and_types.h" #include "rmw/init.h" #include "rmw/rmw.h" +#include "rmw/topic_info_array.h" #include "rmw/types.h" #include "rosidl_generator_c/primitives_sequence_functions.h" diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_info.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_info.hpp index 00c66fd9..c9daec88 100644 --- a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_info.hpp +++ b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_info.hpp @@ -15,8 +15,7 @@ #ifndef RMW_CONNEXT_SHARED_CPP__TOPIC_INFO_HPP_ #define RMW_CONNEXT_SHARED_CPP__TOPIC_INFO_HPP_ -#include "rmw/types.h" - +#include "rmw/topic_info_array.h" #include "rmw_connext_shared_cpp/visibility_control.h" RMW_CONNEXT_SHARED_CPP_PUBLIC From dde52b5c8086ae1dc9bc711832f2876e672fc71f Mon Sep 17 00:00:00 2001 From: Miaofei Date: Wed, 11 Dec 2019 12:00:51 -0800 Subject: [PATCH 5/7] address PR comments Signed-off-by: Miaofei --- rmw_connext_dynamic_cpp/src/functions.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rmw_connext_dynamic_cpp/src/functions.cpp b/rmw_connext_dynamic_cpp/src/functions.cpp index 893fb299..9304ba15 100644 --- a/rmw_connext_dynamic_cpp/src/functions.cpp +++ b/rmw_connext_dynamic_cpp/src/functions.cpp @@ -77,6 +77,7 @@ #include "rosidl_typesupport_introspection_c/visibility_control.h" #include "rmw_connext_shared_cpp/shared_functions.hpp" +#include "rmw_connext_shared_cpp/topic_info.hpp" #include "rmw_connext_shared_cpp/types.hpp" #include "./macros.hpp" @@ -2714,7 +2715,7 @@ rmw_get_publishers_info_by_topic( bool no_mangle, rmw_topic_info_array_t * publishers_info) { - return get_publishers_info_by_topic(rti_connext_identifier, node, allocator, topic_name, no_mangle, publishers_info); + return get_publishers_info_by_topic(rti_connext_dynamic_identifier, node, allocator, topic_name, no_mangle, publishers_info); } rmw_ret_t @@ -2725,7 +2726,7 @@ rmw_get_subscriptions_info_by_topic( bool no_mangle, rmw_topic_info_array_t * subscriptions_info) { - return get_subscriptions_info_by_topic(rti_connext_identifier, node, allocator, topic_name, no_mangle, subscriptions_info); + return get_subscriptions_info_by_topic(rti_connext_dynamic_identifier, node, allocator, topic_name, no_mangle, subscriptions_info); } rmw_ret_t From c03c3e422a204194cd8da98ed67e337639253fef Mon Sep 17 00:00:00 2001 From: Miaofei Date: Thu, 9 Jan 2020 16:15:52 -0800 Subject: [PATCH 6/7] address more PR comments Signed-off-by: Miaofei --- rmw_connext_cpp/src/rmw_get_topic_info.cpp | 18 ++++++++++---- .../rmw_connext_shared_cpp/topic_cache.hpp | 24 +++++++++---------- .../src/node_info_and_types.cpp | 18 +++++++------- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/rmw_connext_cpp/src/rmw_get_topic_info.cpp b/rmw_connext_cpp/src/rmw_get_topic_info.cpp index dea40971..67933ad4 100644 --- a/rmw_connext_cpp/src/rmw_get_topic_info.cpp +++ b/rmw_connext_cpp/src/rmw_get_topic_info.cpp @@ -27,8 +27,13 @@ rmw_get_publishers_info_by_topic( bool no_mangle, rmw_topic_info_array_t * publishers_info) { - return get_publishers_info_by_topic(rti_connext_identifier, node, allocator, topic_name, - no_mangle, publishers_info); + return get_publishers_info_by_topic( + rti_connext_identifier, + node, + allocator, + topic_name, + no_mangle, + publishers_info); } rmw_ret_t @@ -39,7 +44,12 @@ rmw_get_subscriptions_info_by_topic( bool no_mangle, rmw_topic_info_array_t * subscriptions_info) { - return get_subscriptions_info_by_topic(rti_connext_identifier, node, allocator, topic_name, - no_mangle, subscriptions_info); + return get_subscriptions_info_by_topic( + rti_connext_identifier, + node, + allocator, + topic_name, + no_mangle, + subscriptions_info); } } // extern "C" diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_cache.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_cache.hpp index 933ceb42..a0b5d596 100644 --- a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_cache.hpp +++ b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_cache.hpp @@ -73,8 +73,8 @@ class TopicCache /** * Helper function to initialize the set inside a participant map. * - * @param map - * @param participant_guid + * \param map + * \param participant_guid */ void initialize_participant_map( ParticipantToTopicGuidMap & map, @@ -87,7 +87,7 @@ class TopicCache public: /** - * @return a map of topic name to the vector of topic types used. + * \return a map of topic name to the vector of topic types used. */ const TopicGuidToInfo & get_topic_guid_to_info() const { @@ -95,7 +95,7 @@ class TopicCache } /** - * @return a map of participant guid to the vector of topic names used. + * \return a map of participant guid to the vector of topic names used. */ const ParticipantToTopicGuidMap & get_participant_to_topic_guid_map() const { @@ -105,10 +105,10 @@ class TopicCache /** * Add a topic based on discovery. * - * @param participant_guid - * @param topic_name - * @param type_name - * @return true if a change has been recorded + * \param participant_guid + * \param topic_name + * \param type_name + * \return true if a change has been recorded */ bool add_topic( const GUID_t & participant_guid, @@ -143,8 +143,8 @@ class TopicCache /** * Remove a topic based on discovery. * - * @param guid - * @return true if a change has been recorded + * \param guid + * \return true if a change has been recorded */ bool remove_topic(const GUID_t & topic_guid) { @@ -190,8 +190,8 @@ class TopicCache /** * Get topic types by guid. * - * @param participant_guid to find topic types - * @return topic types corresponding to that guid + * \param participant_guid to find topic types + * \return topic types corresponding to that guid */ TopicsTypes get_topic_types_by_guid(const GUID_t & participant_guid) { diff --git a/rmw_connext_shared_cpp/src/node_info_and_types.cpp b/rmw_connext_shared_cpp/src/node_info_and_types.cpp index 12298aab..6dea0713 100644 --- a/rmw_connext_shared_cpp/src/node_info_and_types.cpp +++ b/rmw_connext_shared_cpp/src/node_info_and_types.cpp @@ -45,10 +45,10 @@ * Check to see if a node name and namespace match the user data QoS policy * of a node. * - * @param user_data_qos to inspect - * @param node_name to match - * @param node_namespace to match - * @return true if match + * \param user_data_qos to inspect + * \param node_name to match + * \param node_namespace to match + * \return true if match */ bool __is_node_match( @@ -76,12 +76,12 @@ __is_node_match( * Get a DDS GUID key for the discovered participant which matches the * node_name and node_namepace supplied. * - * @param node_info to discover nodes - * @param node_name to match - * @param node_namespace to match - * @param key [out] guid key that matches the node name and namespace + * \param node_info to discover nodes + * \param node_name to match + * \param node_namespace to match + * \param key [out] guid key that matches the node name and namespace * - * @return RMW_RET_OK if success, ERROR otherwise + * \return RMW_RET_OK if success, ERROR otherwise */ rmw_ret_t __get_key( From 8319ec5894c81643fb42d63d6ff58bff42686b88 Mon Sep 17 00:00:00 2001 From: Miaofei Date: Thu, 9 Jan 2020 23:44:28 -0800 Subject: [PATCH 7/7] rename *topic_info* to *topic_endpoint_info* Signed-off-by: Miaofei --- rmw_connext_cpp/CMakeLists.txt | 2 +- ...fo.cpp => rmw_get_topic_endpoint_info.cpp} | 10 ++++---- rmw_connext_dynamic_cpp/src/functions.cpp | 10 ++++---- rmw_connext_shared_cpp/CMakeLists.txt | 2 +- .../shared_functions.hpp | 2 +- .../rmw_connext_shared_cpp/topic_cache.hpp | 24 +++++++++---------- ...topic_info.hpp => topic_endpoint_info.hpp} | 12 +++++----- ...topic_info.cpp => topic_endpoint_info.cpp} | 6 ++--- 8 files changed, 34 insertions(+), 34 deletions(-) rename rmw_connext_cpp/src/{rmw_get_topic_info.cpp => rmw_get_topic_endpoint_info.cpp} (83%) rename rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/{topic_info.hpp => topic_endpoint_info.hpp} (77%) rename rmw_connext_shared_cpp/src/{topic_info.cpp => topic_endpoint_info.cpp} (87%) diff --git a/rmw_connext_cpp/CMakeLists.txt b/rmw_connext_cpp/CMakeLists.txt index 7f7a1b4b..947c29ad 100644 --- a/rmw_connext_cpp/CMakeLists.txt +++ b/rmw_connext_cpp/CMakeLists.txt @@ -181,7 +181,7 @@ add_library( src/rmw_wait.cpp src/rmw_wait_set.cpp src/serialization_format.cpp - src/rmw_get_topic_info.cpp) + src/rmw_get_topic_endpoint_info.cpp) ament_target_dependencies(rmw_connext_cpp "rcutils" "rmw" diff --git a/rmw_connext_cpp/src/rmw_get_topic_info.cpp b/rmw_connext_cpp/src/rmw_get_topic_endpoint_info.cpp similarity index 83% rename from rmw_connext_cpp/src/rmw_get_topic_info.cpp rename to rmw_connext_cpp/src/rmw_get_topic_endpoint_info.cpp index 67933ad4..9c7af27f 100644 --- a/rmw_connext_cpp/src/rmw_get_topic_info.cpp +++ b/rmw_connext_cpp/src/rmw_get_topic_endpoint_info.cpp @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "rmw/get_topic_info.h" -#include "rmw/topic_info_array.h" -#include "rmw_connext_shared_cpp/topic_info.hpp" +#include "rmw/get_topic_endpoint_info.h" +#include "rmw/topic_endpoint_info_array.h" +#include "rmw_connext_shared_cpp/topic_endpoint_info.hpp" #include "rmw_connext_cpp/identifier.hpp" extern "C" @@ -25,7 +25,7 @@ rmw_get_publishers_info_by_topic( rcutils_allocator_t * allocator, const char * topic_name, bool no_mangle, - rmw_topic_info_array_t * publishers_info) + rmw_topic_endpoint_info_array_t * publishers_info) { return get_publishers_info_by_topic( rti_connext_identifier, @@ -42,7 +42,7 @@ rmw_get_subscriptions_info_by_topic( rcutils_allocator_t * allocator, const char * topic_name, bool no_mangle, - rmw_topic_info_array_t * subscriptions_info) + rmw_topic_endpoint_info_array_t * subscriptions_info) { return get_subscriptions_info_by_topic( rti_connext_identifier, diff --git a/rmw_connext_dynamic_cpp/src/functions.cpp b/rmw_connext_dynamic_cpp/src/functions.cpp index 9304ba15..200eb308 100644 --- a/rmw_connext_dynamic_cpp/src/functions.cpp +++ b/rmw_connext_dynamic_cpp/src/functions.cpp @@ -51,11 +51,11 @@ #include "rmw/allocators.h" #include "rmw/error_handling.h" #include "rmw/get_service_names_and_types.h" -#include "rmw/get_topic_info.h" +#include "rmw/get_topic_endpoint_info.h" #include "rmw/get_topic_names_and_types.h" #include "rmw/init.h" #include "rmw/rmw.h" -#include "rmw/topic_info_array.h" +#include "rmw/topic_endpoint_info_array.h" #include "rmw/types.h" #include "rosidl_generator_c/primitives_sequence_functions.h" @@ -77,7 +77,7 @@ #include "rosidl_typesupport_introspection_c/visibility_control.h" #include "rmw_connext_shared_cpp/shared_functions.hpp" -#include "rmw_connext_shared_cpp/topic_info.hpp" +#include "rmw_connext_shared_cpp/topic_endpoint_info.hpp" #include "rmw_connext_shared_cpp/types.hpp" #include "./macros.hpp" @@ -2713,7 +2713,7 @@ rmw_get_publishers_info_by_topic( rcutils_allocator_t * allocator, const char * topic_name, bool no_mangle, - rmw_topic_info_array_t * publishers_info) + rmw_topic_endpoint_info_array_t * publishers_info) { return get_publishers_info_by_topic(rti_connext_dynamic_identifier, node, allocator, topic_name, no_mangle, publishers_info); } @@ -2724,7 +2724,7 @@ rmw_get_subscriptions_info_by_topic( rcutils_allocator_t * allocator, const char * topic_name, bool no_mangle, - rmw_topic_info_array_t * subscriptions_info) + rmw_topic_endpoint_info_array_t * subscriptions_info) { return get_subscriptions_info_by_topic(rti_connext_dynamic_identifier, node, allocator, topic_name, no_mangle, subscriptions_info); } diff --git a/rmw_connext_shared_cpp/CMakeLists.txt b/rmw_connext_shared_cpp/CMakeLists.txt index 016b81eb..3952f606 100644 --- a/rmw_connext_shared_cpp/CMakeLists.txt +++ b/rmw_connext_shared_cpp/CMakeLists.txt @@ -57,7 +57,7 @@ add_library( src/types/custom_data_reader_listener.cpp src/types/custom_publisher_listener.cpp src/types/custom_subscriber_listener.cpp - src/topic_info.cpp) + src/topic_endpoint_info.cpp) ament_target_dependencies(rmw_connext_shared_cpp "rcpputils" "rcutils" diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/shared_functions.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/shared_functions.hpp index 0532e192..c182535d 100644 --- a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/shared_functions.hpp +++ b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/shared_functions.hpp @@ -32,6 +32,6 @@ #include "types.hpp" #include "wait.hpp" #include "wait_set.hpp" -#include "topic_info.hpp" +#include "topic_endpoint_info.hpp" #endif // RMW_CONNEXT_SHARED_CPP__SHARED_FUNCTIONS_HPP_ diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_cache.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_cache.hpp index a0b5d596..47efb810 100644 --- a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_cache.hpp +++ b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_cache.hpp @@ -127,8 +127,8 @@ class TopicCache "Adding topic '%s' with type '%s' for node '%s'", topic_name.c_str(), type_name.c_str(), guid_stream.str().c_str()); } - auto topic_info_it = topic_guid_to_info_.find(topic_guid); - if (topic_info_it != topic_guid_to_info_.end()) { + auto topic_endpoint_info_it = topic_guid_to_info_.find(topic_guid); + if (topic_endpoint_info_it != topic_guid_to_info_.end()) { RCUTILS_LOG_WARN_NAMED( "rmw_connext_shared_cpp", "unique topic attempted to be added twice, ignoring"); @@ -148,18 +148,18 @@ class TopicCache */ bool remove_topic(const GUID_t & topic_guid) { - auto topic_info_it = topic_guid_to_info_.find(topic_guid); - if (topic_info_it == topic_guid_to_info_.end()) { + auto topic_endpoint_info_it = topic_guid_to_info_.find(topic_guid); + if (topic_endpoint_info_it == topic_guid_to_info_.end()) { RCUTILS_LOG_WARN_NAMED( "rmw_connext_shared_cpp", "unexpected topic removal."); return false; } - std::string topic_name = topic_info_it->second.name; - std::string type_name = topic_info_it->second.type; + std::string topic_name = topic_endpoint_info_it->second.name; + std::string type_name = topic_endpoint_info_it->second.type; - auto participant_guid = topic_info_it->second.participant_guid; + auto participant_guid = topic_endpoint_info_it->second.participant_guid; auto participant_to_topic_guid = participant_to_topic_guids_.find(participant_guid); if (participant_to_topic_guid == participant_to_topic_guids_.end()) { RCUTILS_LOG_WARN_NAMED( @@ -179,7 +179,7 @@ class TopicCache return false; } - topic_guid_to_info_.erase(topic_info_it); + topic_guid_to_info_.erase(topic_endpoint_info_it); participant_to_topic_guid->second.erase(topic_guid_to_remove); if (participant_to_topic_guids_.empty()) { participant_to_topic_guids_.erase(participant_to_topic_guid); @@ -203,16 +203,16 @@ class TopicCache } for (auto & topic_guid : participant_to_topic_guids->second) { - auto topic_info = topic_guid_to_info_.find(topic_guid); - if (topic_info == topic_guid_to_info_.end()) { + auto topic_endpoint_info = topic_guid_to_info_.find(topic_guid); + if (topic_endpoint_info == topic_guid_to_info_.end()) { continue; } - auto topic_name = topic_info->second.name; + auto topic_name = topic_endpoint_info->second.name; auto topic_entry = topics_types.find(topic_name); if (topic_entry == topics_types.end()) { topics_types[topic_name] = std::set(); } - topics_types[topic_name].insert(topic_info->second.type); + topics_types[topic_name].insert(topic_endpoint_info->second.type); } return topics_types; } diff --git a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_info.hpp b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_endpoint_info.hpp similarity index 77% rename from rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_info.hpp rename to rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_endpoint_info.hpp index c9daec88..1acb755f 100644 --- a/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_info.hpp +++ b/rmw_connext_shared_cpp/include/rmw_connext_shared_cpp/topic_endpoint_info.hpp @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef RMW_CONNEXT_SHARED_CPP__TOPIC_INFO_HPP_ -#define RMW_CONNEXT_SHARED_CPP__TOPIC_INFO_HPP_ +#ifndef RMW_CONNEXT_SHARED_CPP__TOPIC_ENDPOINT_INFO_HPP_ +#define RMW_CONNEXT_SHARED_CPP__TOPIC_ENDPOINT_INFO_HPP_ -#include "rmw/topic_info_array.h" +#include "rmw/topic_endpoint_info_array.h" #include "rmw_connext_shared_cpp/visibility_control.h" RMW_CONNEXT_SHARED_CPP_PUBLIC @@ -26,7 +26,7 @@ get_publishers_info_by_topic( rcutils_allocator_t * allocator, const char * topic_name, bool no_mangle, - rmw_topic_info_array_t * publishers_info); + rmw_topic_endpoint_info_array_t * publishers_info); RMW_CONNEXT_SHARED_CPP_PUBLIC rmw_ret_t @@ -36,6 +36,6 @@ get_subscriptions_info_by_topic( rcutils_allocator_t * allocator, const char * topic_name, bool no_mangle, - rmw_topic_info_array_t * subscriptions_info); + rmw_topic_endpoint_info_array_t * subscriptions_info); -#endif // RMW_CONNEXT_SHARED_CPP__TOPIC_INFO_HPP_ +#endif // RMW_CONNEXT_SHARED_CPP__TOPIC_ENDPOINT_INFO_HPP_ diff --git a/rmw_connext_shared_cpp/src/topic_info.cpp b/rmw_connext_shared_cpp/src/topic_endpoint_info.cpp similarity index 87% rename from rmw_connext_shared_cpp/src/topic_info.cpp rename to rmw_connext_shared_cpp/src/topic_endpoint_info.cpp index 2e0d045c..4ecff008 100644 --- a/rmw_connext_shared_cpp/src/topic_info.cpp +++ b/rmw_connext_shared_cpp/src/topic_endpoint_info.cpp @@ -14,7 +14,7 @@ #include -#include "rmw_connext_shared_cpp/topic_info.hpp" +#include "rmw_connext_shared_cpp/topic_endpoint_info.hpp" #include "rmw/error_handling.h" @@ -25,7 +25,7 @@ get_publishers_info_by_topic( rcutils_allocator_t * /* unused_param */, const char * /* unused_param */, bool /* unused_param */, - rmw_topic_info_array_t * /* unused_param */) + rmw_topic_endpoint_info_array_t * /* unused_param */) { return RMW_RET_UNSUPPORTED; } @@ -37,7 +37,7 @@ get_subscriptions_info_by_topic( rcutils_allocator_t * /* unused_param */, const char * /* unused_param */, bool /* unused_param */, - rmw_topic_info_array_t * /* unused_param */) + rmw_topic_endpoint_info_array_t * /* unused_param */) { return RMW_RET_UNSUPPORTED; }