expose get_service_names_and_types_by_node from rcl in rclcpp (#1131)

* expose get_service_names_and_types_by_node from rcl in rclcpp

Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>

* fix spelling

Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>

* zero initialize

Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>

* check return value and cleanup

Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>

* use throw_from_rcl_error

Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>

* cleanup error handling

Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
This commit is contained in:
Dirk Thomas 2020-05-26 10:26:51 -07:00 committed by GitHub
parent a5e1418093
commit 0ef9731feb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 103 additions and 2 deletions

View file

@ -483,6 +483,19 @@ public:
std::map<std::string, std::vector<std::string>>
get_service_names_and_types() const;
/// Return a map of existing service names to list of service types for a specific node.
/**
* This function only considers services - not clients.
*
* \param[in] node_name name of the node
* \param[in] namespace_ namespace of the node
*/
RCLCPP_LIFECYCLE_PUBLIC
std::map<std::string, std::vector<std::string>>
get_service_names_and_types_by_node(
const std::string & node_name,
const std::string & namespace_) const;
/// Return the number of publishers that are advertised on a given topic.
/**
* \sa rclcpp::Node::count_publishers

View file

@ -279,6 +279,15 @@ LifecycleNode::get_service_names_and_types() const
return node_graph_->get_service_names_and_types();
}
std::map<std::string, std::vector<std::string>>
LifecycleNode::get_service_names_and_types_by_node(
const std::string & node_name,
const std::string & namespace_) const
{
return node_graph_->get_service_names_and_types_by_node(
node_name, namespace_);
}
size_t
LifecycleNode::count_publishers(const std::string & topic_name) const
{