tree< T, tree_node_allocator >::leaf_iterator Class Reference

#include <tree.h>

Inheritance diagram for tree< T, tree_node_allocator >::leaf_iterator:

Inheritance graph
[legend]
Collaboration diagram for tree< T, tree_node_allocator >::leaf_iterator:

Collaboration graph
[legend]

Detailed Description

template<class T, class tree_node_allocator = std::allocator<tree_node_<T> >>
class tree< T, tree_node_allocator >::leaf_iterator

Iterator which traverses only the leaves.

Definition at line 269 of file tree.h.


Public Member Functions

 leaf_iterator ()
 leaf_iterator (tree_node *)
 leaf_iterator (const sibling_iterator &)
 leaf_iterator (const iterator_base &)
bool operator== (const leaf_iterator &) const
bool operator!= (const leaf_iterator &) const
leaf_iteratoroperator++ ()
leaf_iteratoroperator-- ()
leaf_iterator operator++ (int)
leaf_iterator operator-- (int)
leaf_iteratoroperator+= (unsigned int)
leaf_iteratoroperator-= (unsigned int)

Constructor & Destructor Documentation

template<class T, class tree_node_allocator>
tree< T, tree_node_allocator >::leaf_iterator::leaf_iterator (  )  [inline]

Definition at line 2521 of file tree.h.

02522    : iterator_base(0)
02523    {
02524    }

template<class T, class tree_node_allocator>
tree< T, tree_node_allocator >::leaf_iterator::leaf_iterator ( tree_node tn  )  [inline]

Definition at line 2527 of file tree.h.

02528    : iterator_base(tn)
02529    {
02530    }

template<class T, class tree_node_allocator>
tree< T, tree_node_allocator >::leaf_iterator::leaf_iterator ( const sibling_iterator other  )  [inline]

Definition at line 2539 of file tree.h.

References tree< T, tree_node_allocator >::iterator_base::node, tree< T, tree_node_allocator >::sibling_iterator::parent_, and tree< T, tree_node_allocator >::sibling_iterator::range_last().

02540    : iterator_base(other.node)
02541    {
02542    if(this->node==0) {
02543       if(other.range_last()!=0)
02544          this->node=other.range_last();
02545       else 
02546          this->node=other.parent_;
02547       ++(*this);
02548       }
02549    }

Here is the call graph for this function:

template<class T, class tree_node_allocator>
tree< T, tree_node_allocator >::leaf_iterator::leaf_iterator ( const iterator_base other  )  [inline]

Definition at line 2533 of file tree.h.

02534    : iterator_base(other.node)
02535    {
02536    }


Member Function Documentation

template<class T, class tree_node_allocator>
bool tree< T, tree_node_allocator >::leaf_iterator::operator== ( const leaf_iterator other  )  const [inline]

Definition at line 1872 of file tree.h.

References tree< T, tree_node_allocator >::iterator_base::node.

01873    {
01874    if(other.node==this->node) return true;
01875    else return false;
01876    }

template<class T, class tree_node_allocator>
bool tree< T, tree_node_allocator >::leaf_iterator::operator!= ( const leaf_iterator other  )  const [inline]

Definition at line 1865 of file tree.h.

References tree< T, tree_node_allocator >::iterator_base::node.

01866    {
01867    if(other.node!=this->node) return true;
01868    else return false;
01869    }

template<class T, class tree_node_allocator>
tree< T, tree_node_allocator >::leaf_iterator & tree< T, tree_node_allocator >::leaf_iterator::operator++ (  )  [inline]

Definition at line 2552 of file tree.h.

References tree_node_< T >::first_child, tree_node_< T >::next_sibling, tree< T, tree_node_allocator >::iterator_base::node, and tree_node_< T >::parent.

02553    {
02554    assert(this->node!=0);
02555    while(this->node->next_sibling==0) {
02556       if (this->node->parent==0) return *this;
02557       this->node=this->node->parent;
02558       }
02559    this->node=this->node->next_sibling;
02560    while(this->node->first_child)
02561       this->node=this->node->first_child;
02562    return *this;
02563    }

template<class T, class tree_node_allocator>
tree< T, tree_node_allocator >::leaf_iterator & tree< T, tree_node_allocator >::leaf_iterator::operator-- (  )  [inline]

Definition at line 2566 of file tree.h.

References tree_node_< T >::last_child, tree< T, tree_node_allocator >::iterator_base::node, tree_node_< T >::parent, and tree_node_< T >::prev_sibling.

02567    {
02568    assert(this->node!=0);
02569    while (this->node->prev_sibling==0) {
02570       if (this->node->parent==0) return *this;
02571       this->node=this->node->parent;
02572       }
02573    this->node=this->node->prev_sibling;
02574    while(this->node->last_child)
02575       this->node=this->node->last_child;
02576    return *this;
02577    }

template<class T, class tree_node_allocator>
tree< T, tree_node_allocator >::leaf_iterator tree< T, tree_node_allocator >::leaf_iterator::operator++ ( int   )  [inline]

Definition at line 2580 of file tree.h.

02581    {
02582    leaf_iterator copy = *this;
02583    ++(*this);
02584    return copy;
02585    }

template<class T, class tree_node_allocator>
tree< T, tree_node_allocator >::leaf_iterator tree< T, tree_node_allocator >::leaf_iterator::operator-- ( int   )  [inline]

Definition at line 2588 of file tree.h.

02589    {
02590    leaf_iterator copy = *this;
02591    --(*this);
02592    return copy;
02593    }

template<class T, class tree_node_allocator>
tree< T, tree_node_allocator >::leaf_iterator & tree< T, tree_node_allocator >::leaf_iterator::operator+= ( unsigned int  num  )  [inline]

Definition at line 2597 of file tree.h.

02598    {
02599    while(num>0) {
02600       ++(*this);
02601       --num;
02602       }
02603    return (*this);
02604    }

template<class T, class tree_node_allocator>
tree< T, tree_node_allocator >::leaf_iterator & tree< T, tree_node_allocator >::leaf_iterator::operator-= ( unsigned int  num  )  [inline]

Definition at line 2607 of file tree.h.

02608    {
02609    while(num>0) {
02610       --(*this);
02611       --num;
02612       }
02613    return (*this);
02614    }


The documentation for this class was generated from the following file:
Generated on Wed Feb 27 20:32:41 2008 for php.ast.svn.src. by  doxygen 1.5.3