| 73 | } |
| 74 | |
| 75 | void AbsBehaviorTree::debugPrint() const |
| 76 | { |
| 77 | if( !rootNode() ) |
| 78 | { |
| 79 | qDebug() << "Empty AbsBehaviorTree"; |
| 80 | return; |
| 81 | } |
| 82 | std::function<void(const AbstractTreeNode*,int)> recursiveStep; |
| 83 | |
| 84 | recursiveStep = [&](const AbstractTreeNode* node, int indent) |
| 85 | { |
| 86 | for(int i=0; i< indent; i++) printf(" "); |
| 87 | |
| 88 | printf("%s (%s)", |
| 89 | node->instance_name.toStdString().c_str(), |
| 90 | node->model.registration_ID.toStdString().c_str() ); |
| 91 | std::cout << std::endl; // force flush |
| 92 | |
| 93 | for(int index: node->children_index) |
| 94 | { |
| 95 | auto child_node = &_nodes[index]; |
| 96 | recursiveStep( child_node, indent+1); |
| 97 | } |
| 98 | }; |
| 99 | |
| 100 | recursiveStep( rootNode(), 0 ); |
| 101 | |
| 102 | } |
| 103 | |
| 104 | bool AbsBehaviorTree::operator ==(const AbsBehaviorTree &other) const |
| 105 | { |
no outgoing calls