Skip to content

Commit 049f3da

Browse files
committed
stub out functions for getting pub/sub infos from topic name
1 parent 26bc607 commit 049f3da

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

rclcpp/include/rclcpp/node_interfaces/node_graph.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ class NodeGraph : public NodeGraphInterface
8585
size_t
8686
count_subscribers(const std::string & topic_name) const override;
8787

88+
RCLCPP_PUBLIC
89+
std::vector<rmw_topic_info_t>
90+
get_publishers_info_by_topic(
91+
const std::string & topic_name,
92+
bool no_demangle = false) const override;
93+
94+
RCLCPP_PUBLIC
95+
std::vector<rmw_topic_info_t>
96+
get_subscriptions_info_by_topic(
97+
const std::string & topic_name,
98+
bool no_demangle = false) const override;
99+
88100
RCLCPP_PUBLIC
89101

90102
const rcl_guard_condition_t *

rclcpp/include/rclcpp/node_interfaces/node_graph_interface.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <vector>
2323

2424
#include "rcl/guard_condition.h"
25+
#include "rmw/topic_info.h"
2526

2627
#include "rclcpp/event.hpp"
2728
#include "rclcpp/macros.hpp"
@@ -89,6 +90,22 @@ class NodeGraphInterface
8990
size_t
9091
count_subscribers(const std::string & topic_name) const = 0;
9192

93+
/// Return a vector of publisher infos publishing to a given topic.
94+
RCLCPP_PUBLIC
95+
virtual
96+
std::vector<rmw_topic_info_t>
97+
get_publishers_info_by_topic(
98+
const std::string & topic_name,
99+
bool no_demangle = false) const = 0;
100+
101+
/// Return a vector of subscription infos publishing to a given topic.
102+
RCLCPP_PUBLIC
103+
virtual
104+
std::vector<rmw_topic_info_t>
105+
get_subscriptions_info_by_topic(
106+
const std::string & topic_name,
107+
bool no_demangle = false) const = 0;
108+
92109
/// Return the rcl guard condition which is triggered when the ROS graph changes.
93110
RCLCPP_PUBLIC
94111
virtual

rclcpp/src/rclcpp/node_interfaces/node_graph.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,22 @@ NodeGraph::count_subscribers(const std::string & topic_name) const
266266
return count;
267267
}
268268

269+
std::vector<rmw_topic_info_t>
270+
NodeGraph::get_publishers_info_by_topic(
271+
const std::string & /*topic_name*/,
272+
bool /*no_demangle*/) const
273+
{
274+
return std::vector<rmw_topic_info_t>();
275+
}
276+
277+
std::vector<rmw_topic_info_t>
278+
NodeGraph::get_subscriptions_info_by_topic(
279+
const std::string & /*topic_name*/,
280+
bool /*no_demangle*/) const
281+
{
282+
return std::vector<rmw_topic_info_t>();
283+
}
284+
269285
const rcl_guard_condition_t *
270286
NodeGraph::get_graph_guard_condition() const
271287
{

0 commit comments

Comments
 (0)