.. _program_listing_file_include_rclcpp_node_interfaces_node_graph.hpp: Program Listing for File node_graph.hpp ======================================= |exhale_lsh| :ref:`Return to documentation for file ` (``include/rclcpp/node_interfaces/node_graph.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2016-2017 Open Source Robotics Foundation, Inc. // // 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 RCLCPP__NODE_INTERFACES__NODE_GRAPH_HPP_ #define RCLCPP__NODE_INTERFACES__NODE_GRAPH_HPP_ #include #include #include #include #include #include #include #include #include #include #include "rcl/guard_condition.h" #include "rclcpp/event.hpp" #include "rclcpp/macros.hpp" #include "rclcpp/node_interfaces/node_base_interface.hpp" #include "rclcpp/node_interfaces/node_graph_interface.hpp" #include "rclcpp/visibility_control.hpp" #include "rmw/topic_endpoint_info_array.h" namespace rclcpp { namespace graph_listener { class GraphListener; } // namespace graph_listener namespace node_interfaces { class NodeGraph : public NodeGraphInterface { public: RCLCPP_SMART_PTR_ALIASES_ONLY(NodeGraph) RCLCPP_PUBLIC explicit NodeGraph(rclcpp::node_interfaces::NodeBaseInterface * node_base); RCLCPP_PUBLIC virtual ~NodeGraph(); RCLCPP_PUBLIC std::map> get_topic_names_and_types(bool no_demangle = false) const override; RCLCPP_PUBLIC std::map> get_service_names_and_types() const override; RCLCPP_PUBLIC std::map> get_service_names_and_types_by_node( const std::string & node_name, const std::string & namespace_) const override; RCLCPP_PUBLIC std::map> get_client_names_and_types_by_node( const std::string & node_name, const std::string & namespace_) const override; RCLCPP_PUBLIC std::map> get_publisher_names_and_types_by_node( const std::string & node_name, const std::string & namespace_, bool no_demangle = false) const override; RCLCPP_PUBLIC std::map> get_subscriber_names_and_types_by_node( const std::string & node_name, const std::string & namespace_, bool no_demangle = false) const override; RCLCPP_PUBLIC std::vector get_node_names() const override; RCLCPP_PUBLIC std::vector> get_node_names_with_enclaves() const override; RCLCPP_PUBLIC std::vector> get_node_names_and_namespaces() const override; RCLCPP_PUBLIC size_t count_publishers(const std::string & topic_name) const override; RCLCPP_PUBLIC size_t count_subscribers(const std::string & topic_name) const override; RCLCPP_PUBLIC size_t count_clients(const std::string & service_name) const override; RCLCPP_PUBLIC size_t count_services(const std::string & service_name) const override; RCLCPP_PUBLIC const rcl_guard_condition_t * get_graph_guard_condition() const override; RCLCPP_PUBLIC void notify_graph_change() override; RCLCPP_PUBLIC void notify_shutdown() override; RCLCPP_PUBLIC rclcpp::Event::SharedPtr get_graph_event() override; RCLCPP_PUBLIC void wait_for_graph_change( rclcpp::Event::SharedPtr event, std::chrono::nanoseconds timeout) override; RCLCPP_PUBLIC size_t count_graph_users() const override; RCLCPP_PUBLIC std::vector get_publishers_info_by_topic( const std::string & topic_name, bool no_mangle = false) const override; RCLCPP_PUBLIC std::vector get_subscriptions_info_by_topic( const std::string & topic_name, bool no_mangle = false) const override; private: RCLCPP_DISABLE_COPY(NodeGraph) rclcpp::node_interfaces::NodeBaseInterface * node_base_; std::shared_ptr graph_listener_; std::atomic_bool should_add_to_graph_listener_; mutable std::mutex graph_mutex_; std::condition_variable graph_cv_; std::vector graph_events_; std::atomic_size_t graph_users_count_; }; } // namespace node_interfaces } // namespace rclcpp #endif // RCLCPP__NODE_INTERFACES__NODE_GRAPH_HPP_