Ember
Loading...
Searching...
No Matches
EmberCore::DirectTreeAdapter Class Reference

Direct tree adapter that wraps BehaviorTree for unified tree operations. More...

#include <DirectTreeAdapter.h>

Inheritance diagram for EmberCore::DirectTreeAdapter:
EmberCore::ITreeStructure

Public Member Functions

 DirectTreeAdapter (std::shared_ptr< BehaviorTree > tree)
 Constructor that wraps a BehaviorTree.
virtual ~DirectTreeAdapter ()=default
ITreeNodeGetRootNode () const override
const EmberCore::StringGetName () const override
const EmberCore::StringGetDescription () const override
size_t GetNodeCount () const override
size_t GetMaxDepth () const override
ITreeNodeFindNodeById (size_t id) const override
ITreeNodeFindNodeByName (const EmberCore::String &name) const override
std::vector< ITreeNode * > FindNodesByType (ITreeNode::NodeType type) const override
void TraverseNodes (std::function< void(ITreeNode *)> visitor) override
void TraverseNodes (std::function< void(const ITreeNode *)> visitor) const override
bool IsValid () const override
bool HasCycles () const override
std::vector< ITreeNode * > GetAllNodes () override
std::vector< const ITreeNode * > GetAllNodes () const override
EmberCore::String GetTreeStructure () const override
void PrintTree () const override
std::shared_ptr< BehaviorTreeGetWrappedTree () const
std::shared_ptr< BehaviorTreeGetTree () const
Public Member Functions inherited from EmberCore::ITreeStructure
virtual ~ITreeStructure ()=default
virtual bool HasRootNode () const

Private Member Functions

ITreeNode::NodeType ConvertNodeType (Node::Type type) const
Node::Type ConvertNodeType (ITreeNode::NodeType type) const
void EnsureRootAdapter () const
NodeAdapterGetOrCreateNodeAdapter (Node *node) const

Private Attributes

std::shared_ptr< BehaviorTreebehavior_tree_
std::unique_ptr< NodeAdapterroot_adapter_
std::unordered_map< Node *, std::unique_ptr< NodeAdapter > > node_adapter_cache_

Detailed Description

Direct tree adapter that wraps BehaviorTree for unified tree operations.

This adapter provides ITreeStructure interface while using BehaviorTree as the single source of truth for tree data and operations. This enables proper synchronization between visualization and editing systems.

Definition at line 30 of file DirectTreeAdapter.h.

Constructor & Destructor Documentation

◆ DirectTreeAdapter()

EmberCore::DirectTreeAdapter::DirectTreeAdapter ( std::shared_ptr< BehaviorTree > tree)
explicit

Constructor that wraps a BehaviorTree.

Parameters
treeThe BehaviorTree to wrap

Definition at line 6 of file DirectTreeAdapter.cpp.

◆ ~DirectTreeAdapter()

virtual EmberCore::DirectTreeAdapter::~DirectTreeAdapter ( )
virtualdefault

Member Function Documentation

◆ ConvertNodeType() [1/2]

Node::Type EmberCore::DirectTreeAdapter::ConvertNodeType ( ITreeNode::NodeType type) const
private

Definition at line 133 of file DirectTreeAdapter.cpp.

◆ ConvertNodeType() [2/2]

ITreeNode::NodeType EmberCore::DirectTreeAdapter::ConvertNodeType ( Node::Type type) const
private

Definition at line 118 of file DirectTreeAdapter.cpp.

◆ EnsureRootAdapter()

void EmberCore::DirectTreeAdapter::EnsureRootAdapter ( ) const
private

Definition at line 148 of file DirectTreeAdapter.cpp.

◆ FindNodeById()

ITreeNode * EmberCore::DirectTreeAdapter::FindNodeById ( size_t id) const
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 30 of file DirectTreeAdapter.cpp.

◆ FindNodeByName()

ITreeNode * EmberCore::DirectTreeAdapter::FindNodeByName ( const EmberCore::String & name) const
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 39 of file DirectTreeAdapter.cpp.

