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 279 of file Naming_Service_Container.cpp.

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


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 287 of file Naming_Service_Container.cpp.

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

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

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 303 of file Naming_Service_Container.cpp.

References ACE_TRACE.

00304 {
00305   ACE_TRACE ("ACE_Unbounded_List_Iterator<T>::done");
00306 
00307   return this->current_ == this->set_->head_;
00308 }

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

Dump the state of an object.

Definition at line 273 of file Naming_Service_Container.cpp.

00274 {
00275   // ACE_TRACE ("ACE_Unbounded_List_Iterator<T>::dump");
00276 }

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 295 of file Naming_Service_Container.cpp.

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

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 311 of file Naming_Service_Container.cpp.

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

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

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

Returns a reference to the interal element is pointing to.

Definition at line 347 of file Naming_Service_Container.cpp.

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

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

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

Definition at line 367 of file Naming_Service_Container.cpp.

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

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

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

Prefix advance.

Definition at line 336 of file Naming_Service_Container.cpp.

References ACE_Unbounded_List_Iterator< T >::advance().

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

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

Postfix advance.

Definition at line 324 of file Naming_Service_Container.cpp.

References ACE_Unbounded_List_Iterator< T >::advance().

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

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 360 of file Naming_Service_Container.cpp.

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

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


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 Thu Nov 9 13:57:35 2006 for TAO_CosNaming by doxygen 1.3.6