rclcpp  master
C++ ROS Client Library API
node_parameters_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_PARAMETERS_INTERFACE_HPP_
16 #define RCLCPP__NODE_INTERFACES__NODE_PARAMETERS_INTERFACE_HPP_
17 
18 #include <string>
19 #include <vector>
20 
21 #include "rcl_interfaces/msg/list_parameters_result.hpp"
22 #include "rcl_interfaces/msg/parameter_descriptor.hpp"
23 #include "rcl_interfaces/msg/set_parameters_result.hpp"
24 
25 #include "rclcpp/macros.hpp"
26 #include "rclcpp/parameter.hpp"
28 
29 namespace rclcpp
30 {
31 namespace node_interfaces
32 {
33 
36 {
37 public:
39 
41  virtual
42  ~NodeParametersInterface() = default;
43 
45  virtual
48  const std::vector<rclcpp::Parameter> & parameters) = 0;
49 
51  virtual
52  rcl_interfaces::msg::SetParametersResult
54  const std::vector<rclcpp::Parameter> & parameters) = 0;
55 
57  /*
58  * \param[in] names a list of parameter names to check.
59  * \return the list of parameters that were found.
60  * Any parameter not found is omitted from the returned list.
61  */
63  virtual
65  get_parameters(const std::vector<std::string> & names) const = 0;
66 
68  /*
69  * \param[in] name the name of the parameter to look for.
70  * \return the parameter if it exists on the node.
71  * \throws std::out_of_range if the parameter does not exist on the node.
72  */
74  virtual
76  get_parameter(const std::string & name) const = 0;
77 
79  /*
80  * \param[in] name the name of the parameter to look for.
81  * \param[out] parameter the description if parameter exists on the node.
82  * \return true if the parameter exists on the node, or
83  * \return false if the parameter does not exist.
84  */
86  virtual
87  bool
89  const std::string & name,
90  rclcpp::Parameter & parameter) const = 0;
91 
93  virtual
95  describe_parameters(const std::vector<std::string> & names) const = 0;
96 
98  virtual
100  get_parameter_types(const std::vector<std::string> & names) const = 0;
101 
103  virtual
104  rcl_interfaces::msg::ListParametersResult
105  list_parameters(const std::vector<std::string> & prefixes, uint64_t depth) const = 0;
106 
108  rcl_interfaces::msg::SetParametersResult(
110 
112  virtual
113  void
115 };
116 
117 } // namespace node_interfaces
118 } // namespace rclcpp
119 
120 #endif // RCLCPP__NODE_INTERFACES__NODE_PARAMETERS_INTERFACE_HPP_
virtual std::vector< rcl_interfaces::msg::SetParametersResult > set_parameters(const std::vector< rclcpp::Parameter > &parameters)=0
virtual std::vector< rcl_interfaces::msg::ParameterDescriptor > describe_parameters(const std::vector< std::string > &names) const =0
Structure to store an arbitrary parameter with templated get/set methods.
Definition: parameter.hpp:32
#define RCLCPP_SMART_PTR_ALIASES_ONLY(...)
Definition: macros.hpp:66
Definition: allocator_common.hpp:24
virtual void register_param_change_callback(ParametersCallbackFunction callback)=0
virtual rcl_interfaces::msg::ListParametersResult list_parameters(const std::vector< std::string > &prefixes, uint64_t depth) const =0
virtual std::vector< rclcpp::Parameter > get_parameters(const std::vector< std::string > &names) const =0
Get descriptions of parameters given their names.
virtual rclcpp::Parameter get_parameter(const std::string &name) const =0
Get the description of one parameter given a name.
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
Pure virtual interface class for the NodeParameters part of the Node API.
Definition: node_parameters_interface.hpp:35
virtual std::vector< uint8_t > get_parameter_types(const std::vector< std::string > &names) const =0
virtual rcl_interfaces::msg::SetParametersResult set_parameters_atomically(const std::vector< rclcpp::Parameter > &parameters)=0