iterator Class Reference

#include <iterator.h>

Inheritance diagram for iterator:

Inheritance graph
[legend]
List of all members.

Detailed Description

An iterator that can be used to modify the tree. Most of the methods provided by this class perform actions relative to the current position of the iterator.

Definition at line 35 of file iterator.h.

Public Types

typedef std::bidirectional_iterator_tag iterator_category
typedef T value_type
typedef R reference
typedef P pointer
typedef size_t size_type
typedef ptrdiff_t difference_type

Public Member Functions

 iterator (void)
 iterator (const iterator &iter)
 operator const_iterator () const
super::reference operator * (void) const
super::pointer operator-> (void) const
iterator absorb_after (tree< N > *t)
iterator absorb_back (tree< N > *t)
iterator absorb_before (tree< N > *t)
iterator absorb_front (tree< N > *t)
sibling_iterator beginChildren (void) const
void clear (void)
sibling_iterator endChildren (void) const
iterator erase (void)
iterator insert (const N &data)
iterator insert (const tree< N > &t)
iterator insert_after (const N &data)
iterator insert_after (const tree< N > &t)
iterator parent (void) const
void pop_back (void)
void pop_front (void)
iterator push_back (const N &data)
iterator push_back (const tree< N > &t)
iterator push_front (const N &data)
iterator push_front (const tree< N > &t)
replace (const N &data)
size_t size (void) const
iterator splice_after (tree< N > &t)
iterator splice_back (tree< N > &t)
iterator splice_before (tree< N > &t)
iterator splice_front (tree< N > &t)
bool operator== (const tree_iterator &iter) const
bool operator!= (const tree_iterator &iter) const
long depth (void) const
bool leaf (void) const

Protected Member Functions

 iterator (tree_node< N > *current)
void destroy (void)

Static Protected Member Functions

static void post_inc (tree_node< N > *&current, long &depth)
static void post_dec (tree_node< N > *&current, long &depth)
static void pre_inc (tree_node< N > *&current, long &depth)
static void pre_dec (tree_node< N > *&current, long &depth)
static void sib_inc (tree_node< N > *&current)
static void sib_dec (tree_node< N > *&current)

Protected Attributes

tree_node< N > * current
long iter_depth

Private Types

typedef tree_iterator< N,
N &, N * > 
super

Friends

class tree


Member Typedef Documentation

template<class T, class R, class P>
typedef ptrdiff_t tree_iterator< T, R, P >::difference_type [inherited]

Definition at line 92 of file tree_iterator.h.

template<class T, class R, class P>
typedef std::bidirectional_iterator_tag tree_iterator< T, R, P >::iterator_category [inherited]

Definition at line 87 of file tree_iterator.h.

template<class T, class R, class P>
typedef P tree_iterator< T, R, P >::pointer [inherited]

Definition at line 90 of file tree_iterator.h.

template<class T, class R, class P>
typedef R tree_iterator< T, R, P >::reference [inherited]

Definition at line 89 of file tree_iterator.h.

template<class T, class R, class P>
typedef size_t tree_iterator< T, R, P >::size_type [inherited]

Definition at line 91 of file tree_iterator.h.

typedef tree_iterator<N, N&, N*> iterator::super [private]

Definition at line 42 of file iterator.h.

template<class T, class R, class P>
typedef T tree_iterator< T, R, P >::value_type [inherited]

Definition at line 88 of file tree_iterator.h.


Constructor & Destructor Documentation

iterator::iterator ( tree_node< N > *  current  )  [inline, protected]

Definition at line 46 of file iterator.h.

iterator::iterator ( void   )  [inline]

Creates an iterator that doesn't point to anything yet.

Definition at line 51 of file iterator.h.

Referenced by beginChildren(), and endChildren().

iterator::iterator ( const iterator iter  )  [inline]

Copy constructor

Definition at line 54 of file iterator.h.


Member Function Documentation

iterator iterator::absorb_after ( tree< N > *  t  )  [inline]

Identical to the splice_after method except deletes the tree after performing the splice.

Returns:
An iterator pointing to the root of the absorbed tree.

Definition at line 74 of file iterator.h.

References splice_after().

Here is the call graph for this function:

iterator iterator::absorb_back ( tree< N > *  t  )  [inline]

Identical to the splice_back method except deletes the tree after performing the splice.

