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

Adapter class that wraps the current Node implementation to work with ITreeNode interface. More...

#include <NodeAdapter.h>

Inheritance diagram for EmberCore::NodeAdapter:
EmberCore::ITreeNode

Public Member Functions

 NodeAdapter (Node *node)
 Constructor that wraps an existing Node.
virtual ~NodeAdapter ()=default
const EmberCore::StringGetName () const override
NodeType GetType () const override
NodeStatus GetStatus () const override
size_t GetId () const override
size_t GetChildCount () const override
ITreeNodeGetChild (size_t index) const override
ITreeNodeGetParent () const override
const EmberCore::PointGetPosition () const override
void SetPosition (const EmberCore::Point &position) override
VisualState GetVisualState () const override
void SetVisualState (VisualState state) override
bool AreChildrenVisible () const override
void SetChildrenVisible (bool visible) override
int GetChildrenWidth () const override
void SetChildrenWidth (int width) override
int CalculateSubtreeWidth (int node_width, int horizontal_spacing) const override
size_t GetDepth () const override
size_t GetSubtreeNodeCount () const override
bool IsSubTreeReference () const override
 Check if this node is a SubTree reference.
bool IsUnimplementedReference () const override
 Check if this node references an unimplemented tree.
String GetSubTreeReference () const override
 Get the ID of the referenced SubTree (if this is a SubTree node)
void Accept (std::function< void(ITreeNode *)> visitor) override
void Accept (std::function< void(const ITreeNode *)> visitor) const override
NodeGetWrappedNode () const
Public Member Functions inherited from EmberCore::ITreeNode
virtual ~ITreeNode ()=default
virtual bool HasChildren () const
virtual void ToggleChildrenVisibility ()
virtual String GetTypeString () const
virtual String GetStatusString () const

Private Member Functions

NodeType ConvertNodeType (Node::Type type) const
NodeStatus ConvertNodeStatus (Node::Status status) const
VisualState ConvertVisualState (Node::VisualState state) const
Node::VisualState ConvertVisualState (VisualState state) const
void EnsureChildAdapters () const
void EnsureParentAdapter () const

Private Attributes

Nodewrapped_node_
std::vector< std::unique_ptr< NodeAdapter > > child_adapters_
std::unique_ptr< NodeAdapterparent_adapter_

Additional Inherited Members

Public Types inherited from EmberCore::ITreeNode
enum class  NodeType {
  Unknown , Action , Control , Condition ,
  Decorator , BehaviorTree
}
 Node types for visualization categorization. More...
enum class  NodeStatus { Idle , Running , Success , Failure }
 Node status for runtime visualization. More...
enum class  VisualState { Normal , Selected , Hovered , Highlighted }
 Visual state for UI rendering. More...

Detailed Description

Adapter class that wraps the current Node implementation to work with ITreeNode interface.

This adapter allows the existing Node class to be used with the new abstraction layer, preserving all existing functionality while making the visualization system independent of the specific Node implementation.

Definition at line 16 of file NodeAdapter.h.

Constructor & Destructor Documentation

◆ NodeAdapter()

EmberCore::NodeAdapter::NodeAdapter ( Node * node)
explicit

Constructor that wraps an existing Node.

Parameters
nodeThe Node to wrap (must not be null)

Definition at line 7 of file NodeAdapter.cpp.

◆ ~NodeAdapter()

virtual EmberCore::NodeAdapter::~NodeAdapter ( )
virtualdefault

Member Function Documentation

◆ Accept() [1/2]

void EmberCore::NodeAdapter::Accept ( std::function< void(const ITreeNode *)> visitor) const
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 80 of file NodeAdapter.cpp.

◆ Accept() [2/2]

void EmberCore::NodeAdapter::Accept ( std::function< void(ITreeNode *)> visitor)
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 68 of file NodeAdapter.cpp.

◆ AreChildrenVisible()

bool EmberCore::NodeAdapter::AreChildrenVisible ( ) const
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 52 of file NodeAdapter.cpp.

◆ CalculateSubtreeWidth()

int EmberCore::NodeAdapter::CalculateSubtreeWidth ( int node_width,
int horizontal_spacing ) const
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 60 of file NodeAdapter.cpp.

◆ ConvertNodeStatus()

ITreeNode::NodeStatus EmberCore::NodeAdapter::ConvertNodeStatus ( Node::Status status) const
private

Definition at line 111 of file NodeAdapter.cpp.

◆ ConvertNodeType()

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

Definition at line 94 of file NodeAdapter.cpp.

◆ ConvertVisualState() [1/2]

ITreeNode::VisualState EmberCore::NodeAdapter::ConvertVisualState ( Node::VisualState state) const
private

Definition at line 126 of file NodeAdapter.cpp.

◆ ConvertVisualState() [2/2]

