Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_RB_Tree_Iterator Class Template Reference

Implements an iterator for a Red-Black Tree ADT. More...

#include <RB_Tree.h>

Inheritance diagram for ACE_RB_Tree_Iterator:

Inheritance graph
[legend]
Collaboration diagram for ACE_RB_Tree_Iterator:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_RB_Tree_Iterator (void)
 ACE_RB_Tree_Iterator (const ACE_RB_Tree< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK > &tree, int set_first=1)
 ACE_RB_Tree_Iterator (const ACE_RB_Tree< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK > &tree, ACE_RB_Tree_Node< EXT_ID, INT_ID > *entry)
 ACE_RB_Tree_Iterator (const EXT_ID &key, ACE_RB_Tree< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK > &tree)
 ~ACE_RB_Tree_Iterator (void)
 Destructor. More...

int advance (void)
 Move forward by one element in the tree. Returns 0 when all elements have been seen, else 1. More...

void dump (void) const
 Dump the state of an object. More...

ACE_RB_Tree_Iterator< EXT_ID,
INT_ID, COMPARE_KEYS, ACE_LOCK > & 
operator++ (void)
 Prefix advance. More...

ACE_RB_Tree_Iterator< EXT_ID,
INT_ID, COMPARE_KEYS, ACE_LOCK > 
operator++ (int)
 Postfix advance. More...

ACE_RB_Tree_Iterator< EXT_ID,
INT_ID, COMPARE_KEYS, ACE_LOCK > & 
operator-- (void)
 Prefix reverse. More...

ACE_RB_Tree_Iterator< EXT_ID,
INT_ID, COMPARE_KEYS, ACE_LOCK > 
operator-- (int)
 Postfix reverse. More...

int next (ACE_RB_Tree_Node< EXT_ID, INT_ID > *&next_entry) const
EXT_ID * key (void)
 
Deprecated:
Accessor for key of node under iterator (if any).
More...


INT_ID * item (void)
 
Deprecated:
Accessor for item of node under iterator (if any).
More...


int first (void)
 
Deprecated:
Move to the first item in the iteration (and in the tree).
More...


int last (void)
 
Deprecated:
Move to the last item in the iteration (and in the tree).
More...


int next (void)
 
Deprecated:
Move to the next item in the iteration (and in the tree).
More...


int previous (void)
 
Deprecated:
Move to the previous item in the iteration (and in the tree).
More...


int is_done (void)

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Detailed Description

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
class ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >

Implements an iterator for a Red-Black Tree ADT.

Definition at line 652 of file RB_Tree.h.


Constructor & Destructor Documentation

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::ACE_RB_Tree_Iterator void   
 

Create the singular iterator. It is illegal to deference the iterator, no valid iterator is equal to a singular iterator, etc. etc.

Definition at line 841 of file RB_Tree.i.

References ACE_TRACE.

