13 #include <boost/lexical_cast.hpp>
22 namespace ns_ros2param
47 namespace ns_ros2param
49 Writer::Writer(
const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &nh)
68 impl_->emplace(child_name);
72 if (
impl_->back().isArray())
74 impl_->concatWithNodeAndEmplace(
76 boost::lexical_cast<std::string>(
impl_->back().index_),
82 impl_->concatWithNodeAndEmplace(
impl_->separator_, child_name);
97 if (
impl_->back().isArray())
100 impl_->concatWithNode(
101 impl_->separator_, boost::lexical_cast<std::string>(
impl_->back().index_)),
114 CPPUT_ASSERT(not
impl_->back().isCompleted(),
"Internal error: array has more elements than expected.");
126 impl_->setParameter();
134 if (not
impl_->back().tryPushArray<uint8_t>(element))
136 impl_->setParameter(
static_cast<int64_t
>(element));
144 if (not
impl_->back().tryPushArray<
double>(element))
146 impl_->setParameter(
static_cast<double>(element));
151 #define ARILES2_ROS2PARAM_NATIVE_TYPES_LIST \
152 ARILES2_BASIC_TYPE(bool) \
153 ARILES2_BASIC_TYPE(double) \
154 ARILES2_BASIC_TYPE(std::string)
157 #define ARILES2_BASIC_TYPE(type) \
158 void Writer::writeElement(const type &element, const Parameters &) \
160 CPPUT_TRACE_FUNCTION; \
161 if (not impl_->back().tryPushArray(element)) \
163 impl_->setParameter(element); \
169 #undef ARILES2_BASIC_TYPE
172 #define ARILES2_BASIC_TYPE(type) \
173 void Writer::writeElement(const type &element, const Parameters &) \
175 CPPUT_TRACE_FUNCTION; \
176 if (not impl_->back().tryPushArray<int64_t>(element)) \
178 impl_->setParameter(static_cast<int64_t>(element)); \
184 #undef ARILES2_BASIC_TYPE
187 #define ARILES2_BASIC_TYPE(type) \
188 void Writer::writeElement(const type &element, const Parameters &) \
190 CPPUT_TRACE_FUNCTION; \
192 static_cast<uint64_t>(element) <= static_cast<uint64_t>(std::numeric_limits<int64_t>::max()), \
193 "Value is too large."); \
194 if (not impl_->back().tryPushArray<int64_t>(element)) \
196 impl_->setParameter(static_cast<int64_t>(element)); \
202 #undef ARILES2_BASIC_TYPE
rclcpp::node_interfaces::NodeParametersInterface::SharedPtr nh_
std::vector< rclcpp::Parameter > parameters_
ModifierImplBase(const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &nh)
Writer(const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &nh)
void flush()
Flush the configuration to the output.
void startArray(const std::size_t size, const bool=false)
void startMapEntry(const std::string &child_name)
Starts a nested map in the configuration file.
bool publishParameters() const
void makeImplPtr(t_Args &&...args)
void writeElement(const std::complex< t_Scalar > &entry, const Parameters ¶m)
#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 ARILES2_ROS2PARAM_NATIVE_TYPES_LIST
#define CPPUT_TRACE_FUNCTION
#define CPPUT_TRACE_VALUE(value)