Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

CB2::Tree< Tmemb > Class Template Reference

Tree. More...

#include <utils.h>

Inheritance diagram for CB2::Tree< Tmemb >:

CB2::Class List of all members.

Public Types

typedef Tree< Tmemb > this_type
 Template type alias.

typedef List< this_typesubtrees_type
 Subtree list.

typedef subtrees_type::size_type size_type
 Size type.

typedef subtrees_type::ref_type ref_type
 Subtree reference type.

typedef Iterator< this_type,
ref_type, this_type
iterator
 Iterator.

typedef RevIterator< this_type,
ref_type, this_type
rev_iterator
 Reverse iterator.


Public Member Functions

 Tree ()
 Constructor.

 ~Tree ()
 Destructor.

bool IsNULL () const
 Check whether tree node is NULL.

size_type CountSubtrees () const
 Get number of subtrees.

const this_typeoperator<< (const Tmemb *prev)
 Point node to data.

void Push (const Tmemb &prev)
 Push data to node.

this_typeAddChild ()
 Create new subtree.

ref_type RefBegin () const
 Get starting reference to subtrees.

ref_type RefEnd () const
 Get final reference to subtrees.

ref_type RevRefBegin () const
 Get starting reverse reference to subtrees.

ref_type RevRefEnd () const
 Get final reverse reference to subtrees.

ref_type RefNext (const ref_type &prev) const
 Get succeding reference.

ref_type RefPrev (const ref_type &prev) const
 Get predecessing reference.

const this_typeDeref (const ref_type &ref) const
 Dereference.

const this_typeRevDeref (const ref_type &ref) const
 Reverse dereference.

iterator Begin () const
 Get starting subtree iterator.

iterator End () const
 Get final subtree iterator.

rev_iterator RevBegin () const
 Get starting subtree reverse iterator.

rev_iterator RevEnd () const
 Get final subtree reverse iterator.


Public Attributes

int tag
 Tag for user-specific data.


Private Attributes

Tmemb * data
 Node data.

bool local
 Local copy flag.

subtrees_type subtrees
 List of subtrees.


Detailed Description

template<class Tmemb>
class CB2::Tree< Tmemb >

Tree.

Template for storing tree structures. This is a recursive structure storing the data and list of subtrees.


Member Typedef Documentation

template<class Tmemb>
typedef Iterator< this_type, ref_type, this_type> CB2::Tree< Tmemb >::iterator
 

Iterator.

template<class Tmemb>
typedef subtrees_type::ref_type CB2::Tree< Tmemb >::ref_type
 

Subtree reference type.

template<class Tmemb>
typedef RevIterator< this_type, ref_type, this_type> CB2::Tree< Tmemb >::rev_iterator
 

Reverse iterator.

template<class Tmemb>
typedef subtrees_type::size_type CB2::Tree< Tmemb >::size_type
 

Size type.

template<class Tmemb>
typedef List< this_type> CB2::Tree< Tmemb >::subtrees_type
 

Subtree list.

template<class Tmemb>
typedef Tree< Tmemb> CB2::Tree< Tmemb >::this_type
 

Template type alias.


Constructor & Destructor Documentation

template<class Tmemb>
CB2::Tree< Tmemb >::Tree  )  [inline]
 

Constructor.

Create empty tree.

template<class Tmemb>
CB2::Tree< Tmemb >::~Tree  )  [inline]
 

Destructor.

Deallocate the tree.


Member Function Documentation

template<class Tmemb>
this_type* CB2::Tree< Tmemb >::AddChild  )  [inline]
 

Create new subtree.

Create new subtree.

Returns:
New subtree of the node.

template<class Tmemb>
iterator CB2::Tree< Tmemb >::Begin  )  const [inline]
 

Get starting subtree iterator.

Returns:
Starting subtree iterator.

template<class Tmemb>
size_type CB2::Tree< Tmemb >::CountSubtrees  )  const [inline]
 

Get number of subtrees.

Returns:
Number of subtrees.

template<class Tmemb>
const this_type& CB2::Tree< Tmemb >::Deref const ref_type ref  )  const [inline]
 

Dereference.

Parameters:
Reference. 
Returns:
Subtree.

template<class Tmemb>
iterator CB2::Tree< Tmemb >::End  )  const [inline]
 

Get final subtree iterator.

Returns:
Final subtree iterator.

template<class Tmemb>
bool CB2::Tree< Tmemb >::IsNULL  )  const [inline]
 

Check whether tree node is NULL.

Check whether key node is NULL, which also means that there are no subtrees.

Returns:
True if the node is NULL and has no subtrees.

template<class Tmemb>
const this_type& CB2::Tree< Tmemb >::operator<< const Tmemb *  prev  )  [inline]
 

Point node to data.

Point the node to the data. The node stores as pointer to the original data.

Parameters:
prev Data to put to the node.
Returns:
Reference to this.

template<class Tmemb>
void CB2::Tree< Tmemb >::Push const Tmemb &  prev  )  [inline]
 

Push data to node.

Push the data to the node. The node stores local copy of the data, so a copy constructor is used.

Parameters:
prev Data to push to the node.

template<class Tmemb>
ref_type CB2::Tree< Tmemb >::RefBegin  )  const [inline]
 

Get starting reference to subtrees.

Returns:
Starting reference to subtrees.

template<class Tmemb>
ref_type CB2::Tree< Tmemb >::RefEnd  )  const [inline]
 

Get final reference to subtrees.

Returns:
Final reference to subtrees.

template<class Tmemb>
ref_type CB2::Tree< Tmemb >::RefNext const ref_type prev  )  const [inline]
 

Get succeding reference.

Parameters:
Original reference.
Returns:
Succeding reference.

template<class Tmemb>
ref_type CB2::Tree< Tmemb >::RefPrev const ref_type prev  )  const [inline]
 

Get predecessing reference.

Parameters:
Original reference.
Returns:
Predecessing reference.

template<class Tmemb>
rev_iterator CB2::Tree< Tmemb >::RevBegin  )  const [inline]
 

Get starting subtree reverse iterator.

Returns:
Starting subtree reverse iterator.

template<class Tmemb>
const this_type& CB2::Tree< Tmemb >::RevDeref const ref_type ref  )  const [inline]
 

Reverse dereference.

Parameters:
Reverse reference.
Returns:
Subtree.

template<class Tmemb>
rev_iterator CB2::Tree< Tmemb >::RevEnd  )  const [inline]
 

Get final subtree reverse iterator.

Returns:
Final subtree reverse iterator.

template<class Tmemb>
ref_type CB2::Tree< Tmemb >::RevRefBegin  )  const [inline]
 

Get starting reverse reference to subtrees.

Returns:
Starting reverse reference to subtrees.

template<class Tmemb>
ref_type CB2::Tree< Tmemb >::RevRefEnd  )  const [inline]
 

Get final reverse reference to subtrees.

Returns:
Final reverse reference to subtrees.


Member Data Documentation

template<class Tmemb>
Tmemb* CB2::Tree< Tmemb >::data [private]
 

Node data.

template<class Tmemb>
bool CB2::Tree< Tmemb >::local [private]
 

Local copy flag.

template<class Tmemb>
subtrees_type CB2::Tree< Tmemb >::subtrees [private]
 

List of subtrees.

int CB2::Class::tag [inherited]
 

Tag for user-specific data.


The documentation for this class was generated from the following file:
Generated on Thu Sep 16 23:26:49 2004 for ColorBox2 by doxygen 1.3.7