24 explicit Writer(const ::ros::NodeHandle &nh)
46 if (XmlRpc::XmlRpcValue::TypeInvalid ==
impl_->root_value_.getType())
48 impl_->root_value_ =
"";
51 impl_->root_name_.clear();
58 if (
impl_->node_stack_.empty())
60 impl_->root_name_ = map_name;
61 impl_->node_stack_.push_back(&
impl_->root_value_);
71 impl_->node_stack_.pop_back();
77 impl_->getRawNode().setSize(size);
84 impl_->node_stack_.back().index_ <
impl_->node_stack_.back().size_,
85 "Internal error: namevalue.has more elements than expected.");
90 ARILES2_ASSERT(
true ==
impl_->node_stack_.back().isArray(),
"Internal error: expected array.");
91 ++
impl_->node_stack_.back().index_;
96 impl_->node_stack_.pop_back();
103 impl_->getRawNode() = element;
109 impl_->getRawNode() = element;
115 ARILES2_TRACE_FUNCTION;
117 impl_->root_name_ =
"";
118 impl_->root_value_.clear();
120 if (
true == name.empty())
132 ARILES2_TRACE_FUNCTION;
137 #define ARILES2_BASIC_TYPE(type) \
138 void Writer::writeElement(const type &element, const Parameters &) \
140 impl_->getRawNode() = element; \
145 #undef ARILES2_BASIC_TYPE
149 #define ARILES2_BASIC_TYPE(type) \
150 void Writer::writeElement(const type &element, const Parameters &) \
153 static_cast<int64_t>(element) <= std::numeric_limits<int>::max() \
154 && static_cast<int64_t>(element) >= static_cast<int64_t>(std::numeric_limits<int>::min()), \
155 "Value is out of range."); \
156 impl_->getRawNode() = static_cast<int>(element); \
161 #undef ARILES2_BASIC_TYPE
164 #define ARILES2_BASIC_TYPE(type) \
165 void Writer::writeElement(const type &element, const Parameters &) \
168 static_cast<uint64_t>(element) <= static_cast<uint64_t>(std::numeric_limits<int>::max()), \
169 "Value is too large."); \
170 impl_->getRawNode() = static_cast<int>(element); \
175 #undef ARILES2_BASIC_TYPE