tree< T, tree_node_allocator >::iterator_base Class Reference

#include <tree.h>

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

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

Collaboration graph
[legend]

Detailed Description

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

Base class for iterators, only pointers stored, no traversal logic.

Definition at line 131 of file tree.h.


Public Types

typedef T value_type
typedef T * pointer
typedef T & reference
typedef size_t size_type
typedef ptrdiff_t difference_type
typedef
std::bidirectional_iterator_tag 
iterator_category

Public Member Functions

 iterator_base ()
 iterator_base (tree_node *)
T & operator * () const
T * operator-> () const
void skip_children ()
 When called, the next increment/decrement skips children of this node.
unsigned int number_of_children () const
 Number of children of the node pointed to by the iterator.
sibling_iterator begin () const
sibling_iterator end () const

Data Fields

tree_nodenode

Protected Attributes

bool skip_current_children_

Member Typedef Documentation

template<class T, class tree_node_allocator = std::allocator<tree_node_<T> >>
typedef T tree< T, tree_node_allocator >::iterator_base::value_type

Definition at line 134 of file tree.h.

template<class T, class tree_node_allocator = std::allocator<tree_node_<T> >>
typedef T* tree< T, tree_node_allocator >::iterator_base::pointer

Definition at line 135 of file tree.h.

template<class T, class tree_node_allocator = std::allocator<tree_node_<T> >>
typedef T& tree< T, tree_node_allocator >::iterator_base::reference

Definition at line 136 of file tree.h.

template<class T, class tree_node_allocator = std::allocator<tree_node_<T> >>
typedef size_t tree< T, tree_node_allocator >::iterator_base::size_type

Definition at line 137 of file tree.h.

template<class T, class tree_node_allocator = std::allocator<tree_node_<T> >>
typedef ptrdiff_t tree< T, tree_node_allocator >::iterator_base::difference_type

Definition at line 138 of file tree.h.

template<class T, class tree_node_allocator = std::allocator<tree_node_<T> >>
typedef std::bidirectional_iterator_tag tree< T, tree_node_allocator >::iterator_base::iterator_category

Definition at line 139 of file tree.h.


Constructor & Destructor Documentation

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

Definition at line 1799 of file tree.h.

01800    : node(0), skip_current_children_(false)
01801    {
01802    }

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

Definition at line 1805 of file tree.h.

01806    : node(tn), skip_current_children_(false)
01807    {
01808    }


Member Function Documentation

template<class T, class tree_node_allocator>
T & tree< T, tree_node_allocator >::iterator_base::operator * (  )  const [inline]

Definition at line 1811 of file tree.h.

References tree_node_< T >::data, and tree< T, tree_node_allocator >::iterator_base::node.

01812    {
01813    return node->data;
01814    }

template<class T, class tree_node_allocator>
T * tree< T, tree_node_allocator >::iterator_base::operator-> (  )  const [inline]

Definition at line 1817 of file tree.h.

References tree_node_< T >::data, and tree< T, tree_node_allocator >::iterator_base::node.

01818    {
01819    return &(node->data);
01820    }

template<class T, class tree_node_allocator>
void tree< T, tree_node_allocator >::iterator_base::skip_children (  )  [inline]

When called, the next increment/decrement skips children of this node.

Definition at line 1898 of file tree.h.

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

Referenced by tree< T, tree_node_allocator >::copy_(), tree< T, tree_node_allocator >::post_order_iterator::post_order_iterator(), and tree< T, tree_node_allocator >::pre_order_iterator::pre_order_iterator().

01899    {
01900    skip_current_children_=true;
01901    }

Here is the caller graph for this function:

template<class T, class tree_node_allocator>
unsigned int tree< T, tree_node_allocator >::iterator_base::number_of_children (  )  const [inline]

Number of children of the node pointed to by the iterator.

Definition at line 1904 of file tree.h.

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

Referenced by tree< T, tree_node_allocator >::equal().

01905    {
01906    tree_node *pos=node->first_child;
01907    if(pos==0) return 0;
01908    
01909    unsigned int ret=1;
01910    while(pos!=node->last_child) {
01911       ++ret;
01912       pos=pos->next_sibling;
01913       }
01914    return ret;
01915    }

Here is the caller graph for this function:

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

Definition at line 1879 of file tree.h.

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

Referenced by tree< T, tree_node_allocator >::merge(), and tree< T, tree_node_allocator >::breadth_first_queued_iterator::operator++().

01880    {
01881    if(node->first_child==0) 
01882       return end();
01883 
01884    sibling_iterator ret(node->first_child);
01885    ret.parent_=this->node;
01886    return ret;
01887    }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 1890 of file tree.h.

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

Referenced by tree< T, tree_node_allocator >::iterator_base::begin(), tree< T, tree_node_allocator >::merge(), and tree< T, tree_node_allocator >::breadth_first_queued_iterator::operator++().

01891    {
01892    sibling_iterator ret(0);
01893    ret.parent_=node;
01894    return ret;
01895    }

Here is the caller graph for this function:


Field Documentation

template<class T, class tree_node_allocator = std::allocator<tree_node_<T> >>
tree_node* tree< T, tree_node_allocator >::iterator_base::node

Definition at line 155 of file tree.h.

Referenced by tree< T, tree_node_allocator >::iterator_base::begin(), tree< T, tree_node_allocator >::post_order_iterator::descend_all(), tree< T, tree_node_allocator >::iterator_base::end(), tree< T, tree_node_allocator >::index(), tree< T, tree_node_allocator >::insert(), tree< T, tree_node_allocator >::leaf_iterator::leaf_iterator(), tree< T, tree_node_allocator >::move_before(), tree< T, tree_node_allocator >::iterator_base::number_of_children(), tree< T, tree_node_allocator >::iterator_base::operator *(), tree< T, tree_node_allocator >::fixed_depth_iterator::operator!=(), tree< T, tree_node_allocator >::breadth_first_queued_iterator::operator!=(), tree< T, tree_node_allocator >::leaf_iterator::operator!=(), tree< T, tree_node_allocator >::sibling_iterator::operator!=(), tree< T, tree_node_allocator >::pre_order_iterator::operator!=(), tree< T, tree_node_allocator >::post_order_iterator::operator!=(), tree< T, tree_node_allocator >::leaf_iterator::operator++(), tree< T, tree_node_allocator >::sibling_iterator::operator++(), tree< T, tree_node_allocator >::fixed_depth_iterator::operator++(), tree< T, tree_node_allocator >::breadth_first_queued_iterator::operator++(), tree< T, tree_node_allocator >::post_order_iterator::operator++(), tree< T, tree_node_allocator >::pre_order_iterator::operator++(), tree< T, tree_node_allocator >::leaf_iterator::operator--(), tree< T, tree_node_allocator >::sibling_iterator::operator--(), tree< T, tree_node_allocator >::fixed_depth_iterator::operator--(), tree< T, tree_node_allocator >::post_order_iterator::operator--(), tree< T, tree_node_allocator >::pre_order_iterator::operator--(), tree< T, tree_node_allocator >::iterator_base::operator->(), tree< T, tree_node_allocator >::fixed_depth_iterator::operator==(), tree< T, tree_node_allocator >::breadth_first_queued_iterator::operator==(), tree< T, tree_node_allocator >::leaf_iterator::operator==(), tree< T, tree_node_allocator >::sibling_iterator::operator==(), tree< T, tree_node_allocator >::pre_order_iterator::operator==(), tree< T, tree_node_allocator >::post_order_iterator::operator==(), tree< T, tree_node_allocator >::post_order_iterator::post_order_iterator(), tree< T, tree_node_allocator >::pre_order_iterator::pre_order_iterator(), tree< T, tree_node_allocator >::reparent(), tree< T, tree_node_allocator >::replace(), tree< T, tree_node_allocator >::fixed_depth_iterator::set_first_parent_(), tree< T, tree_node_allocator >::sibling_iterator::set_parent_(), tree< T, tree_node_allocator >::sort(), and tree< T, tree_node_allocator >::swap().

template<class T, class tree_node_allocator = std::allocator<tree_node_<T> >>
bool tree< T, tree_node_allocator >::iterator_base::skip_current_children_ [protected]

Definition at line 157 of file tree.h.

Referenced by tree< T, tree_node_allocator >::post_order_iterator::operator++(), tree< T, tree_node_allocator >::pre_order_iterator::operator++(), tree< T, tree_node_allocator >::post_order_iterator::operator--(), and tree< T, tree_node_allocator >::iterator_base::skip_children().


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