Node::VisualState EmberCore::NodeAdapter::ConvertVisualState ( VisualState state) const
private

Definition at line 141 of file NodeAdapter.cpp.

◆ EnsureChildAdapters()

void EmberCore::NodeAdapter::EnsureChildAdapters ( ) const
private

Definition at line 156 of file NodeAdapter.cpp.

◆ EnsureParentAdapter()

void EmberCore::NodeAdapter::EnsureParentAdapter ( ) const
private

Definition at line 172 of file NodeAdapter.cpp.

◆ GetChild()

ITreeNode * EmberCore::NodeAdapter::GetChild ( size_t index) const
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 23 of file NodeAdapter.cpp.

◆ GetChildCount()

size_t EmberCore::NodeAdapter::GetChildCount ( ) const
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 21 of file NodeAdapter.cpp.

◆ GetChildrenWidth()

int EmberCore::NodeAdapter::GetChildrenWidth ( ) const
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 56 of file NodeAdapter.cpp.

◆ GetDepth()

size_t EmberCore::NodeAdapter::GetDepth ( ) const
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 64 of file NodeAdapter.cpp.

◆ GetId()

size_t EmberCore::NodeAdapter::GetId ( ) const
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 19 of file NodeAdapter.cpp.

◆ GetName()

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

Implements EmberCore::ITreeNode.

Definition at line 13 of file NodeAdapter.cpp.

◆ GetParent()

ITreeNode * EmberCore::NodeAdapter::GetParent ( ) const
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 33 of file NodeAdapter.cpp.

◆ GetPosition()

const EmberCore::Point & EmberCore::NodeAdapter::GetPosition ( ) const
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 42 of file NodeAdapter.cpp.

◆ GetStatus()

ITreeNode::NodeStatus EmberCore::NodeAdapter::GetStatus ( ) const
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 17 of file NodeAdapter.cpp.

◆ GetSubtreeNodeCount()

size_t EmberCore::NodeAdapter::GetSubtreeNodeCount ( ) const
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 66 of file NodeAdapter.cpp.

◆ GetSubTreeReference()

String EmberCore::NodeAdapter::GetSubTreeReference ( ) const
overridevirtual

Get the ID of the referenced SubTree (if this is a SubTree node)

Returns
The SubTree ID, or empty string if not a SubTree reference

Reimplemented from EmberCore::ITreeNode.

Definition at line 190 of file NodeAdapter.cpp.

◆ GetType()

ITreeNode::NodeType EmberCore::NodeAdapter::GetType ( ) const
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 15 of file NodeAdapter.cpp.

◆ GetVisualState()

ITreeNode::VisualState EmberCore::NodeAdapter::GetVisualState ( ) const
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 46 of file NodeAdapter.cpp.

◆ GetWrappedNode()

Node * EmberCore::NodeAdapter::GetWrappedNode ( ) const
inline

Definition at line 65 of file NodeAdapter.h.

◆ IsSubTreeReference()

bool EmberCore::NodeAdapter::IsSubTreeReference ( ) const
overridevirtual

Check if this node is a SubTree reference.

Returns
true if this node references another tree

Reimplemented from EmberCore::ITreeNode.

Definition at line 178 of file NodeAdapter.cpp.

◆ IsUnimplementedReference()

bool EmberCore::NodeAdapter::IsUnimplementedReference ( ) const
overridevirtual

Check if this node references an unimplemented tree.

Returns
true if this is a SubTree reference that hasn't been resolved

Reimplemented from EmberCore::ITreeNode.

Definition at line 184 of file NodeAdapter.cpp.

◆ SetChildrenVisible()

void EmberCore::NodeAdapter::SetChildrenVisible ( bool visible)
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 54 of file NodeAdapter.cpp.

◆ SetChildrenWidth()

void EmberCore::NodeAdapter::SetChildrenWidth ( int width)
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 58 of file NodeAdapter.cpp.

◆ SetPosition()

void EmberCore::NodeAdapter::SetPosition ( const EmberCore::Point & position)
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 44 of file NodeAdapter.cpp.

◆ SetVisualState()

void EmberCore::NodeAdapter::SetVisualState ( VisualState state)
overridevirtual

Implements EmberCore::ITreeNode.

Definition at line 50 of file NodeAdapter.cpp.

Member Data Documentation

◆ child_adapters_

std::vector<std::unique_ptr<NodeAdapter> > EmberCore::NodeAdapter::child_adapters_
mutableprivate

Definition at line 71 of file NodeAdapter.h.

◆ parent_adapter_

std::unique_ptr<NodeAdapter> EmberCore::NodeAdapter::parent_adapter_
mutableprivate

Definition at line 72 of file NodeAdapter.h.

◆ wrapped_node_

Node* EmberCore::NodeAdapter::wrapped_node_
private

Definition at line 68 of file NodeAdapter.h.


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