From b7bed9fa725b65e9e6e25471081389f197ae7318 Mon Sep 17 00:00:00 2001 From: Jaison Titus Date: Tue, 22 Oct 2019 09:15:25 -0700 Subject: [PATCH] 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 2f2dca3c..2cf82c16 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 82f5d99b..a281a7b8 100644 --- a/rmw_connext_dynamic_cpp/src/functions.cpp +++ b/rmw_connext_dynamic_cpp/src/functions.cpp @@ -2702,6 +2702,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..545c32d4 --- /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 * identifier, + const rmw_node_t * node, + rcutils_allocator_t * allocator, + const char * topic_name, + bool no_mangle, + rmw_topic_info_array_t * publishers_info) +{ + return RMW_RET_UNSUPPORTED; +} + +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) +{ + return RMW_RET_UNSUPPORTED; +}