rclcpp
master
C++ ROS Client Library API
|
Notifies many nodes of graph changes by listening in a thread. More...
#include <graph_listener.hpp>
Public Member Functions | |
GraphListener (std::shared_ptr< rclcpp::Context > parent_context) | |
virtual | ~GraphListener () |
virtual void | start_if_not_started () |
Start the graph listener's listen thread if it hasn't been started. More... | |
virtual void | add_node (rclcpp::node_interfaces::NodeGraphInterface *node_graph) |
Add a node to the graph listener's list of nodes. More... | |
virtual bool | has_node (rclcpp::node_interfaces::NodeGraphInterface *node_graph) |
Return true if the given node is in the graph listener's list of nodes. More... | |
virtual void | remove_node (rclcpp::node_interfaces::NodeGraphInterface *node_graph) |
Remove a node from the graph listener's list of nodes. More... | |
virtual void | shutdown () |
Stop the listening thread. More... | |
virtual void | shutdown (const std::nothrow_t &) noexcept |
Nothrow version of shutdown(), logs to RCLCPP_ERROR instead. More... | |
virtual bool | is_shutdown () |
Return true if shutdown() has been called, else false. More... | |
![]() | |
T | enable_shared_from_this (T... args) |
T | operator= (T... args) |
T | shared_from_this (T... args) |
T | ~enable_shared_from_this (T... args) |
Protected Member Functions | |
virtual void | run () |
Main function for the listening thread. More... | |
virtual void | run_loop () |
Notifies many nodes of graph changes by listening in a thread.
|
explicit |
|
virtual |
|
virtual |
Start the graph listener's listen thread if it hasn't been started.
This function is thread-safe.
GraphListenerShutdownError | if the GraphListener is shutdown |
|
virtual |
Add a node to the graph listener's list of nodes.
GraphListenerShutdownError | if the GraphListener is shutdown |
NodeAlreadyAddedError | if the given node is already in the list |
std::invalid_argument | if node is nullptr |
std::system_error | anything std::mutex::lock() throws |
|
virtual |
Return true if the given node is in the graph listener's list of nodes.
Also return false if given nullptr.
std::system_error | anything std::mutex::lock() throws |
|
virtual |
Remove a node from the graph listener's list of nodes.
NodeNotFoundError | if the given node is not in the list |
std::invalid_argument | if node is nullptr |
std::system_error | anything std::mutex::lock() throws |
|
virtual |
Stop the listening thread.
The thread cannot be restarted, and the class is defunct after calling. This function is called by the ~GraphListener() and does nothing if shutdown() was already called. This function exists separately from the ~GraphListener() so that it can be called before and exceptions can be caught.
If start_if_not_started() was never called, this function still succeeds, but start_if_not_started() still cannot be called after this function.
rclcpp::execptions::RCLError | from rcl_guard_condition_fini() |
rclcpp::execptions::RCLError | from rcl_wait_set_fini() |
std::system_error | anything std::mutex::lock() throws |
|
virtualnoexcept |
Nothrow version of shutdown(), logs to RCLCPP_ERROR instead.
|
virtual |
Return true if shutdown() has been called, else false.
|
protectedvirtual |
Main function for the listening thread.
|
protectedvirtual |