ACE_Double_Linked_List_Iterator_Base< T > Class Template Reference

Implements a common base class for iterators for a double linked list ADT. More...

#include <Containers_T.h>

Inheritance diagram for ACE_Double_Linked_List_Iterator_Base< T >:

Inheritance graph
[legend]
Collaboration diagram for ACE_Double_Linked_List_Iterator_Base< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

int next (T *&) const
T * next (void) const
int done (void) const
 Returns 1 when all items have been seen, else 0.

T & operator * (void) const
void reset (ACE_Double_Linked_List< T > &)

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Protected Member Functions

 ACE_Double_Linked_List_Iterator_Base (const ACE_Double_Linked_List< T > &)
 Constructor.

 ACE_Double_Linked_List_Iterator_Base (const ACE_Double_Linked_List_Iterator_Base< T > &iter)
 Copy constructor.

int go_head (void)
int go_tail (void)
T * not_done (void) const
T * do_advance (void)
T * do_retreat (void)
void dump_i (void) const
 Dump the state of an object.


Protected Attributes

T * current_
 Remember where we are.

const ACE_Double_Linked_List<
T > * 
dllist_

Detailed Description

template<class T>
class ACE_Double_Linked_List_Iterator_Base< T >

Implements a common base class for iterators for a double linked list ADT.

Definition at line 558 of file Containers_T.h.


Constructor & Destructor Documentation

template<class T>
ACE_Double_Linked_List_Iterator_Base< T >::ACE_Double_Linked_List_Iterator_Base const ACE_Double_Linked_List< T > &   )  [protected]
 

Constructor.

Definition at line 345 of file Containers_T.cpp.

00346   : current_ (0), dllist_ (&dll)
00347 {
00348   // Do nothing
00349 }

template<class T>
ACE_Double_Linked_List_Iterator_Base< T >::ACE_Double_Linked_List_Iterator_Base const ACE_Double_Linked_List_Iterator_Base< T > &  iter  )  [protected]
 

Copy constructor.

Definition at line 352 of file Containers_T.cpp.

00353   : current_ (iter.current_),
00354     dllist_ (iter.dllist_)
00355 {
00356   // Do nothing
00357 }


Member Function Documentation

template<class T>
T * ACE_Double_Linked_List_Iterator_Base< T >::do_advance void   )  [protected]
 

Advance to the next element in the list. Return the address of the next element if there are more, 0 otherwise.

Definition at line 419 of file Containers_T.cpp.

References ACE_Double_Linked_List_Iterator_Base< T >::not_done().

Referenced by ACE_Double_Linked_List_Iterator< T >::advance(), ACE_Double_Linked_List_Iterator< T >::advance_and_remove(), ACE_Double_Linked_List_Iterator< T >::operator++(), and ACE_Double_Linked_List_Reverse_Iterator< T >::operator--().

00420 {
00421   if (this->not_done ())
00422     {
00423       this->current_ = static_cast<T*> (this->current_->next_);
00424       return this->not_done ();
00425     }
00426   else
00427     return 0;
00428 }

template<class T>
T * ACE_Double_Linked_List_Iterator_Base< T >::do_retreat void   )  [protected]
 

Retreat to the previous element in the list. Return the address of the previous element if there are more, 0 otherwise.

Definition at line 431 of file Containers_T.cpp.

References ACE_Double_Linked_List_Iterator_Base< T >::not_done().

Referenced by ACE_Double_Linked_List_Reverse_Iterator< T >::advance(), ACE_Double_Linked_List_Reverse_Iterator< T >::advance_and_remove(), ACE_Double_Linked_List_Reverse_Iterator< T >::operator++(), and ACE_Double_Linked_List_Iterator< T >::operator--().

00432 {
00433   if (this->not_done ())
00434     {
00435       this->current_ = static_cast<T*> (this->current_->prev_);
00436       return this->not_done ();
00437     }
00438   else
00439     return 0;
00440 }

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

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

Definition at line 375 of file Containers_T.cpp.

References ACE_Double_Linked_List_Iterator_Base< T >::not_done().

