OpenWalnut  1.4.0
Public Types | Public Member Functions | Private Attributes | List of all members
WTreeNode Class Reference

A node in a tree, holding an index, a level in the tree and pointers to its child nodes. More...

#include <WTreeNode.h>

+ Inheritance diagram for WTreeNode:

Public Types

typedef boost::shared_ptr< WTreeNodeSPtr
 Shared pointer abbreviation. More...
 

Public Member Functions

 WTreeNode (size_t index, double level)
 Constructs a new TreeNode. More...
 
 WTreeNode (const WDendrogram &dendrogram)
 Constructs a tree of WTreeNodes from a WDendrogram with this WTreeNode as root. More...
 
 ~WTreeNode ()
 Default destructor. More...
 
void addChild (WTreeNode::SPtr child)
 Adds a childnode to this node. More...
 
size_t index ()
 Returns the index of the TreeNode. More...
 
double level ()
 Returns the level of the TreeNode. More...
 
std::vector< WTreeNode::SPtrgetChildren ()
 Returns the child nodes of this node. More...
 
WTreeNode::SPtr getParent ()
 Returns the parent node of this node. More...
 

Private Attributes

std::vector< WTreeNode::SPtrm_children
 Stores the childnodes of this node. More...
 
double m_level
 Stores the level of this node. More...
 
size_t m_index
 Stores the index of this node. More...
 
WTreeNode::SPtr m_parent
 Stores the parent node. More...
 

Detailed Description

A node in a tree, holding an index, a level in the tree and pointers to its child nodes.

Definition at line 43 of file WTreeNode.h.

Member Typedef Documentation

typedef boost::shared_ptr< WTreeNode > WTreeNode::SPtr

Shared pointer abbreviation.

Definition at line 49 of file WTreeNode.h.

Constructor & Destructor Documentation

WTreeNode::WTreeNode ( size_t  index,
double  level 
)

Constructs a new TreeNode.

Parameters
indexthe index of the new Node.
levelthe level of the Node in the Tree

Definition at line 32 of file WTreeNode.cpp.

Referenced by WTreeNode().

WTreeNode::WTreeNode ( const WDendrogram dendrogram)
explicit

Constructs a tree of WTreeNodes from a WDendrogram with this WTreeNode as root.

Parameters
dendrogramReference to the dendrogram to construct the tree from

Definition at line 39 of file WTreeNode.cpp.

References WDendrogram::getHeights(), WDendrogram::getParents(), index(), m_children, m_index, m_level, and WTreeNode().

WTreeNode::~WTreeNode ( )

Default destructor.

Definition at line 74 of file WTreeNode.cpp.

Member Function Documentation

void WTreeNode::addChild ( WTreeNode::SPtr  child)

Adds a childnode to this node.

Parameters
childthe child node to add

Definition at line 88 of file WTreeNode.cpp.

References m_children.

std::vector< WTreeNode::SPtr > WTreeNode::getChildren ( )

Returns the child nodes of this node.

Returns
the child nodes of this node

Definition at line 99 of file WTreeNode.cpp.

References m_children.

WTreeNode::SPtr WTreeNode::getParent ( )

Returns the parent node of this node.

Returns
the parent node of this node

Definition at line 94 of file WTreeNode.cpp.

References m_parent.

size_t WTreeNode::index ( )

Returns the index of the TreeNode.

Returns
the node's index

Definition at line 83 of file WTreeNode.cpp.

References m_index.

Referenced by WTreeNode().

double WTreeNode::level ( )

Returns the level of the TreeNode.

All level-0-nodes are leaves.

Returns
the node's level

Definition at line 78 of file WTreeNode.cpp.

References m_level.

Member Data Documentation

std::vector< WTreeNode::SPtr > WTreeNode::m_children
private

Stores the childnodes of this node.

Definition at line 110 of file WTreeNode.h.

Referenced by addChild(), getChildren(), and WTreeNode().

size_t WTreeNode::m_index
private

Stores the index of this node.

Definition at line 120 of file WTreeNode.h.

Referenced by index(), and WTreeNode().

double WTreeNode::m_level
private

Stores the level of this node.

Definition at line 115 of file WTreeNode.h.

Referenced by level(), and WTreeNode().

WTreeNode::SPtr WTreeNode::m_parent
private

Stores the parent node.

Definition at line 125 of file WTreeNode.h.

Referenced by getParent().


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