#ifndef ENV_MANAGER__COMPONENT_MANAGER__SERVICE_COMPONENT_HPP_ #define ENV_MANAGER__COMPONENT_MANAGER__SERVICE_COMPONENT_HPP_ #include "component_manager/visibility_control.h" #include namespace env_manager { namespace component_manager { const std::string DEFAULT_SERVICE_NDOE_NAME = "env_manager_service_node"; const std::string DEFAULT_SERVICE_NAME = "service"; template class ServiceComponent: public rclcpp::Node { public: explicit ServiceComponent(const rclcpp::NodeOptions& options) : Node(DEFAULT_SERVICE_NDOE_NAME, options) { _service = create_service( DEFAULT_SERVICE_NAME, std::bind( &ServiceComponent::callback, this, std::placeholders::_1, std::placeholders::_2)); } virtual void callback(std::shared_ptr request, std::shared_ptr response) = 0; private: typename rclcpp::Service::SharedPtr _service; }; } // namespace component_manager } // namespace env_manager #endif // ENV_MANAGER__COMPONENT_MANAGER__SERVICE_COMPONENT_HPP_