00842   : ACE_RB_Tree_Iterator_Base<EXT_ID,INT_ID,COMPARE_KEYS,ACE_LOCK> ()
00843 {
00844   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree_Iterator (void)");
00845 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::ACE_RB_Tree_Iterator const ACE_RB_Tree< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK > &    tree,
int    set_first = 1
 

Constructor. Takes an ACE_RB_Tree over which to iterate, and an integer indicating (if non-zero) to position the iterator at the first element in the tree (if this integer is 0, the iterator is positioned at the last element in the tree).

Definition at line 1062 of file RB_Tree.cpp.

References ACE_TRACE.

01064   : ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> (tree, set_first)
01065 {
01066   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree_Iterator");
01067 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::ACE_RB_Tree_Iterator const ACE_RB_Tree< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK > &    tree,
ACE_RB_Tree_Node< EXT_ID, INT_ID > *    entry
 

Constructor. Takes an ACE_RB_Tree over which to iterate and a pointer to a node in the tree.

Definition at line 1070 of file RB_Tree.cpp.

References ACE_TRACE.

01072   : ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> (tree,entry)
01073 {
01074   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree_Iterator");
01075 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::ACE_RB_Tree_Iterator const EXT_ID &    key,
ACE_RB_Tree< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK > &    tree
 

Constructor. Takes an ACE_RB_Tree over which to iterate, and a key; the key comes first in order to distinguish the case of EXT_ID == int.

Definition at line 1078 of file RB_Tree.cpp.

References ACE_TRACE.

01079   : ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>(key,tree)
01080 {
01081   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree_Iterator");
01082 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::~ACE_RB_Tree_Iterator void   
 

Destructor.

Definition at line 1087 of file RB_Tree.cpp.

References ACE_TRACE.

01088 {
01089   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::~ACE_RB_Tree_Iterator");
01090 }


Member Function Documentation

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::advance void   
 

Move forward by one element in the tree. Returns 0 when all elements have been seen, else 1.

Definition at line 852 of file RB_Tree.i.

References ACE_TRACE, and ACE_RB_Tree_Iterator_Base::forward_i.

00853 {
00854   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::advance");
00855 
00856   return this->forward_i ();
00857 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE void ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::dump void    const
 

Dump the state of an object.

Definition at line 864 of file RB_Tree.i.

References ACE_TRACE, and ACE_RB_Tree_Iterator_Base::dump_i.

00865 {
00866   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::dump");
00867 
00868   this->dump_i ();
00869 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::first void   
 

Deprecated:
Move to the first item in the iteration (and in the tree).

Definition at line 978 of file RB_Tree.i.

References ACE_TRACE, ACE_RB_Tree_Iterator_Base::node_, and ACE_RB_Tree_Iterator_Base::tree_.

Referenced by ACE_RB_Tree::ACE_RB_Tree, and ACE_RB_Tree::operator=.

00979 {
00980   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::first");
00981   this->node_ = this->tree_->RB_tree_minimum (this->tree_->root_);
00982   return this->node_ ? 1 : 0;
00983 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::is_done void   
 

@deprecated: use the base class <done> method instead. Returns 0 if the iterator is positioned over a valid ACE_RB_Tree node, returns 1 if not.

Definition at line 1029 of file RB_Tree.i.

References ACE_TRACE, and ACE_RB_Tree_Iterator_Base::node_.

Referenced by ACE_RB_Tree::ACE_RB_Tree, and ACE_RB_Tree::operator=.

01030 {
01031   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::is_done");
01032   return this->node_ ? 0 : 1;
01033 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE INT_ID * ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::item void   
 

Deprecated:
Accessor for item of node under iterator (if any).

Definition at line 967 of file RB_Tree.i.

References ACE_TRACE, and ACE_RB_Tree_Iterator_Base::node_.

Referenced by ACE_RB_Tree::ACE_RB_Tree, and ACE_RB_Tree::operator=.

00968 {
00969   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::item");
00970   return this->node_ ? (&(this->node_->item ())) : 0;
00971 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE EXT_ID * ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::key void   
 

Deprecated:
Accessor for key of node under iterator (if any).

Definition at line 956 of file RB_Tree.i.

References ACE_TRACE, and ACE_RB_Tree_Iterator_Base::node_.

Referenced by ACE_RB_Tree::ACE_RB_Tree, and ACE_RB_Tree::operator=.

00957 {
00958   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::key");
00959   return this->node_ ? (&(this->node_->key ())) : 0;
00960 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::last void   
 

Deprecated:
Move to the last item in the iteration (and in the tree).

Definition at line 990 of file RB_Tree.i.

References ACE_TRACE, ACE_RB_Tree_Iterator_Base::node_, and ACE_RB_Tree_Iterator_Base::tree_.

00991 {
00992   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::last");
00993   this->node_ = this->tree_->RB_tree_maximum (this->tree_->root_);
00994   return this->node_ ? 1 : 0;
00995 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::next void   
 

Deprecated:
Move to the next item in the iteration (and in the tree).

Definition at line 1003 of file RB_Tree.i.

References ACE_TRACE, ACE_RB_Tree_Iterator_Base::node_, and ACE_RB_Tree_Iterator_Base::tree_.

01004 {
01005   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::next");
01006   this->node_ = this->tree_->RB_tree_successor (this->node_);
01007   return this->node_ ? 1 : 0;
01008 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::next ACE_RB_Tree_Node< EXT_ID, INT_ID > *&    next_entry const
 

Passes back the <entry> under the iterator. Returns 0 if the iteration has completed, otherwise 1. This method must be declared and defined in both the derived forward and reverse iterator classes rather than in the base iterator class because of a method signature resolution problem caused by the existence of the deprecated next (void) method in the derived forward iterator class. When that deprecated method is removed, this method should be removed from the derived classes and placed in the base class.

Definition at line 938 of file RB_Tree.i.

References ACE_TRACE, and ACE_RB_Tree_Iterator_Base::node_.

Referenced by ACE_RB_Tree::ACE_RB_Tree, and ACE_RB_Tree::operator=.

00939 {
00940   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::next");
00941 
00942   if (this->node_)
00943     {
00944       next_entry = this->node_;
00945       return 1;
00946     }
00947 
00948   return 0;
00949 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK > ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::operator++ int   
 

Postfix advance.

Definition at line 889 of file RB_Tree.i.

References ACE_TRACE, and ACE_RB_Tree_Iterator_Base::forward_i.

00890 {
00891   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> operator++ (int)");
00892 
00893   ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> retv (*this);
00894   this->forward_i ();
00895   return retv;
00896 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK > & ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::operator++ void   
 

Prefix advance.

Definition at line 876 of file RB_Tree.i.

References ACE_TRACE, and ACE_RB_Tree_Iterator_Base::forward_i.

00877 {
00878   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> operator++ (void)");
00879 
00880   this->forward_i ();
00881   return *this;
00882 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK > ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::operator-- int   
 

Postfix reverse.

Definition at line 916 of file RB_Tree.i.

References ACE_TRACE, and ACE_RB_Tree_Iterator_Base::reverse_i.

00917 {
00918   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> operator-- (int)");
00919 
00920   ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> retv (*this);
00921   this->reverse_i ();
00922   return retv;
00923 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK > & ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::operator-- void   
 

Prefix reverse.

Definition at line 903 of file RB_Tree.i.

References ACE_TRACE, and ACE_RB_Tree_Iterator_Base::reverse_i.

00904 {
00905   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> operator-- (void)");
00906 
00907   this->reverse_i ();
00908   return *this;
00909 }

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_INLINE int ACE_RB_Tree_Iterator< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::previous void   
 

Deprecated:
Move to the previous item in the iteration (and in the tree).

Definition at line 1016 of file RB_Tree.i.

References ACE_TRACE, ACE_RB_Tree_Iterator_Base::node_, and ACE_RB_Tree_Iterator_Base::tree_.

01017 {
01018   ACE_TRACE ("ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::previous");
01019   this->node_ = this->tree_->RB_tree_predecessor (this->node_);
01020   return this->node_ ? 1 : 0;
01021 }


Member Data Documentation

template<class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
ACE_RB_Tree_Iterator::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_RB_Tree_Iterator_Base.

Definition at line 714 of file RB_Tree.h.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:54:42 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002