Go to the documentation of this file.
19 const std::function<
void(
const TreeNode*)>& visitor)
23 throw LogicError(
"One of the children of a DecoratorNode or ControlNode is nullptr");
45 throw LogicError(
"One of the children of a DecoratorNode or ControlNode is nullptr");
59 if(decorator->child())
70 recursivePrint = [&recursivePrint, &stream](
unsigned indent,
const BT::TreeNode* node) {
71 for(
unsigned i = 0; i < indent; i++)
77 stream <<
"!nullptr!" << std::endl;
80 stream << node->
name() << std::endl;
87 recursivePrint(indent,
child);
92 recursivePrint(indent, decorator->child());
96 stream <<
"----------------" << std::endl;
97 recursivePrint(0, root_node);
98 stream <<
"----------------" << std::endl;
104 serialized_buffer.clear();
106 auto visitor = [&serialized_buffer](
const TreeNode* node) {
107 serialized_buffer.push_back(
108 std::make_pair(node->
UID(),
static_cast<uint8_t
>(node->
status())));
116 static int number = -1;
119 auto const parts =
splitString(BTCPP_LIBRARY_VERSION,
'.');
120 number = std::stoi(std::string(parts[0])) * 10000 +
121 std::stoi(std::string(parts[1])) * 100 + std::stoi(std::string(parts[2]));
128 return BTCPP_LIBRARY_VERSION;
int LibraryVersionNumber()
Abstract base class for Behavior Tree Nodes.
std::vector< std::pair< uint16_t, uint8_t > > SerializedTreeStatus
NodeStatus status() const
auto child(const lexy::parse_tree< Reader, TokenKind, MemoryResource > &tree, typename lexy::parse_tree< Reader, TokenKind, MemoryResource >::node node, Predicate predicate) -> std::optional< typename lexy::parse_tree< Reader, TokenKind, MemoryResource >::node >
Returns the first child that matches predicate, if there is any.
std::vector< StringView > splitString(const StringView &strToSplit, char delimeter)
void applyRecursiveVisitor(const TreeNode *root_node, const std::function< void(const TreeNode *)> &visitor)
const std::string & name() const
Name of the instance, not the type.
void printTreeRecursively(const TreeNode *root_node, std::ostream &stream=std::cout)
const char * LibraryVersionString()
void buildSerializedStatusSnapshot(const TreeNode *root_node, SerializedTreeStatus &serialized_buffer)
buildSerializedStatusSnapshot can be used to create a buffer that can be stored (or sent to a client ...