Returns:
An iterator pointing to the root of the absorbed tree.

Definition at line 89 of file iterator.h.

References splice_back().

Here is the call graph for this function:

iterator iterator::absorb_before ( tree< N > *  t  )  [inline]

Identical to the splice_before method except deletes the tree after performing the splice.

Returns:
An iterator pointing to the root of the absorbed tree.

Definition at line 111 of file iterator.h.

References splice_before().

Here is the call graph for this function:

iterator iterator::absorb_front ( tree< N > *  t  )  [inline]

Identical to the splice_front method except deletes the tree after performing the splice.

Returns:
An iterator pointing to the root of the absorbed tree.

Definition at line 126 of file iterator.h.

References splice_front().

Here is the call graph for this function:

sibling_iterator iterator::beginChildren ( void   )  const [inline]

Definition at line 136 of file iterator.h.

References iterator().

Here is the call graph for this function:

void iterator::clear ( void   ) 

Removes all children and grandchildren of this node

template<class T, class R, class P>
long tree_iterator< T, R, P >::depth ( void   )  const [inline, inherited]

Definition at line 107 of file tree_iterator.h.

template<class T, class R, class P>
void tree_iterator< T, R, P >::destroy ( void   )  [inline, protected, inherited]

Destroys the node pointed to by this iterator.

Definition at line 63 of file tree_iterator.h.

sibling_iterator iterator::endChildren ( void   )  const [inline]

Definition at line 143 of file iterator.h.

References iterator().

Here is the call graph for this function:

iterator iterator::erase ( void   ) 

Removes this node and returns an iterator pointing to the next node.

iterator iterator::insert ( const tree< N > &  t  ) 

iterator iterator::insert ( const N &  data  ) 

Inserts a new node before this node and returns an iterator pointing to the new node.

iterator iterator::insert_after ( const tree< N > &  t  ) 

iterator iterator::insert_after ( const N &  data  ) 

Inserts a new node after this node and returns an iterator pointing to the new node.

template<class T, class R, class P>
bool tree_iterator< T, R, P >::leaf ( void   )  const [inline, inherited]

Definition at line 109 of file tree_iterator.h.

super::reference iterator::operator * ( void   )  const [inline]

Definition at line 64 of file iterator.h.

References tree_iterator< T, R, P >::current, and tree_node< T >::data.

iterator::operator const_iterator (  )  const [inline]

Converts an iterator to a const_iterator. This conversion is one-way; const_iterator does not have a corresponding conversion function to iterator.

Definition at line 60 of file iterator.h.

template<class T, class R, class P>
bool tree_iterator< T, R, P >::operator!= ( const tree_iterator< T, R, P > &  iter  )  const [inline, inherited]

Definition at line 104 of file tree_iterator.h.

super::pointer iterator::operator-> ( void   )  const [inline]

Definition at line 67 of file iterator.h.

References tree_iterator< T, R, P >::current, and tree_node< T >::data.

template<class T, class R, class P>
bool tree_iterator< T, R, P >::operator== ( const tree_iterator< T, R, P > &  iter  )  const [inline, inherited]

Definition at line 101 of file tree_iterator.h.

iterator iterator::parent ( void   )  const [inline]

Definition at line 162 of file iterator.h.

References tree_iterator< T, R, P >::current, and tree_node< T >::parent.

void iterator::pop_back ( void   ) 

Removes the last child of this node.

void iterator::pop_front ( void   ) 

Removes the first child of this node.

template<class T, class R, class P>
static void tree_iterator< T, R, P >::post_dec ( tree_node< N > *&  current,
long &  depth 
) [inline, static, protected, inherited]

Referenced by postorder_iterator::operator--(), and const_postorder_iterator::operator--().

template<class T, class R, class P>
static void tree_iterator< T, R, P >::post_inc ( tree_node< N > *&  current,
long &  depth 
) [inline, static, protected, inherited]

Referenced by postorder_iterator::operator++(), and const_postorder_iterator::operator++().

template<class T, class R, class P>
static void tree_iterator< T, R, P >::pre_dec ( tree_node< N > *&  current,
long &  depth 
) [inline, static, protected, inherited]

Referenced by preorder_iterator::operator--(), and const_preorder_iterator::operator--().

template<class T, class R, class P>
static void tree_iterator< T, R, P >::pre_inc ( tree_node< N > *&  current,
long &  depth 
) [inline, static, protected, inherited]

