ACE_Unbounded_List_Iterator< T > Class Template Reference

Implement an iterator over an unbounded List. More...

#include <Naming_Service_Container.h>

List of all members.

Public Member Functions

 ACE_Unbounded_List_Iterator (ACE_Unbounded_List< 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_List_Iterator<
T > 
operator++ (int)
 Postfix advance.

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

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

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

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

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Private Attributes

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

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


Detailed Description

template<class T>
class ACE_Unbounded_List_Iterator< T >

Implement an iterator over an unbounded List.

Definition at line 76 of file Naming_Service_Container.h.


Constructor & Destructor Documentation

template<class T>
ACE_Unbounded_List_Iterator< T >::ACE_Unbounded_List_Iterator ACE_Unbounded_List< T > &  s,
int  end = 0
 

Definition at line 276 of file Naming_Service_Container.cpp.

00277   : current_ (end == 0 ? s.head_->next_ : s.head_ ),
00278     set_ (&s)
00279 {
00280   // ACE_TRACE ("ACE_Unbounded_List_Iterator<T>::ACE_Unbounded_List_Iterator");
00281 }


Member Function Documentation

template<class T>
int ACE_Unbounded_List_Iterator< T >::advance void   ) 
 

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

Definition at line 284 of file Naming_Service_Container.cpp.

Referenced by ACE_Unbounded_List< T >::dump(), and ACE_Unbounded_List_Iterator< T >::operator++().

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

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

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

Definition at line 300 of file Naming_Service_Container.cpp.

References ACE_TRACE.

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

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

Dump the state of an object.

Definition at line 270 of file Naming_Service_Container.cpp.

00271 {
00272   // ACE_TRACE ("ACE_Unbounded_List_Iterator<T>::dump");
00273 }

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

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

Definition at line 292 of file Naming_Service_Container.cpp.

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

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

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

Definition at line 308 of file Naming_Service_Container.cpp.

Referenced by ACE_Unbounded_List< T >::dump(), and ACE_Unbounded_List_Iterator< T >::operator *().

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

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

Returns a reference to the interal element is pointing to.

Definition at line 344 of file Naming_Service_Container.cpp.

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

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

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

Definition at line 364 of file Naming_Service_Container.cpp.

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

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

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

Prefix advance.

Definition at line 333 of file Naming_Service_Container.cpp.

References ACE_Unbounded_List_Iterator< T >::advance().

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

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

Postfix advance.

Definition at line 321 of file Naming_Service_Container.cpp.

References ACE_Unbounded_List_Iterator< T >::advance().

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

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

Check if two iterators point to the same position.

Definition at line 357 of file Naming_Service_Container.cpp.

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

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


Member Data Documentation

template<class T>
ACE_Unbounded_List_Iterator< T >::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Definition at line 118 of file Naming_Service_Container.h.

template<class T>
ACE_NS_Node<T>* ACE_Unbounded_List_Iterator< T >::current_ [private]
 

Pointer to the current node in the iteration.

Definition at line 123 of file Naming_Service_Container.h.

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

template<class T>
ACE_Unbounded_List<T>* ACE_Unbounded_List_Iterator< T >::set_ [private]
 

Pointer to the set we're iterating over.

Definition at line 126 of file Naming_Service_Container.h.

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


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 16:16:08 2008 for TAO_CosNaming by doxygen 1.3.6