15 #include "rclcpp/node_interfaces/node_services.hpp"
22 : node_base_(node_base)
25 NodeServices::~NodeServices()
29 NodeServices::add_service(
30 rclcpp::ServiceBase::SharedPtr service_base_ptr,
31 rclcpp::CallbackGroup::SharedPtr group)
36 throw std::runtime_error(
"Cannot create service, group not in node.");
42 group->add_service(service_base_ptr);
48 group->trigger_notify_guard_condition();
50 throw std::runtime_error(
51 std::string(
"failed to notify wait set on service creation: ") + ex.what());
56 NodeServices::add_client(
57 rclcpp::ClientBase::SharedPtr client_base_ptr,
58 rclcpp::CallbackGroup::SharedPtr group)
63 throw std::runtime_error(
"Cannot create client, group not in node.");
69 group->add_client(client_base_ptr);
75 group->trigger_notify_guard_condition();
77 throw std::runtime_error(
78 std::string(
"failed to notify wait set on client creation: ") + ex.what());
RCLCPP_PUBLIC void trigger()
Notify the wait set waiting on this condition, if any, that the condition had been met.
Created when the return code does not match one of the other specialized exceptions.
Pure virtual interface class for the NodeBase part of the Node API.
virtual RCLCPP_PUBLIC bool callback_group_in_node(rclcpp::CallbackGroup::SharedPtr group)=0
Return true if the given callback group is associated with this node.
virtual RCLCPP_PUBLIC rclcpp::CallbackGroup::SharedPtr get_default_callback_group()=0
Return the default callback group.
virtual RCLCPP_PUBLIC std::string resolve_topic_or_service_name(const std::string &name, bool is_service, bool only_expand=false) const =0
Expand and remap a given topic or service name.
virtual RCLCPP_PUBLIC rclcpp::GuardCondition & get_notify_guard_condition()=0
Return a guard condition that should be notified when the internal node state changes.
Implementation of the NodeServices part of the Node API.
RCLCPP_PUBLIC std::string resolve_service_name(const std::string &name, bool only_expand=false) const override
Get the remapped and expanded service name given a input name.