OpenWalnut  1.4.0
Public Types | Public Member Functions | Private Attributes
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:

List of all members.

Public Types

typedef boost::shared_ptr
< WTreeNode
SPtr
 Shared pointer abbreviation.

Public Member Functions

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

Private Attributes

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

Detailed Description

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

Definition at line 39 of file WTreeNode.h.


Member Typedef Documentation

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

Shared pointer abbreviation.

Definition at line 45 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().

Default destructor.

Definition at line 74 of file WTreeNode.cpp.


Member Function Documentation

Adds a childnode to this node.

Parameters:
childthe child node to add

Definition at line 88 of file WTreeNode.cpp.

References m_children.

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.

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.

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 106 of file WTreeNode.h.

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

Stores the index of this node.

Definition at line 116 of file WTreeNode.h.

Referenced by index(), and WTreeNode().

double WTreeNode::m_level [private]

Stores the level of this node.

Definition at line 111 of file WTreeNode.h.

Referenced by level(), and WTreeNode().

Stores the parent node.

Definition at line 121 of file WTreeNode.h.

Referenced by getParent().


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