Referenced by ACE_Thread_Manager::apply_all(), ACE_Thread_Manager::apply_grp(), ACE_Thread_Manager::apply_task(), ACE_Double_Linked_List< T >::copy_nodes(), ACE_Thread_Manager::dump(), ACE_Thread_Manager::find_hthread(), ACE_Thread_Manager::find_task(), ACE_Thread_Manager::find_thread(), ACE_Double_Linked_List< T >::get(), ACE_Thread_Manager::hthread_grp_list(), ACE_Thread_Manager::hthread_list(), ACE_Thread_Manager::hthread_within(), ACE_Thread_Manager::join(), ACE_Thread_Manager::num_tasks_in_group(), ACE_Thread_Manager::num_threads_in_task(), ACE_Thread_Manager::set_grp(), ACE_Thread_Manager::task_all_list(), ACE_Thread_Manager::task_list(), ACE_Thread_Manager::thread_all_list(), ACE_Thread_Manager::thread_grp_list(), ACE_Thread_Manager::thread_list(), ACE_Thread_Manager::thread_within(), ACE_Thread_Manager::wait(), ACE_Thread_Manager::wait_grp(), and ACE_Thread_Manager::wait_task().

00376 {
00377   return this->not_done () ? 0 : 1;
00378 }

template<class T>
void ACE_Double_Linked_List_Iterator_Base< T >::dump_i void   )  const [protected]
 

Dump the state of an object.

Definition at line 443 of file Containers_T.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, and LM_DEBUG.

Referenced by ACE_Double_Linked_List_Reverse_Iterator< T >::dump(), and ACE_Double_Linked_List_Iterator< T >::dump().

00444 {
00445   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00446   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("current_ = %x"), this->current_));
00447   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00448 }

template<class T>
int ACE_Double_Linked_List_Iterator_Base< T >::go_head void   )  [protected]
 

Move to the first element of the list. Returns 0 if the list is empty, else 1.

Note:
the head of the ACE_DLList is actually a null entry, so the first element is actually the 2n'd entry

Definition at line 396 of file Containers_T.cpp.

References ACE_Double_Linked_List_Iterator_Base< T >::dllist_.

Referenced by ACE_Double_Linked_List_Iterator< T >::first().

00397 {
00398   this->current_ = static_cast<T*> (dllist_->head_->next_);
00399   return this->current_ ? 1 : 0;
00400 }

template<class T>
int ACE_Double_Linked_List_Iterator_Base< T >::go_tail void   )  [protected]
 

Move to the last element of the list. Returns 0 if the list is empty, else 1.

Definition at line 403 of file Containers_T.cpp.

References ACE_Double_Linked_List_Iterator_Base< T >::dllist_.

Referenced by ACE_Double_Linked_List_Reverse_Iterator< T >::first().

00404 {
00405   this->current_ = static_cast<T*> (dllist_->head_->prev_);
00406   return this->current_ ? 1 : 0;
00407 }

template<class T>
T * ACE_Double_Linked_List_Iterator_Base< T >::next void   )  const
 

Deprecated:
Return the address of next (current) unvisited item in the list. 0 if there is no more element available.

Reimplemented in ACE_DLList_Iterator< T >, and ACE_DLList_Reverse_Iterator< T >.

Definition at line 361 of file Containers_T.cpp.

References ACE_Double_Linked_List_Iterator_Base< T >::not_done().

Referenced by ACE_Double_Linked_List_Reverse_Iterator< T >::advance_and_remove(), and ACE_Double_Linked_List_Iterator< T >::advance_and_remove().

00362 {
00363   return this->not_done ();
00364 }

template<class T>
int ACE_Double_Linked_List_Iterator_Base< T >::next T *&   )  const
 

Passes back the {entry} under the iterator. Returns 0 if the iteration has completed, otherwise 1

Definition at line 367 of file Containers_T.cpp.

References ACE_Double_Linked_List_Iterator_Base< T >::not_done().