◆ FindNodesByType()

std::vector< ITreeNode * > EmberCore::DirectTreeAdapter::FindNodesByType ( ITreeNode::NodeType type) const
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 48 of file DirectTreeAdapter.cpp.

◆ GetAllNodes() [1/2]

std::vector< const ITreeNode * > EmberCore::DirectTreeAdapter::GetAllNodes ( ) const
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 101 of file DirectTreeAdapter.cpp.

◆ GetAllNodes() [2/2]

std::vector< ITreeNode * > EmberCore::DirectTreeAdapter::GetAllNodes ( )
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 95 of file DirectTreeAdapter.cpp.

◆ GetDescription()

const EmberCore::String & EmberCore::DirectTreeAdapter::GetDescription ( ) const
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 21 of file DirectTreeAdapter.cpp.

◆ GetMaxDepth()

size_t EmberCore::DirectTreeAdapter::GetMaxDepth ( ) const
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 28 of file DirectTreeAdapter.cpp.

◆ GetName()

const EmberCore::String & EmberCore::DirectTreeAdapter::GetName ( ) const
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 16 of file DirectTreeAdapter.cpp.

◆ GetNodeCount()

size_t EmberCore::DirectTreeAdapter::GetNodeCount ( ) const
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 26 of file DirectTreeAdapter.cpp.

◆ GetOrCreateNodeAdapter()

NodeAdapter * EmberCore::DirectTreeAdapter::GetOrCreateNodeAdapter ( Node * node) const
private

Definition at line 157 of file DirectTreeAdapter.cpp.

◆ GetRootNode()

ITreeNode * EmberCore::DirectTreeAdapter::GetRootNode ( ) const
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 8 of file DirectTreeAdapter.cpp.

◆ GetTree()

std::shared_ptr< BehaviorTree > EmberCore::DirectTreeAdapter::GetTree ( ) const
inline

Definition at line 73 of file DirectTreeAdapter.h.

◆ GetTreeStructure()

EmberCore::String EmberCore::DirectTreeAdapter::GetTreeStructure ( ) const
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 107 of file DirectTreeAdapter.cpp.

◆ GetWrappedTree()

std::shared_ptr< BehaviorTree > EmberCore::DirectTreeAdapter::GetWrappedTree ( ) const
inline

Definition at line 72 of file DirectTreeAdapter.h.

◆ HasCycles()

bool EmberCore::DirectTreeAdapter::HasCycles ( ) const
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 90 of file DirectTreeAdapter.cpp.

◆ IsValid()

bool EmberCore::DirectTreeAdapter::IsValid ( ) const
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 85 of file DirectTreeAdapter.cpp.

◆ PrintTree()

void EmberCore::DirectTreeAdapter::PrintTree ( ) const
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 111 of file DirectTreeAdapter.cpp.

◆ TraverseNodes() [1/2]

void EmberCore::DirectTreeAdapter::TraverseNodes ( std::function< void(const ITreeNode *)> visitor) const
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 74 of file DirectTreeAdapter.cpp.

◆ TraverseNodes() [2/2]

void EmberCore::DirectTreeAdapter::TraverseNodes ( std::function< void(ITreeNode *)> visitor)
overridevirtual

Implements EmberCore::ITreeStructure.

Definition at line 63 of file DirectTreeAdapter.cpp.

Member Data Documentation

◆ behavior_tree_

std::shared_ptr<BehaviorTree> EmberCore::DirectTreeAdapter::behavior_tree_
private

Definition at line 76 of file DirectTreeAdapter.h.

◆ node_adapter_cache_

std::unordered_map<Node *, std::unique_ptr<NodeAdapter> > EmberCore::DirectTreeAdapter::node_adapter_cache_
mutableprivate

Definition at line 82 of file DirectTreeAdapter.h.

◆ root_adapter_

std::unique_ptr<NodeAdapter> EmberCore::DirectTreeAdapter::root_adapter_
mutableprivate

Definition at line 79 of file DirectTreeAdapter.h.


The documentation for this class was generated from the following files: