19 const std::function<
void(
const TreeNode*)>& visitor)
23 throw LogicError(
"One of the children of a DecoratorNode or ControlNode is "
31 for (
const auto& child : control->children())
46 throw LogicError(
"One of the children of a DecoratorNode or ControlNode is "
54 for (
const auto& child : control->children())
61 if (decorator->child())
70 std::function<void(
unsigned,
const BT::TreeNode*)> recursivePrint;
72 recursivePrint = [&recursivePrint, &stream](
unsigned indent,
const BT::TreeNode* node) {
73 for (
unsigned i = 0; i < indent; i++)
79 stream <<
"!nullptr!" << std::endl;
82 stream << node->
name() << std::endl;
87 for (
const auto& child : control->children())
89 recursivePrint(indent, child);
94 recursivePrint(indent, decorator->child());
98 stream <<
"----------------" << std::endl;
99 recursivePrint(0, root_node);
100 stream <<
"----------------" << std::endl;
106 serialized_buffer.clear();
108 auto visitor = [&serialized_buffer](
const TreeNode* node) {
109 serialized_buffer.push_back(
110 std::make_pair(node->
UID(),
static_cast<uint8_t
>(node->
status())));