Referenced by ACE_Thread_Manager::apply_all(), ACE_Thread_Manager::apply_grp(), ACE_Thread_Manager::apply_task(), ACE_Double_Linked_List< T >::copy_nodes(), ACE_Thread_Manager::dump(), ACE_Thread_Manager::find_hthread(), ACE_Thread_Manager::find_task(), ACE_Thread_Manager::find_thread(), ACE_Double_Linked_List< T >::get(), ACE_Thread_Manager::hthread_grp_list(), ACE_Thread_Manager::hthread_list(), ACE_Thread_Manager::hthread_within(), ACE_Thread_Manager::join(), ACE_Thread_Manager::num_tasks_in_group(), ACE_Thread_Manager::num_threads_in_task(), ACE_Thread_Manager::set_grp(), ACE_Thread_Manager::task_all_list(), ACE_Thread_Manager::task_list(), ACE_Thread_Manager::thread_all_list(), ACE_Thread_Manager::thread_grp_list(), ACE_Thread_Manager::thread_list(), ACE_Thread_Manager::thread_within(), ACE_Thread_Manager::wait(), ACE_Thread_Manager::wait_grp(), and ACE_Thread_Manager::wait_task().

00368 {
00369   ptr = this->not_done ();
00370   return ptr ? 1 : 0;
00371 }

template<class T>
T * ACE_Double_Linked_List_Iterator_Base< T >::not_done void   )  const [protected]
 

Check if we reach the end of the list. Can also be used to get the *current* element in the list. Return the address of the current item if there are still elements left , 0 if we run out of element.

Definition at line 410 of file Containers_T.cpp.

References ACE_Double_Linked_List_Iterator_Base< T >::dllist_.

Referenced by ACE_Double_Linked_List_Iterator_Base< T >::do_advance(), ACE_Double_Linked_List_Iterator_Base< T >::do_retreat(), ACE_Double_Linked_List_Iterator_Base< T >::done(), ACE_Double_Linked_List_Iterator_Base< T >::next(), and ACE_Double_Linked_List_Iterator_Base< T >::operator *().

00411 {
00412   if (this->current_ != this->dllist_->head_)
00413     return this->current_;
00414   else
00415     return 0;
00416 }

template<class T>
T & ACE_Double_Linked_List_Iterator_Base< T >::operator * void   )  const
 

STL-like iterator dereference operator: returns a reference to the node underneath the iterator.

Definition at line 381 of file Containers_T.cpp.

References ACE_Double_Linked_List_Iterator_Base< T >::not_done().

00382 {
00383   return *(this->not_done ());
00384 }

template<class T>
void ACE_Double_Linked_List_Iterator_Base< T >::reset ACE_Double_Linked_List< T > &   ) 
 

Retasks the iterator to iterate over a new Double_Linked_List. This allows clients to reuse an iterator without incurring the constructor overhead. If you do use this, be aware that if there are more than one reference to this iterator, the other "clients" may be very bothered when their iterator changes. @ Here be dragons. Comments?

Reimplemented in ACE_Double_Linked_List_Iterator< T >, and ACE_Double_Linked_List_Reverse_Iterator< T >.

Definition at line 389 of file Containers_T.cpp.

References ACE_Double_Linked_List_Iterator_Base< T >::dllist_.

00390 {
00391   current_ = 0;
00392   dllist_ = &dll;
00393 }


Member Data Documentation

template<class T>
ACE_Double_Linked_List_Iterator_Base< T >::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented in ACE_Double_Linked_List_Iterator< T >, ACE_Double_Linked_List_Reverse_Iterator< T >, ACE_Double_Linked_List_Iterator< ACE_DLList_Node >, and ACE_Double_Linked_List_Reverse_Iterator< ACE_DLList_Node >.

Definition at line 591 of file Containers_T.h.

template<class T>
T* ACE_Double_Linked_List_Iterator_Base< T >::current_ [protected]
 

Remember where we are.

Definition at line 637 of file Containers_T.h.

template<class T>
const ACE_Double_Linked_List<T>* ACE_Double_Linked_List_Iterator_Base< T >::dllist_ [protected]
 

Definition at line 639 of file Containers_T.h.

Referenced by ACE_Double_Linked_List_Iterator_Base< T >::go_head(), ACE_Double_Linked_List_Iterator_Base< T >::go_tail(), ACE_Double_Linked_List_Iterator_Base< T >::not_done(), and ACE_Double_Linked_List_Iterator_Base< T >::reset().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:21:49 2006 for ACE by doxygen 1.3.6