rclcpp  beta1
C++ ROS Client Library API
node_graph_interface.hpp
Go to the documentation of this file.
1 // Copyright 2016 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef RCLCPP__NODE_INTERFACES__NODE_GRAPH_INTERFACE_HPP_
16 #define RCLCPP__NODE_INTERFACES__NODE_GRAPH_INTERFACE_HPP_
17 
18 #include <chrono>
19 #include <map>
20 #include <string>
21 
22 #include "rcl/guard_condition.h"
23 
24 #include "rclcpp/event.hpp"
25 #include "rclcpp/macros.hpp"
27 
28 namespace rclcpp
29 {
30 namespace node_interfaces
31 {
32 
35 {
36 public:
38 
39 
40 
45  virtual
47  get_topic_names_and_types() const = 0;
48 
51  virtual
52  size_t
53  count_publishers(const std::string & topic_name) const = 0;
54 
57  virtual
58  size_t
59  count_subscribers(const std::string & topic_name) const = 0;
60 
63  virtual
64  const rcl_guard_condition_t *
65  get_graph_guard_condition() const = 0;
66 
68 
78  virtual
79  void
80  notify_graph_change() = 0;
81 
84  virtual
85  void
86  notify_shutdown() = 0;
87 
89 
95  virtual
96  rclcpp::event::Event::SharedPtr
97  get_graph_event() = 0;
98 
100 
108  virtual
109  void
111  rclcpp::event::Event::SharedPtr event,
112  std::chrono::nanoseconds timeout) = 0;
113 
115 
119  virtual
120  size_t
121  count_graph_users() = 0;
122 };
123 
124 } // namespace node_interfaces
125 } // namespace rclcpp
126 
127 #endif // RCLCPP__NODE_INTERFACES__NODE_GRAPH_INTERFACE_HPP_
virtual rclcpp::event::Event::SharedPtr get_graph_event()=0
Return a graph event, which will be set anytime a graph change occurs.
virtual const rcl_guard_condition_t * get_graph_guard_condition() const =0
Return the rcl guard condition which is triggered when the ROS graph changes.
#define RCLCPP_SMART_PTR_ALIASES_ONLY(...)
Definition: macros.hpp:66
Definition: allocator_common.hpp:24
virtual void notify_graph_change()=0
Notify threads waiting on graph changes.
virtual size_t count_publishers(const std::string &topic_name) const =0
Return the number of publishers that are advertised on a given topic.
virtual size_t count_subscribers(const std::string &topic_name) const =0
Return the number of subscribers who have created a subscription for a given topic.
virtual void wait_for_graph_change(rclcpp::event::Event::SharedPtr event, std::chrono::nanoseconds timeout)=0
Wait for a graph event to occur by waiting on an Event to become set.
virtual size_t count_graph_users()=0
Return the number of on loan graph events, see get_graph_event().
Pure virtual interface class for the NodeGraph part of the Node API.
Definition: node_graph_interface.hpp:34
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
virtual void notify_shutdown()=0
Notify any and all blocking node actions that shutdown has occurred.
virtual std::map< std::string, std::string > get_topic_names_and_types() const =0
Return a map of existing topic names (string) to topic types (string).