rclcpp  master
C++ ROS Client Library API
node_parameters.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_HPP_
16 #define RCLCPP__NODE_INTERFACES__NODE_PARAMETERS_HPP_
17 
18 #include <map>
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 #include "rcl_interfaces/msg/list_parameters_result.hpp"
24 #include "rcl_interfaces/msg/parameter_descriptor.hpp"
25 #include "rcl_interfaces/msg/parameter_event.hpp"
26 #include "rcl_interfaces/msg/set_parameters_result.hpp"
27 
28 #include "rclcpp/macros.hpp"
33 #include "rclcpp/parameter.hpp"
35 #include "rclcpp/publisher.hpp"
37 
38 namespace rclcpp
39 {
40 namespace node_interfaces
41 {
42 
45 {
46 public:
48 
51  const node_interfaces::NodeBaseInterface::SharedPtr node_base,
52  const node_interfaces::NodeTopicsInterface::SharedPtr node_topics,
53  const node_interfaces::NodeServicesInterface::SharedPtr node_services,
54  const std::vector<Parameter> & initial_parameters,
55  bool use_intra_process,
56  bool start_parameter_services);
57 
59  virtual
61 
63  virtual
66  const std::vector<rclcpp::Parameter> & parameters);
67 
69  virtual
70  rcl_interfaces::msg::SetParametersResult
72  const std::vector<rclcpp::Parameter> & parameters);
73 
75  virtual
77  get_parameters(const std::vector<std::string> & names) const;
78 
80  virtual
82  get_parameter(const std::string & name) const;
83 
85  virtual
86  bool
88  const std::string & name,
89  rclcpp::Parameter & parameter) const;
90 
92  virtual
94  describe_parameters(const std::vector<std::string> & names) const;
95 
97  virtual
99  get_parameter_types(const std::vector<std::string> & names) const;
100 
102  virtual
103  rcl_interfaces::msg::ListParametersResult
104  list_parameters(const std::vector<std::string> & prefixes, uint64_t depth) const;
105 
107  virtual
108  void
110 
111 private:
113 
114  mutable std::mutex mutex_;
115 
116  ParametersCallbackFunction parameters_callback_ = nullptr;
117 
119 
121 
122  std::shared_ptr<ParameterService> parameter_service_;
123 };
124 
125 } // namespace node_interfaces
126 } // namespace rclcpp
127 
128 #endif // RCLCPP__NODE_INTERFACES__NODE_PARAMETERS_HPP_
virtual rcl_interfaces::msg::SetParametersResult set_parameters_atomically(const std::vector< rclcpp::Parameter > &parameters)
A publisher publishes messages of any type to a topic.
Definition: publisher.hpp:155
#define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
NodeParameters(const node_interfaces::NodeBaseInterface::SharedPtr node_base, const node_interfaces::NodeTopicsInterface::SharedPtr node_topics, const node_interfaces::NodeServicesInterface::SharedPtr node_services, const std::vector< Parameter > &initial_parameters, bool use_intra_process, bool start_parameter_services)
Pure virtual interface class for the NodeParameters part of the Node API.
Definition: node_parameters_interface.hpp:35
#define RCLCPP_SMART_PTR_ALIASES_ONLY(...)
Definition: macros.hpp:66
Definition: allocator_common.hpp:24
virtual std::vector< rclcpp::Parameter > get_parameters(const std::vector< std::string > &names) const
Get descriptions of parameters given their names.
Implementation of the NodeParameters part of the Node API.
Definition: node_parameters.hpp:44
Structure to store an arbitrary parameter with templated get/set methods.
Definition: parameter.hpp:32
virtual void register_param_change_callback(ParametersCallbackFunction callback)
virtual std::vector< rcl_interfaces::msg::ParameterDescriptor > describe_parameters(const std::vector< std::string > &names) const
virtual std::vector< uint8_t > get_parameter_types(const std::vector< std::string > &names) const
virtual rclcpp::Parameter get_parameter(const std::string &name) const
Get the description of one parameter given a name.
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
virtual rcl_interfaces::msg::ListParametersResult list_parameters(const std::vector< std::string > &prefixes, uint64_t depth) const
virtual std::vector< rcl_interfaces::msg::SetParametersResult > set_parameters(const std::vector< rclcpp::Parameter > &parameters)