13 #include <boost/lexical_cast.hpp>
22 namespace ns_ros2param
33 for (
const rclcpp::Parameter ¶meter :
parameters_)
35 if (not
nh_->has_parameter(parameter.get_name()))
37 const rclcpp::ParameterValue &declared_value =
38 nh_->declare_parameter(parameter.get_name(), parameter.get_parameter_value());
41 declared_value.get_type() == parameter.get_type(),
42 std::string(
"Parameter type mismatch: ") + parameter.get_name());
59 namespace ns_ros2param
80 impl_->emplace(child_name);
84 if (
impl_->back().isArray())
86 impl_->concatWithNodeAndEmplace(
88 boost::lexical_cast<std::string>(
impl_->back().index_),
94 impl_->concatWithNodeAndEmplace(
impl_->separator_, child_name);
109 if (
impl_->back().isArray())
112 impl_->concatWithNode(
113 impl_->separator_, boost::lexical_cast<std::string>(
impl_->back().index_)),
126 CPPUT_ASSERT(not
impl_->back().isCompleted(),
"Internal error: array has more elements than expected.");
138 impl_->setParameter();
146 if (not
impl_->back().tryPushArray<uint8_t>(element))
148 impl_->setParameter(
static_cast<int64_t
>(element));
156 if (not
impl_->back().tryPushArray<
double>(element))
158 impl_->setParameter(
static_cast<double>(element));
163 #define ARILES2_ROS2PARAM_NATIVE_TYPES_LIST \
164 ARILES2_BASIC_TYPE(bool) \
165 ARILES2_BASIC_TYPE(double) \
166 ARILES2_BASIC_TYPE(std::string)
169 #define ARILES2_BASIC_TYPE(type) \
170 void Declarator::writeElement(const type &element, const Parameters &) \
172 CPPUT_TRACE_FUNCTION; \
173 if (not impl_->back().tryPushArray(element)) \
175 impl_->setParameter(element); \
181 #undef ARILES2_BASIC_TYPE
184 #define ARILES2_BASIC_TYPE(type) \
185 void Declarator::writeElement(const type &element, const Parameters &) \
187 CPPUT_TRACE_FUNCTION; \
188 if (not impl_->back().tryPushArray<int64_t>(element)) \
190 impl_->setParameter(static_cast<int64_t>(element)); \
196 #undef ARILES2_BASIC_TYPE
199 #define ARILES2_BASIC_TYPE(type) \
200 void Declarator::writeElement(const type &element, const Parameters &) \
202 CPPUT_TRACE_FUNCTION; \
204 static_cast<uint64_t>(element) <= static_cast<uint64_t>(std::numeric_limits<int64_t>::max()), \
205 "Value is too large."); \
206 if (not impl_->back().tryPushArray<int64_t>(element)) \
208 impl_->setParameter(static_cast<int64_t>(element)); \
214 #undef ARILES2_BASIC_TYPE
void flush()
Flush the configuration to the output.
void startMapEntry(const std::string &child_name)
Starts a nested map in the configuration file.
Declarator(const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &nh)
void startArray(const std::size_t size, const bool=false)
rclcpp::node_interfaces::NodeParametersInterface::SharedPtr nh_
std::vector< rclcpp::Parameter > parameters_
ModifierImplBase(const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &nh)
bool publishParameters() const
void makeImplPtr(t_Args &&...args)
void writeElement(const std::complex< t_Scalar > &entry, const Parameters ¶m)
#define ARILES2_ROS2PARAM_NATIVE_TYPES_LIST
#define CPPUT_ASSERT(condition,...)
#define ARILES2_BASIC_UNSIGNED_INTEGER_TYPES_LIST_WITHOUT_BYTE
#define ARILES2_BASIC_SIGNED_INTEGER_TYPES_LIST
visitor::Parameters Parameters
CPPUT_MACRO_SUBSTITUTE(ARILES2_BASIC_SIGNED_INTEGER_TYPES_LIST) CPPUT_MACRO_SUBSTITUTE(ARILES2_BASIC_UNSIGNED_INTEGER_TYPES_LIST) CPPUT_MACRO_SUBSTITUTE(ARILES2_BASIC_REAL_TYPES_LIST) void Reader
#define CPPUT_TRACE_FUNCTION
#define CPPUT_TRACE_VALUE(value)