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, bool end=false)
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 this 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,
bool  end = false
 

Definition at line 380 of file Unbounded_Set.cpp.

00383   : current_ (!end ? s.head_->next_ : s.head_ ),
00384     set_ (&s)
00385 {
00386   // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::ACE_Unbounded_Set_Const_Iterator");
00387 }


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 390 of file Unbounded_Set.cpp.

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

00391 {
00392   // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::advance");
00393   this->current_ = this->current_->next_;
00394   return this->current_ != this->set_->head_;
00395 }

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 406 of file Unbounded_Set.cpp.

References ACE_TRACE.

00407 {
00408   ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::done");
00409 
00410   return this->current_ == this->set_->head_;
00411 }

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

Dump the state of an object.

Definition at line 372 of file Unbounded_Set.cpp.

00373 {
00374 #if defined (ACE_HAS_DUMP)
00375   // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::dump");
00376 #endif /* ACE_HAS_DUMP */
00377 }

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 398 of file Unbounded_Set.cpp.

00399 {
00400   // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::first");
00401   this->current_ = this->set_->head_->next_;
00402   return this->current_ != this->set_->head_;
00403 }

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 414 of file Unbounded_Set.cpp.

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

00415 {
00416   // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::next");
00417   if (this->current_ == this->set_->head_)
00418     return 0;
00419   else
00420     {
00421       item = &this->current_->item_;
00422       return 1;
00423     }
00424 }

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

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

Definition at line 450 of file Unbounded_Set.cpp.

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

00451 {
00452   //ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::operator*");
00453   T *retv = 0;
00454 
00455   int const result = this->next (retv);
00456   ACE_ASSERT (result != 0);
00457   ACE_UNUSED_ARG (result);
00458 
00459   return *retv;
00460 }

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

Definition at line 470 of file Unbounded_Set.cpp.

References ACE_Unbounded_Set_Const_Iterator< T >::current_, and ACE_Unbounded_Set_Const_Iterator< T >::set_.

00471 {
00472   //ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::operator!=");
00473   return (this->set_ != rhs.set_ || this->current_ != rhs.current_);
00474 }

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

Prefix advance.

Definition at line 439 of file Unbounded_Set.cpp.

References ACE_Unbounded_Set_Const_Iterator< T >::advance().

00440 {
00441   // ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::operator++ (void)");
00442 
00443   // prefix operator
00444 
00445   this->advance ();
00446   return *this;
00447 }

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

Postfix 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++ (int)");
00430   ACE_Unbounded_Set_Const_Iterator<T> retv (*this);
00431 
00432   // postfix operator
00433 
00434   this->advance ();
00435   return retv;
00436 }

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.

Definition at line 463 of file Unbounded_Set.cpp.

References ACE_Unbounded_Set_Const_Iterator< T >::current_, and ACE_Unbounded_Set_Const_Iterator< T >::set_.

00464 {
00465   //ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::operator==");
00466   return (this->set_ == rhs.set_ && this->current_ == rhs.current_);
00467 }


Member Data Documentation

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

Declare the dynamic allocation hooks.

Definition at line 136 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 141 of file Unbounded_Set.h.

Referenced by ACE_Unbounded_Set_Const_Iterator< T >::operator!=(), and ACE_Unbounded_Set_Const_Iterator< T >::operator==().

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 144 of file Unbounded_Set.h.

Referenced by ACE_Unbounded_Set_Const_Iterator< T >::operator!=(), and ACE_Unbounded_Set_Const_Iterator< T >::operator==().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 12:59:20 2008 for ACE by doxygen 1.3.6