Go to the documentation of this file.
11 recursiveStep = [&](
const TreeNode& node) {
16 recursiveStep(*
child);
19 else if(
auto decorator =
dynamic_cast<const DecoratorNode*
>(&node))
23 recursiveStep(*decorator->child());
29 throw LogicError(
"TreeObserver not built correctly. Report issue");
34 for(
const auto& subtree : tree.
subtrees)
36 recursiveStep(*subtree->nodes.front());
85 throw RuntimeError(
"TreeObserver::getStatistics: Invalid pattern");
95 throw RuntimeError(
"TreeObserver::getStatistics: Invalid UID");
100 const std::unordered_map<uint16_t, TreeObserver::NodeStatistics>&
const NodeStatistics & getStatistics(const std::string &path) const
virtual void callback(Duration timestamp, const TreeNode &node, NodeStatus prev_status, NodeStatus status) override
Abstract base class for Behavior Tree Nodes.
Struct used to store a tree. If this object goes out of scope, the tree is destroyed.
std::chrono::high_resolution_clock::duration Duration
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::unordered_map< std::string, uint16_t > _path_to_uid
std::unordered_map< uint16_t, NodeStatistics > _statistics
const std::unordered_map< std::string, uint16_t > & pathToUID() const
TreeObserver(const BT::Tree &tree)
std::vector< Subtree::Ptr > subtrees
const std::map< uint16_t, std::string > & uidToPath() const
const std::unordered_map< uint16_t, NodeStatistics > & statistics() const
std::map< uint16_t, std::string > _uid_to_path