Referenced by preorder_iterator::operator++(), and const_preorder_iterator::operator++().

iterator iterator::push_back ( const tree< N > &  t  ) 

Adds a copy of a tree to the end of this position's child list.

Parameters:
t The tree to copy.
Returns:
An iterator pointing to the root of the inserted subtree.

iterator iterator::push_back ( const N &  data  ) 

Adds a node to the end of this position's child list.

Parameters:
data Data for the new node.
Returns:
An iterator pointing to the new node.

Referenced by G4VisCommandSceneAddVolume::SetNewValue().

iterator iterator::push_front ( const tree< N > &  t  ) 

Adds a copy of a tree to the beginning of this position's child list.

Parameters:
t The tree to copy.
Returns:
An iterator pointing to the root of the inserted subtree.

iterator iterator::push_front ( const N &  data  ) 

Adds a node to the beginning of this position's child list.

Parameters:
data Data for the new node.
Returns:
An iterator pointing to the new node.

N iterator::replace ( const N &  data  ) 

Replaces the data at this position.

Parameters:
data The new data.
Returns:
The old data.

template<class T, class R, class P>
static void tree_iterator< T, R, P >::sib_dec ( tree_node< N > *&  current  )  [inline, static, protected, inherited]

Referenced by sibling_iterator::operator--(), const_sibling_iterator::operator--(), and sibling_iterator::operator-=().

template<class T, class R, class P>
static void tree_iterator< T, R, P >::sib_inc ( tree_node< N > *&  current  )  [inline, static, protected, inherited]

Referenced by sibling_iterator::operator++(), const_sibling_iterator::operator++(), and sibling_iterator::operator+=().

size_t iterator::size ( void   )  const

Determines the size of the subtree below and including this position.

Returns:
The size of this subtree.

iterator iterator::splice_after ( tree< N > &  t  ) 

Moves nodes from a tree (without copying) such that the tree becomes the next sibling of this node.

Parameters:
t The tree to move. It will be empty after this method returns.
Returns:
An iterator pointing to the root of the spliced tree.

Referenced by absorb_after().

iterator iterator::splice_back ( tree< N > &  t  ) 

Moves nodes from a tree (without copying) such that the tree becomes the last child of this node.

Parameters:
t The tree to move. It will be empty after this method returns.
Returns:
An iterator pointing to the root of the spliced tree.

Referenced by absorb_back().

iterator iterator::splice_before ( tree< N > &  t  ) 

Moves nodes from a tree (without copying) such that the tree becomes the previous child of this node.

Parameters:
t The tree to move. It will be empty after this method returns.
Returns:
An iterator pointing to the root of the spliced tree.

Referenced by absorb_before().

iterator iterator::splice_front ( tree< N > &  t  ) 

Moves nodes from a tree (without copying) such that the tree becomes the first child of this node.

Parameters:
t The tree to move. It will be empty after this method returns.
Returns:
An iterator pointing to the root of the spliced tree.

Referenced by absorb_front().


Friends And Related Function Documentation

friend class tree [friend]

Reimplemented from tree_iterator< T, R, P >.

Reimplemented in bfs_iterator, postorder_iterator, preorder_iterator, and sibling_iterator.

Definition at line 37 of file iterator.h.


Member Data Documentation

template<class T, class R, class P>
tree_node<N>* tree_iterator< T, R, P >::current [protected, inherited]

Definition at line 41 of file tree_iterator.h.

Referenced by tree_iterator< const const N, N &, N * >::destroy(), operator *(), const_iterator::operator *(), tree_iterator< const const N, N &, N * >::operator!=(), const_bfs_iterator::operator++(), bfs_iterator::operator++(), operator->(), const_iterator::operator->(), tree_iterator< const const N, N &, N * >::operator==(), parent(), const_iterator::parent(), and const_preorder_iterator::prune().

template<class T, class R, class P>
long tree_iterator< T, R, P >::iter_depth [protected, inherited]

Definition at line 46 of file tree_iterator.h.

Referenced by tree_iterator< const const N, N &, N * >::depth(), tree_iterator< const const N, N &, N * >::destroy(), and const_preorder_iterator::prune().


The documentation for this class was generated from the following file:
Generated on Sat Apr 12 06:58:31 2008 for Geant4 by  doxygen 1.4.7