Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

RootNode Class Template Reference
[Node]

#include <node.h>

Inheritance diagram for RootNode:

Inheritance graph
[legend]
Collaboration diagram for RootNode:

Collaboration graph
[legend]
List of all members.

Public Types

typedef size_t size_type
typedef ptrdiff_t difference_type
typedef Node< _TContent > & reference
typedef const Node< _TContent > & const_reference
typedef _TContent value_type
typedef Node< _TContent > * pointer
typedef const Node< _TContent > * const_pointer

Public Methods

 RootNode ()
 Constructor.

virtual RootNode< _TContent > * construct () const
 virtual default constructor

virtual RootNode< _TContent > * cloneTree () const
 Simulated Copy Constructor for the tree.

virtual RootNode< _TContent > * cloneNode () const
 Simulated Copy Constructor for the Node, pointer to root, parent and children are preserved, but the children are not duplicated.

virtual const std::list< Node<
_TContent > * > * 
getLeaves () const
 Get a list of leaves of this node.

virtual size_type getNumDescendants () const
 Get the number of descendants of this node.

virtual void recalcLeaves ()
 Update the list of leaves of this node.

virtual void acceptVisitor (NodeVisitorBase< Node< _TContent >, NormalNode< _TContent >, RootNode< _TContent > > *visitor)
 Accept a visitor.

virtual void acceptVisitor (NodeVisitorBase< const Node< _TContent >, const NormalNode< _TContent >, const RootNode< _TContent > > *visitor) const
 Accept a const visitor.

virtual bool isRootNode () const
 Return true is the node is a RootNode This method is nescessary to distinguisch normal and super nodes inside node.


Protected Types

typedef std::map< const Node<
_TContent > *, Node< _TContent > * > 
OldNewMap

Protected Methods

virtual Node< _TContent > * copy (OldNewMap &nodeMap) const
 Copy Node and its children recursively (is used by cloneTree).

virtual void deleteParent ()
 Delete the nodes parent.

virtual void setProtected (bool b)
 Make the RootNode a unit in the enclosing tree Is automatically called with parameter 'true' if the node is added to another.


Protected Attributes

std::list< Node< _TContent > * > m_leaves

Detailed Description

template<class _TContent>
class treecomp::RootNode< _TContent >

This class is the root class of the tree (see Node class).

Definition at line 310 of file node.h.


Member Typedef Documentation

typedef const Node<_TContent>* const_pointer
 

Reimplemented from Node.

Definition at line 326 of file node.h.

typedef const Node<_TContent>& const_reference
 

Reimplemented from Node.

Definition at line 323 of file node.h.

typedef ptrdiff_t difference_type
 

Reimplemented from Node.

Definition at line 321 of file node.h.

typedef std::map<const Node<_TContent>*, Node<_TContent>*> OldNewMap [protected]
 

Reimplemented from Node.

Definition at line 349 of file node.h.

Referenced by RootNode::cloneTree().

typedef Node<_TContent>* pointer
 

Reimplemented from Node.

Definition at line 325 of file node.h.

typedef Node<_TContent>& reference
 

Reimplemented from Node.

Definition at line 322 of file node.h.

typedef size_t size_type
 

Reimplemented from Node.

Definition at line 320 of file node.h.

typedef _TContent value_type
 

Reimplemented from Node.

Definition at line 324 of file node.h.


Constructor & Destructor Documentation

RootNode  
 

Constructor.

Definition at line 860 of file node.h.

References Node::m_root.


Member Function Documentation

void acceptVisitor NodeVisitorBase< const Node< _TContent >, const NormalNode< _TContent >, const RootNode< _TContent > > *    visitor const [virtual]
 

Accept a const visitor.

Calls the visitors visitRootNode method with this node.

Parameters:
visitor  Visitor to visit

Implements Node.

Definition at line 947 of file node.h.

void acceptVisitor NodeVisitorBase< Node< _TContent >, NormalNode< _TContent >, RootNode< _TContent > > *    visitor [virtual]
 

Accept a visitor.

Calls the visitors visitRootNode method with this node.

Parameters:
visitor  Visitor to visit

Implements Node.

Definition at line 933 of file node.h.

RootNode< _TContent > * cloneNode   const [virtual]
 

Simulated Copy Constructor for the Node, pointer to root, parent and children are preserved, but the children are not duplicated.

Implements Node.

Definition at line 896 of file node.h.

References Node::m_content.

RootNode< _TContent > * cloneTree   const [virtual]
 

Simulated Copy Constructor for the tree.

All children are duplicated, pointers to root and parent are preserved

Implements Node.

Definition at line 871 of file node.h.

References Node::linkSiblings(), Node::m_children, Node::m_root, and RootNode::OldNewMap.

virtual RootNode<_TContent>* construct   const [inline, virtual]
 

virtual default constructor

Implements Node.

Definition at line 332 of file node.h.

Node< _TContent > * copy OldNewMap   nodeMap const [protected, virtual]
 

Copy Node and its children recursively (is used by cloneTree).

Parameters:
nodeMap  This map holds old-new node pairs of the ancestors of this

Implements Node.

Definition at line 909 of file node.h.

References Node::linkSiblings(), Node::m_children, Node::m_parent, and Node::m_root.

void deleteParent   [protected, virtual]
 

Delete the nodes parent.

This method is called if the node as child is removed.

Reimplemented from Node.

Definition at line 998 of file node.h.

References Node::m_parent, and Node::m_root.

virtual const std::list<Node<_TContent>*>* getLeaves   const [inline, virtual]
 

Get a list of leaves of this node.

The list differs from the list obtained by 'getChildren()' only if the node is root of a (sub-) tree (= RootNode).

Reimplemented from Node.

Definition at line 337 of file node.h.

References RootNode::m_leaves.

size_t getNumDescendants   const [virtual]
 

Get the number of descendants of this node.

Reimplemented from Node.

Definition at line 959 of file node.h.

virtual bool isRootNode   const [inline, virtual]
 

Return true is the node is a RootNode This method is nescessary to distinguisch normal and super nodes inside node.

Reimplemented from Node.

Definition at line 346 of file node.h.

void recalcLeaves   [virtual]
 

Update the list of leaves of this node.

Call this function after building a subtree that should later be recognized as such. Is automatically called if the node is added to another

Reimplemented from Node.

Definition at line 975 of file node.h.

References RootNode::m_leaves.

void setProtected bool    b [protected, virtual]
 

Make the RootNode a unit in the enclosing tree Is automatically called with parameter 'true' if the node is added to another.

Reimplemented from Node.

Definition at line 988 of file node.h.

References Node::m_protected.


Member Data Documentation

std::list<Node<_TContent>*> m_leaves [protected]
 

Definition at line 355 of file node.h.

Referenced by RootNode::getLeaves(), and RootNode::recalcLeaves().


The documentation for this class was generated from the following file:
Generated on Mon Jan 6 12:02:29 2003 for TreeComp by doxygen1.2.17