ACE_Unbounded_Set_Iterator< T > Class Template Reference

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

#include <Unbounded_Set.h>

List of all members.

Public Member Functions

 ACE_Unbounded_Set_Iterator (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_Iterator<
T > 
operator++ (int)
 Postfix advance.

ACE_Unbounded_Set_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_Iterator< T > &) const
 Check if two iterators point to the same position.

bool operator!= (const ACE_Unbounded_Set_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.

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


Detailed Description

template<class T>
class ACE_Unbounded_Set_Iterator< T >

Implement an iterator over an unbounded set.

Definition at line 34 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,
bool  end = false
 

Definition at line 273 of file Unbounded_Set.cpp.

00276   : current_ (!end ? s.head_->next_ : s.head_ ),
00277     set_ (&s)
00278 {
00279   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::ACE_Unbounded_Set_Iterator");
00280 }


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

Referenced by ACE_Service_Gestalt::add_processed_static_svc(), ACE_Service_Gestalt::close(), ACE_Service_Gestalt::find_processed_static_svc(), ACE_Service_Gestalt::find_static_svc_descriptor(), ACE_Service_Gestalt::load_static_svcs(), ACE_Unbounded_Set_Iterator< T >::operator++(), ACE_Service_Gestalt::~ACE_Service_Gestalt(), and ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK >::~ACE_Timer_Heap_T().

00284 {
00285   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::advance");
00286   this->current_ = this->current_->next_;
00287   return this->current_ != this->set_->head_;
00288 }

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

References ACE_TRACE.

00300 {
00301   ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::done");
00302 
00303   return this->current_ == this->set_->head_;
00304 }

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

Dump the state of an object.

Definition at line 265 of file Unbounded_Set.cpp.

00266 {
00267 #if defined (ACE_HAS_DUMP)
00268   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::dump");
00269 #endif /* ACE_HAS_DUMP */
00270 }

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

00292 {
00293   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::first");
00294   this->current_ = this->set_->head_->next_;
00295   return this->current_ != this->set_->head_;
00296 }

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

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

Definition at line 307 of file Unbounded_Set.cpp.

Referenced by ACE_Service_Gestalt::add_processed_static_svc(), ACE_Service_Gestalt::close(), ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >::close(), ACE_Service_Gestalt::find_processed_static_svc(), ACE_Service_Gestalt::find_static_svc_descriptor(), ACE_Service_Gestalt::load_static_svcs(), ACE_Unbounded_Set_Iterator< T >::operator *(), ACE_Service_Gestalt::~ACE_Service_Gestalt(), and ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK >::~ACE_Timer_Heap_T().

00308 {
00309   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::next");
00310   if (this->current_ == this->set_->head_)
00311     return 0;
00312   else
00313     {
00314       item = &this->current_->item_;
00315       return 1;
00316     }
00317 }

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

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

00344 {
00345   //ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::operator*");
00346   T *retv = 0;
00347 
00348   int result = this->next (retv);
00349   ACE_ASSERT (result != 0);
00350   ACE_UNUSED_ARG (result);
00351 
00352   return *retv;
00353 }

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

Definition at line 363 of file Unbounded_Set.cpp.

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

00364 {
00365   //ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::operator!=");
00366   return (this->set_ != rhs.set_ || this->current_ != rhs.current_);
00367 }

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

Prefix advance.

Definition at line 332 of file Unbounded_Set.cpp.

References ACE_Unbounded_Set_Iterator< T >::advance().

00333 {
00334   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::operator++ (void)");
00335 
00336   // prefix operator
00337 
00338   this->advance ();
00339   return *this;
00340 }

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

Postfix advance.

Definition at line 320 of file Unbounded_Set.cpp.

References ACE_Unbounded_Set_Iterator< T >::advance().

00321 {
00322   //ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::operator++ (int)");
00323   ACE_Unbounded_Set_Iterator<T> retv (*this);
00324 
00325   // postfix operator
00326 
00327   this->advance ();
00328   return retv;
00329 }

template<class T>
bool 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 356 of file Unbounded_Set.cpp.

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

00357 {
00358   //ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::operator==");
00359   return (this->set_ == rhs.set_ && this->current_ == rhs.current_);
00360 }


Member Data Documentation

template<class T>
ACE_Unbounded_Set_Iterator< T >::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Definition at line 76 of file Unbounded_Set.h.

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

Pointer to the current node in the iteration.

Definition at line 81 of file Unbounded_Set.h.

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

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

Pointer to the set we're iterating over.

Definition at line 84 of file Unbounded_Set.h.

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


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