ACE_Unbounded_Set_Const_Iterator< T > Class Template Reference

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

#include <Unbounded_Set.h>

List of all members.

Public Member Functions

 ACE_Unbounded_Set_Const_Iterator (const ACE_Unbounded_Set< T > &s, int end=0)
int next (T *&next_item)
int advance (void)
int first (void)
int done (void) const
 Returns 1 when all items have been seen, else 0.

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

ACE_Unbounded_Set_Const_Iterator<
T > 
operator++ (int)
 Postfix advance.

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

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

bool operator== (const ACE_Unbounded_Set_Const_Iterator< T > &) const
 Check if two iterators point to the same position.

bool operator!= (const ACE_Unbounded_Set_Const_Iterator< T > &) const

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Private Attributes

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

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


Detailed Description

template<class T>
class ACE_Unbounded_Set_Const_Iterator< T >

Implement an const iterator over an unbounded set.

Definition at line 93 of file Unbounded_Set.h.


Constructor & Destructor Documentation

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

Definition at line 370 of file Unbounded_Set.cpp.

00371   : current_ (end == 0 ? s.head_->next_ : s.head_ ),
00372     set_ (&s)
00373 {
00374   // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::ACE_Unbounded_Set_Const_Iterator");
00375 }


Member Function Documentation

template<class T>
int ACE_Unbounded_Set_Const_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 378 of file Unbounded_Set.cpp.

Referenced by ACE_Unbounded_Set_Const_Iterator< T >::operator++().

00379 {
00380   // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::advance");
00381   this->current_ = this->current_->next_;
00382   return this->current_ != this->set_->head_;
00383 }

template<class T>
int ACE_Unbounded_Set_Const_Iterator< T >::done void   )  const
 

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

Definition at line 394 of file Unbounded_Set.cpp.

References ACE_TRACE.

00395 {
00396   ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::done");
00397 
00398   return this->current_ == this->set_->head_;
00399 }

template<class T>
void ACE_Unbounded_Set_Const_Iterator< T >::dump void   )  const
 

Dump the state of an object.

Definition at line 362 of file Unbounded_Set.cpp.

00363 {
00364 #if defined (ACE_HAS_DUMP)
00365   // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::dump");
00366 #endif /* ACE_HAS_DUMP */
00367 }

template<class T>
int ACE_Unbounded_Set_Const_Iterator< T >::first void   ) 
 

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

Definition at line 386 of file Unbounded_Set.cpp.

00387 {
00388   // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::first");
00389   this->current_ = this->set_->head_->next_;
00390   return this->current_ != this->set_->head_;
00391 }

template<class T>
int ACE_Unbounded_Set_Const_Iterator< T >::next T *&  next_item  ) 
 

Pass back the next_item that hasn't been seen in the Set.

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

Definition at line 402 of file Unbounded_Set.cpp.

Referenced by ACE_Unbounded_Set_Const_Iterator< T >::operator *().

00403 {
00404   // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::next");
00405   if (this->current_ == this->set_->head_)
00406     return 0;
00407   else
00408     {
00409       item = &this->current_->item_;
00410       return 1;
00411     }
00412 }

template<class T>
T & ACE_Unbounded_Set_Const_Iterator< T >::operator * void   ) 
 

Returns a reference to the internal element is pointing to.

Definition at line 438 of file Unbounded_Set.cpp.

References ACE_ASSERT, and ACE_Unbounded_Set_Const_Iterator< T >::next().

00439 {
00440   //ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::operator*");
00441   T *retv = 0;
00442 
00443   int const result = this->next (retv);
00444   ACE_ASSERT (result != 0);
00445   ACE_UNUSED_ARG (result);
00446 
00447   return *retv;
00448 }

template<class T>
bool ACE_Unbounded_Set_Const_Iterator< T >::operator!= const ACE_Unbounded_Set_Const_Iterator< T > &   )  const
 

template<class T>
ACE_Unbounded_Set_Const_Iterator< T > & ACE_Unbounded_Set_Const_Iterator< T >::operator++ void   ) 
 

Prefix advance.

Definition at line 427 of file Unbounded_Set.cpp.

References ACE_Unbounded_Set_Const_Iterator< T >::advance().

00428 {
00429   // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::operator++ (void)");
00430 
00431   // prefix operator
00432 
00433   this->advance ();
00434   return *this;
00435 }

template<class T>
ACE_Unbounded_Set_Const_Iterator< T > ACE_Unbounded_Set_Const_Iterator< T >::operator++ int   ) 
 

Postfix advance.

Definition at line 415 of file Unbounded_Set.cpp.

References ACE_Unbounded_Set_Const_Iterator< T >::advance().

00416 {
00417   //ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::operator++ (int)");
00418   ACE_Unbounded_Set_Const_Iterator<T> retv (*this);
00419 
00420   // postfix operator
00421 
00422   this->advance ();
00423   return retv;
00424 }

template<class T>
bool ACE_Unbounded_Set_Const_Iterator< T >::operator== const ACE_Unbounded_Set_Const_Iterator< T > &   )  const
 

Check if two iterators point to the same position.


Member Data Documentation

template<class T>
ACE_Unbounded_Set_Const_Iterator< T >::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Definition at line 135 of file Unbounded_Set.h.

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

Pointer to the current node in the iteration.

Definition at line 140 of file Unbounded_Set.h.

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

Pointer to the set we're iterating over.

Definition at line 143 of file Unbounded_Set.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:32:12 2006 for ACE by doxygen 1.3.6