![]() |
Ember
|
Represents a node in a behavior tree structure. More...
#include <Node.h>
Public Types | |
| enum class | Type { None , Action , Control , Condition , Decorator , BehaviorTree } |
| Node types for behavior tree classification. More... | |
| enum class | Status { Idle , Running , Success , Failure } |
| Node status for runtime execution tracking. More... | |
| enum class | VisualState { Normal , Selected , Hovered , Highlighted } |
| Visual state for UI rendering. More... | |
Public Member Functions | |
| Node (const String &name, Type type=Type::None) | |
| virtual | ~Node () |
| Node (const Node &other)=delete | |
| Node & | operator= (const Node &other)=delete |
| Node (Node &&other) noexcept | |
| Node & | operator= (Node &&other) noexcept |
| void | AddChild (std::unique_ptr< Node > child) |
| void | RemoveChild (size_t index) |
| void | RemoveChild (Node *child) |
| std::unique_ptr< Node > | DetachChild (size_t index) |
| std::unique_ptr< Node > | DetachChild (Node *child) |
| std::unique_ptr< Node > | DeepCopy () const |
| Node * | FindChild (const String &name) const |
| Node * | FindChildById (size_t id) const |
| Node * | GetParent () const |
| size_t | GetChildCount () const |
| Node * | GetChild (size_t index) const |
| size_t | GetId () const |
| const String & | GetName () const |
| void | SetName (const String &name) |
| Type | GetType () const |
| void | SetType (Type type) |
| Status | GetStatus () const |
| void | SetStatus (Status status) |
| const Point & | GetPosition () const |
| void | SetPosition (const Point &position) |
| VisualState | GetVisualState () const |
| void | SetVisualState (VisualState state) |
| bool | AreChildrenVisible () const |
| void | SetChildrenVisible (bool visible) |
| void | ToggleChildrenVisibility () |
| int | GetChildrenWidth () const |
| void | SetChildrenWidth (int width) |
| int | CalculateSubtreeWidth (int node_width, int horizontal_spacing) const |
| bool | IsValid () const |
| bool | HasCycles () const |
| size_t | GetDepth () const |
| size_t | GetSubtreeNodeCount () const |
| void | Accept (std::function< void(Node *)> visitor) |
| void | Accept (std::function< void(const Node *)> visitor) const |
| String | GetTypeString () const |
| String | GetStatusString () const |
| std::vector< Node * > | GetAllChildren () |
| std::vector< const Node * > | GetAllChildren () const |
| void | SetAttribute (const String &name, const String &value) |
| String | GetAttribute (const String &name, const String &default_value="") const |
| bool | HasAttribute (const String &name) const |
| void | RemoveAttribute (const String &name) |
| const std::map< String, String > & | GetAllAttributes () const |
| size_t | GetAttributeCount () const |
| String | ToString () const |
| void | PrintTree (int indent=0) const |
Protected Member Functions | |
| virtual std::unique_ptr< Node > | CreateCopy () const |
| virtual void | OnChildAdded (Node *child) |
| virtual void | OnChildRemoved (Node *child) |
Private Member Functions | |
| void | SetParent (Node *parent) |
| bool | HasCyclesHelper (std::vector< const Node * > &visited) const |
| size_t | FindChildIndex (Node *child) const |
Private Attributes | |
| String | name_ |
| Type | type_ |
| Status | status_ |
| size_t | id_ |
| std::vector< std::unique_ptr< Node > > | children_ |
| Node * | parent_ |
| Point | position_ |
| VisualState | visual_state_ |
| bool | children_visible_ |
| int | children_width_ |
| std::map< String, String > | custom_attributes_ |
Static Private Attributes | |
| static size_t | next_id_ = 1 |
Friends | |
| class | NodeFactory |
Represents a node in a behavior tree structure.
This class encapsulates the core functionality of behavior tree nodes, providing a modern C++ interface with proper memory management and extensible design patterns.
|
strong |
|
strong |
|
strong |
|
explicit |
|
delete |
| void EmberCore::Node::Accept | ( | std::function< void(const Node *)> | visitor | ) | const |
| void EmberCore::Node::Accept | ( | std::function< void(Node *)> | visitor | ) |
| void EmberCore::Node::AddChild | ( | std::unique_ptr< Node > | child | ) |
| int EmberCore::Node::CalculateSubtreeWidth | ( | int | node_width, |
| int | horizontal_spacing ) const |
|
protectedvirtual |
| std::unique_ptr< Node > EmberCore::Node::DeepCopy | ( | ) | const |
| std::unique_ptr< Node > EmberCore::Node::DetachChild | ( | size_t | index | ) |
|
private |
| const std::map< EmberCore::String, EmberCore::String > & EmberCore::Node::GetAllAttributes | ( | ) | const |
| std::vector< const Node * > EmberCore::Node::GetAllChildren | ( | ) | const |
| EmberCore::String EmberCore::Node::GetAttribute | ( | const String & | name, |
| const String & | default_value = "" ) const |
| EmberCore::String EmberCore::Node::GetStatusString | ( | ) | const |
| EmberCore::String EmberCore::Node::GetTypeString | ( | ) | const |
|
inline |
| bool EmberCore::Node::HasAttribute | ( | const String & | name | ) | const |
|
private |
|
protectedvirtual |
|
protectedvirtual |
| void EmberCore::Node::RemoveAttribute | ( | const String & | name | ) |
|
inline |
|
inlineprivate |
|
inline |
|
inline |
| EmberCore::String EmberCore::Node::ToString | ( | ) | const |
|
friend |
|
private |
|
private |