19#include <unordered_map>
72 std::vector<EmberCore::String>
errors;
121 bool AddNode(std::unique_ptr<Node> node,
Node *parent =
nullptr);
137 std::unique_ptr<BehaviorTree>
Clone()
const;
207 std::unordered_map<EmberCore::String, EmberCore::String>
metadata_;
Represents a complete behavior tree data structure.
const EmberCore::String & GetDescription() const
Blackboard * GetBlackboard(const EmberCore::String &id)
size_t GetBlackboardCount() const
std::map< EmberCore::String, std::unique_ptr< Blackboard > > blackboards_
ExecutionState GetExecutionState() const
std::shared_ptr< Node > GetRootNodeShared() const
std::shared_ptr< Node > root_node_shared_
std::unique_ptr< Node > root_node_
void TraverseNodes(std::function< void(Node *)> visitor)
size_t GetNodeCount() const
std::vector< Node * > GetAllNodes()
Node * GetRootNode() const
std::unordered_map< size_t, Node * > node_index_
void TraversePostOrder(std::function< void(Node *)> visitor)
EmberCore::String GetMetadata(const EmberCore::String &key) const
const std::map< EmberCore::String, std::unique_ptr< Blackboard > > & GetBlackboards() const
EmberCore::String Serialize() const
EmberCore::String description_
bool HasBlackboard(const EmberCore::String &id) const
std::unordered_map< Node::Type, size_t > GetNodeTypeStatistics() const
void SetMetadata(const EmberCore::String &key, const EmberCore::String &value)
size_t GetMaxDepth() const
std::function< void(Node *, const EmberCore::String &change_type)> NodeChangeCallback
void AddBlackboard(std::unique_ptr< Blackboard > blackboard)
void BuildNodeIndex(Node *node)
ExecutionState
Tree execution states.
XMLMetadata & GetXMLMetadata()
bool Deserialize(const EmberCore::String &data)
bool RemoveNode(size_t node_id)
EmberCore::String GetTreeStructure() const
void CollectNodesRecursive(Node *current, std::vector< Node * > &nodes)
ValidationResult ValidateNode(const Node *node, std::vector< const Node * > &visited) const
void SetExecutionState(ExecutionState state)
bool SaveToFile(const EmberCore::String &filename) const
void RemoveBlackboard(const EmberCore::String &id)
std::function< void(const EmberCore::String &change_type)> TreeChangeCallback
bool MoveNode(size_t node_id, Node *new_parent)
void SetDescription(const EmberCore::String &description)
BehaviorTree(const EmberCore::String &name="Behavior Tree")
Constructor.
ValidationResult Validate() const
bool LoadFromFile(const EmberCore::String &filename)
bool AddNode(std::unique_ptr< Node > node, Node *parent=nullptr)
std::unique_ptr< Node > ExtractNode(size_t node_id)
std::unique_ptr< BehaviorTree > Clone() const
const XMLMetadata & GetXMLMetadata() const
const EmberCore::String & GetName() const
void TraversePreOrder(std::function< void(Node *)> visitor)
void SetRootNode(std::unique_ptr< Node > root)
XMLMetadata xml_metadata_
ExecutionState execution_state_
std::unordered_map< EmberCore::String, EmberCore::String > metadata_
void SetName(const EmberCore::String &name)
const std::unordered_map< EmberCore::String, EmberCore::String > & GetAllMetadata() const
void SetTreeChangeCallback(TreeChangeCallback callback)
TreeChangeCallback tree_change_callback_
std::vector< Node * > FindNodesByType(Node::Type type) const
void NotifyTreeChange(const EmberCore::String &change_type)
Node * FindNodeById(size_t id) const
NodeChangeCallback node_change_callback_
Node * FindNodeByName(const EmberCore::String &name) const
void NotifyNodeChange(Node *node, const EmberCore::String &change_type)
void RemoveMetadata(const EmberCore::String &key)
void SetNodeChangeCallback(NodeChangeCallback callback)
Node * FindNodeRecursive(Node *current, std::function< bool(const Node *)> predicate) const
~BehaviorTree()
Destructor.
Represents a blackboard containing multiple entries.
Represents a node in a behavior tree structure.
Type
Node types for behavior tree classification.
std::unique_ptr< BehaviorTree > CreateSampleTree()
Create a sample behavior tree for testing.
std::unique_ptr< BehaviorTree > CreateEmptyTree(const EmberCore::String &name="New Tree")
Create an empty behavior tree with basic structure.
std::unique_ptr< BehaviorTree > MergeTrees(const BehaviorTree &tree1, const BehaviorTree &tree2)
Merge two behavior trees.
Main types header for EmberCore.
std::string String
Framework-agnostic string type.
void AddError(const EmberCore::String &error)
void AddWarning(const EmberCore::String &warning)
std::vector< EmberCore::String > errors
std::vector< EmberCore::String > warnings