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 node_interfaces::NodeClockInterface::SharedPtr node_clock,
55  const std::vector<Parameter> & initial_parameters,
56  bool use_intra_process,
57  bool start_parameter_services);
58 
60  virtual
62 
64  virtual
67  const std::vector<rclcpp::Parameter> & parameters);
68 
70  virtual
71  rcl_interfaces::msg::SetParametersResult
73  const std::vector<rclcpp::Parameter> & parameters);
74 
76  virtual
78  get_parameters(const std::vector<std::string> & names) const;
79 
81  virtual
83  get_parameter(const std::string & name) const;
84 
86  virtual
87  bool
89  const std::string & name,
90  rclcpp::Parameter & parameter) const;
91 
93  virtual
95  describe_parameters(const std::vector<std::string> & names) const;
96 
98  virtual
100  get_parameter_types(const std::vector<std::string> & names) const;
101 
103  virtual
104  rcl_interfaces::msg::ListParametersResult
105  list_parameters(const std::vector<std::string> & prefixes, uint64_t depth) const;
106 
108  virtual
109  void
111 
112 private:
113  RCLCPP_DISABLE_COPY(NodeParameters)
114 
115  mutable std::mutex mutex_;
116 
117  ParametersCallbackFunction parameters_callback_ = nullptr;
118 
120 
122 
123  std::shared_ptr<ParameterService> parameter_service_;
124 
125  std::string combined_name_;
126 
127  node_interfaces::NodeClockInterface::SharedPtr node_clock_;
128 };
129 
130 } // namespace node_interfaces
131 } // namespace rclcpp
132 
133 #endif // RCLCPP__NODE_INTERFACES__NODE_PARAMETERS_HPP_
virtual rcl_interfaces::msg::SetParametersResult set_parameters_atomically(const std::vector< rclcpp::Parameter > &parameters)
virtual std::vector< rcl_interfaces::msg::ParameterDescriptor > describe_parameters(const std::vector< std::string > &names) const
virtual rcl_interfaces::msg::ListParametersResult list_parameters(const std::vector< std::string > &prefixes, uint64_t depth) const
#define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
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)
NodeParameters(const node_interfaces::NodeBaseInterface::SharedPtr node_base, const node_interfaces::NodeTopicsInterface::SharedPtr node_topics, const node_interfaces::NodeServicesInterface::SharedPtr node_services, const node_interfaces::NodeClockInterface::SharedPtr node_clock, const std::vector< Parameter > &initial_parameters, bool use_intra_process, bool start_parameter_services)
virtual std::vector< rcl_interfaces::msg::SetParametersResult > set_parameters(const std::vector< rclcpp::Parameter > &parameters)
A publisher publishes messages of any type to a topic.
Definition: publisher.hpp:155
virtual rclcpp::Parameter get_parameter(const std::string &name) const
Get the description of one parameter given a name.
Implementation of the NodeParameters part of the Node API.
Definition: node_parameters.hpp:44
#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
virtual std::vector< rclcpp::Parameter > get_parameters(const std::vector< std::string > &names) const
Get descriptions of parameters given their names.