15 #ifndef RCLCPP__PARAMETER_HPP_
16 #define RCLCPP__PARAMETER_HPP_
24 #include "rcl_interfaces/msg/parameter.hpp"
25 #include "rclcpp/exceptions.hpp"
26 #include "rclcpp/parameter_value.hpp"
27 #include "rclcpp/visibility_control.hpp"
34 namespace node_interfaces
61 explicit Parameter(
const std::string & name);
68 template<
typename ValueTypeT>
69 Parameter(
const std::string & name, ValueTypeT value)
103 rcl_interfaces::msg::ParameterValue
115 template<ParameterType ParamT>
119 return value_.get<ParamT>();
164 const std::vector<uint8_t> &
172 const std::vector<
bool> &
180 const std::vector<int64_t> &
188 const std::vector<
double> &
196 const std::vector<std::
string> &
230 operator<<(std::ostream & os, const std::vector<
Parameter> & parameters);
258 auto type_enforcing_lambda =
262 return type_enforcing_lambda();
274 return detail::get_value_helper<T>(
this);
275 }
catch (
const ParameterTypeException & ex) {
276 throw exceptions::InvalidParameterTypeException(this->name_, ex.what());
294 to_string(
const std::vector<rclcpp::Parameter> & parameters);
Store the type and value of a parameter.
Structure to store an arbitrary parameter with templated get/set methods.
RCLCPP_PUBLIC const std::vector< bool > & as_bool_array() const
Get value of parameter as bool array (vector<bool>).
static RCLCPP_PUBLIC Parameter from_parameter_msg(const rcl_interfaces::msg::Parameter ¶meter)
Convert a parameter message in a Parameter class object.
RCLCPP_PUBLIC const std::string & as_string() const
Get value of parameter as string.
Parameter(const std::string &name, ValueTypeT value)
Construct with given name and given parameter value.
RCLCPP_PUBLIC int64_t as_int() const
Get value of parameter as integer.
RCLCPP_PUBLIC const std::vector< double > & as_double_array() const
Get value of parameter as double array (vector<double>).
RCLCPP_PUBLIC std::string get_type_name() const
Get the type name of the parameter.
RCLCPP_PUBLIC const std::vector< uint8_t > & as_byte_array() const
Get value of parameter as byte array (vector<uint8_t>).
RCLCPP_PUBLIC Parameter()
Construct with an empty name and a parameter value of type rclcpp::PARAMETER_NOT_SET.
RCLCPP_PUBLIC rcl_interfaces::msg::Parameter to_parameter_msg() const
Convert the class in a parameter message.
RCLCPP_PUBLIC bool operator!=(const Parameter &rhs) const
Not equal operator.
RCLCPP_PUBLIC const std::string & get_name() const
Get the name of the parameter.
RCLCPP_PUBLIC std::string value_to_string() const
Get value of parameter as a string.
decltype(auto) get_value() const
Get value of parameter using rclcpp::ParameterType as template argument.
RCLCPP_PUBLIC const std::vector< int64_t > & as_integer_array() const
Get value of parameter as integer array (vector<int64_t>).
RCLCPP_PUBLIC const rclcpp::ParameterValue & get_parameter_value() const
Get the internal storage for the parameter value.
RCLCPP_PUBLIC ParameterType get_type() const
Get the type of the parameter.
RCLCPP_PUBLIC rcl_interfaces::msg::ParameterValue get_value_message() const
Get value of parameter as a parameter message.
RCLCPP_PUBLIC double as_double() const
Get value of parameter as double.
RCLCPP_PUBLIC const std::vector< std::string > & as_string_array() const
Get value of parameter as string array (vector<std::string>).
RCLCPP_PUBLIC bool operator==(const Parameter &rhs) const
Equal operator.
RCLCPP_PUBLIC bool as_bool() const
Get value of parameter as boolean.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
RCLCPP_PUBLIC std::string to_string(const FutureReturnCode &future_return_code)
String conversion function for FutureReturnCode.
RCLCPP_PUBLIC std::string _to_json_dict_entry(const Parameter ¶m)
Return a json encoded version of the parameter intended for a dict.