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, 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_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 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,
int  end = 0
 

Definition at line 265 of file Unbounded_Set.cpp.

00266   : current_ (end == 0 ? s.head_->next_ : s.head_ ),
00267     set_ (&s)
00268 {
00269   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::ACE_Unbounded_Set_Iterator");
00270 }


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

Referenced by ACE_Service_Gestalt::add_processed_static_svc(), ACE_Service_Gestalt::close(), ACE_Unbounded_Set< T >::dump(), ACE_Service_Gestalt::find_processed_static_svc(), ACE_Service_Gestalt::find_static_svc_descriptor(), ACE_Registry_Name_Space::list_names(), ACE_Registry_Name_Space::list_values(), 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().

00274 {
00275   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::advance");
00276   this->current_ = this->current_->next_;
00277   return this->current_ != this->set_->head_;
00278 }

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

References ACE_TRACE.

00290 {
00291   ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::done");
00292 
00293   return this->current_ == this->set_->head_;
00294 }

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

Dump the state of an object.

Definition at line 257 of file Unbounded_Set.cpp.

00258 {
00259 #if defined (ACE_HAS_DUMP)
00260   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::dump");
00261 #endif /* ACE_HAS_DUMP */
00262 }

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

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

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 297 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_Unbounded_Set< T >::dump(), ACE_Service_Gestalt::find_processed_static_svc(), ACE_Service_Gestalt::find_static_svc_descriptor(), ACE_Registry_Name_Space::list_names(), ACE_Registry_Name_Space::list_values(), 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().

00298 {
00299   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::next");
00300   if (this->current_ == this->set_->head_)
00301     return 0;
00302   else
00303     {
00304       item = &this->current_->item_;
00305       return 1;
00306     }
00307 }

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

Returns a reference to the internal element is pointing to.

Definition at line 333 of file Unbounded_Set.cpp.

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

00334 {
00335   //ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::operator*");
00336   T *retv = 0;
00337 
00338   int result = this->next (retv);
00339   ACE_ASSERT (result != 0);
00340   ACE_UNUSED_ARG (result);
00341 
00342   return *retv;
00343 }

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

Definition at line 353 of file Unbounded_Set.cpp.

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

00354 {
00355   //ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::operator!=");
00356   return (this->set_ != rhs.set_ || this->current_ != rhs.current_);
00357 }

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

Prefix advance.

Definition at line 322 of file Unbounded_Set.cpp.

References ACE_Unbounded_Set_Iterator< T >::advance().

00323 {
00324   // ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::operator++ (void)");
00325 
00326   // prefix operator
00327 
00328   this->advance ();
00329   return *this;
00330 }

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

Postfix advance.

Definition at line 310 of file Unbounded_Set.cpp.

References ACE_Unbounded_Set_Iterator< T >::advance().

00311 {
00312   //ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::operator++ (int)");
00313   ACE_Unbounded_Set_Iterator<T> retv (*this);
00314 
00315   // postfix operator
00316 
00317   this->advance ();
00318   return retv;
00319 }

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

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

00347 {
00348   //ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::operator==");
00349   return (this->set_ == rhs.set_ && this->current_ == rhs.current_);
00350 }


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 Thu Nov 9 11:32:12 2006 for ACE by doxygen 1.3.6