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

ACE_Unbounded_Set_Iterator Class Template Reference

Implement an iterator over an unbounded set. More...

#include <Unbounded_Set.h>

Collaboration diagram for ACE_Unbounded_Set_Iterator:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Unbounded_Set_Iterator (ACE_Unbounded_Set< T > &s, int end=0)
int next (T *&next_item)
 Pass back the <next_item> that hasn't been seen in the Set. Returns 0 when all items have been seen, else 1. More...

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

int first (void)
 Move to the first element in the set. Returns 0 if the set is empty, else 1. More...

int done (void) const
 Returns 1 when all items have been seen, else 0. More...

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

ACE_Unbounded_Set_Iterator<
T > 
operator++ (int)
 Postfix advance. More...

ACE_Unbounded_Set_Iterator<
T > & 
operator++ (void)
 Prefix advance. More...

T & operator * (void)
 Returns a reference to the internal element <this> is pointing to. More...

int operator== (const ACE_Unbounded_Set_Iterator< T > &) const
 Check if two iterators point to the same position. More...

int operator!= (const ACE_Unbounded_Set_Iterator< T > &) const

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Private Attributes

ACE_Node< T > * current_
 Pointer to the current node in the iteration. More...

ACE_Unbounded_Set< T > * set_
 Pointer to the set we're iterating over. More...


Detailed Description

template<class T>
class ACE_Unbounded_Set_Iterator< T >

Implement an iterator over an unbounded set.

Definition at line 31 of file Unbounded_Set.h.


Constructor & Destructor Documentation

template<class T>
ACE_Unbounded_Set_Iterator< T >::ACE_Unbounded_Set_Iterator ACE_Unbounded_Set< T > &    s,
int    end = 0
 

Definition at line 260 of file Unbounded_Set.cpp.

00261   : current_ (end == 0 ? s.head_->next_ : s.head_ ),
00262     set_ (&s)
00263 {
00264   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::ACE_Unbounded_Set_Iterator");
00265 }


Member Function Documentation

template<class T>
int ACE_Unbounded_Set_Iterator< T >::advance void   
 

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

Definition at line 268 of file Unbounded_Set.cpp.

References current_, and set_.

Referenced by ACE_Unbounded_Set::dump, ACE_Registry_Name_Space::list_names, ACE_Registry_Name_Space::list_values, ACE_Service_Config::load_static_svcs, operator++, ACE_Static_Function_Node::symbol, and ACE_Timer_Heap_T::~ACE_Timer_Heap_T.

00269 {
00270   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::advance");
00271   this->current_ = this->current_->next_;
00272   return this->current_ != this->set_->head_;
00273 }

template<class T>
int ACE_Unbounded_Set_Iterator< T >::done void    const
 

Returns 1 when all items have been seen, else 0.

Definition at line 284 of file Unbounded_Set.cpp.

References ACE_TRACE, current_, and set_.

00285 {
00286   ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::done");
00287 
00288   return this->current_ == this->set_->head_;
00289 }

template<class T>
void ACE_Unbounded_Set_Iterator< T >::dump void    const
 

Dump the state of an object.

Definition at line 254 of file Unbounded_Set.cpp.

00255 {
00256   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::dump");
00257 }

template<class T>
int ACE_Unbounded_Set_Iterator< T >::first void   
 

Move to the first element in the set. Returns 0 if the set is empty, else 1.

Definition at line 276 of file Unbounded_Set.cpp.

References current_, and set_.

00277 {
00278   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::first");
00279   this->current_ = this->set_->head_->next_;
00280   return this->current_ != this->set_->head_;
00281 }

template<class T>
int ACE_Unbounded_Set_Iterator< T >::next T *&    next_item
 

Pass back the <next_item> that hasn't been seen in the Set. Returns 0 when all items have been seen, else 1.

Definition at line 292 of file Unbounded_Set.cpp.

References current_, and set_.

Referenced by ACE_Unbounded_Set::dump, ACE_Registry_Name_Space::list_names, ACE_Registry_Name_Space::list_values, ACE_Service_Config::load_static_svcs, operator *, ACE_Static_Function_Node::symbol, and ACE_Timer_Heap_T::~ACE_Timer_Heap_T.

00293 {
00294   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::next");
00295   if (this->current_ == this->set_->head_)
00296     return 0;
00297   else
00298     {
00299       item = &this->current_->item_;
00300       return 1;
00301     }
00302 }

template<class T>
T & ACE_Unbounded_Set_Iterator< T >::operator * void   
 

Returns a reference to the internal element <this> is pointing to.

Definition at line 328 of file Unbounded_Set.cpp.

References ACE_ASSERT, and next.

00329 {
00330   //ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::operator*");
00331   T *retv = 0;
00332 
00333   int result = this->next (retv);
00334   ACE_ASSERT (result != 0);
00335   ACE_UNUSED_ARG (result);
00336 
00337   return *retv;
00338 }

template<class T>
int ACE_Unbounded_Set_Iterator< T >::operator!= const ACE_Unbounded_Set_Iterator< T > &    const
 

Definition at line 348 of file Unbounded_Set.cpp.

References current_, and set_.

00349 {
00350   //ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::operator!=");
00351   return (this->set_ != rhs.set_ || this->current_ != rhs.current_);
00352 }

template<class T>
ACE_Unbounded_Set_Iterator< T > & ACE_Unbounded_Set_Iterator< T >::operator++ void   
 

Prefix advance.

Definition at line 317 of file Unbounded_Set.cpp.

References advance.

00318 {
00319   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::operator++ (void)");
00320 
00321   // prefix operator
00322 
00323   this->advance ();
00324   return *this;
00325 }

template<class T>
ACE_Unbounded_Set_Iterator< T > ACE_Unbounded_Set_Iterator< T >::operator++ int   
 

Postfix advance.

Definition at line 305 of file Unbounded_Set.cpp.

References advance.

00306 {
00307   //ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::operator++ (int)");
00308   ACE_Unbounded_Set_Iterator<T> retv (*this);
00309 
00310   // postfix operator
00311 
00312   this->advance ();
00313   return retv;
00314 }

template<class T>
int ACE_Unbounded_Set_Iterator< T >::operator== const ACE_Unbounded_Set_Iterator< T > &    const
 

Check if two iterators point to the same position.

Definition at line 341 of file Unbounded_Set.cpp.

References current_, and set_.

00342 {
00343   //ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::operator==");
00344   return (this->set_ == rhs.set_ && this->current_ == rhs.current_);
00345 }


Member Data Documentation

template<class T>
ACE_Unbounded_Set_Iterator::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Definition at line 73 of file Unbounded_Set.h.

template<class T>
ACE_Node<T>* ACE_Unbounded_Set_Iterator::current_ [private]
 

Pointer to the current node in the iteration.

Definition at line 78 of file Unbounded_Set.h.

Referenced by advance, done, first, next, operator!=, and operator==.

template<class T>
ACE_Unbounded_Set<T>* ACE_Unbounded_Set_Iterator::set_ [private]
 

Pointer to the set we're iterating over.

Definition at line 81 of file Unbounded_Set.h.

Referenced by advance, done, first, next, operator!=, and operator==.


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