Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Double_Linked_List_Iterator_Base 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:

Inheritance graph
[legend]
Collaboration diagram for ACE_Double_Linked_List_Iterator_Base:

Collaboration graph
[legend]
List of all members.

Public Methods

int next (T *&) const
 Passes back the <entry> under the iterator. Returns 0 if the iteration has completed, otherwise 1. More...

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

T & operator * (void) const
 STL-like iterator dereference operator: returns a reference to the node underneath the iterator. More...

void reset (ACE_Double_Linked_List< T > &)

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Protected Methods

 ACE_Double_Linked_List_Iterator_Base (const ACE_Double_Linked_List< T > &)
 Constructor. More...

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

int go_head (void)
int go_tail (void)
 Move to the last element of the list. Returns 0 if the list is empty, else 1. More...

T * not_done (void) const
T * do_advance (void)
 Advance to the next element in the list. Return the address of the next element if there are more, 0 otherwise. More...

T * do_retreat (void)
 Retreat to the previous element in the list. Return the address of the previous element if there are more, 0 otherwise. More...

void dump_i (void) const
 Dump the state of an object. More...


Protected Attributes

T * current_
 Remember where we are. More...

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 556 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 339 of file Containers_T.cpp.

00340   : current_ (0), dllist_ (&dll)
00341 {
00342   // Do nothing
00343 }

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

00347   : current_ (iter.current_),
00348     dllist_ (iter.dllist_)
00349 {
00350   // Do nothing
00351 }


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 413 of file Containers_T.cpp.

References current_, and not_done.

Referenced by ACE_Double_Linked_List_Iterator::advance, ACE_Double_Linked_List_Iterator::advance_and_remove, ACE_Double_Linked_List_Iterator::operator++, and ACE_Double_Linked_List_Reverse_Iterator::operator--.

00414 {
00415   if (this->not_done ())
00416     {
00417       this->current_ = ACE_static_cast (T*, this->current_->next_);
00418       return this->not_done ();
00419     }
00420   else
00421     return 0;
00422 }

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 425 of file Containers_T.cpp.

References current_, and not_done.

Referenced by ACE_Double_Linked_List_Reverse_Iterator::advance, ACE_Double_Linked_List_Reverse_Iterator::advance_and_remove, ACE_Double_Linked_List_Reverse_Iterator::operator++, and ACE_Double_Linked_List_Iterator::operator--.

00426 {
00427   if (this->not_done ())
00428     {
00429       this->current_ = ACE_static_cast (T*, this->current_->prev_);
00430       return this->not_done ();
00431     }
00432   else
00433     return 0;
00434 }

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 369 of file Containers_T.cpp.

References not_done.

Referenced by ACE_Thread_Manager::apply_all, ACE_Thread_Manager::apply_grp, ACE_Thread_Manager::apply_task, ACE_Double_Linked_List::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::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.

00370 {
00371   return this->not_done () ? 0 : 1;
00372 }

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 437 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::dump, and ACE_Double_Linked_List_Iterator::dump.

00438 {
00439   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00440   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("current_ = %x"), this->current_));
00441   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00442 }

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 390 of file Containers_T.cpp.

References current_, and dllist_.

Referenced by ACE_Double_Linked_List_Iterator::first.

00391 {
00392   this->current_ = ACE_static_cast (T*, dllist_->head_->next_);
00393   return this->current_ ? 1 : 0;
00394 }

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 397 of file Containers_T.cpp.

References current_, and dllist_.

Referenced by ACE_Double_Linked_List_Reverse_Iterator::first.

00398 {
00399   this->current_ = ACE_static_cast (T*, dllist_->head_->prev_);
00400   return this->current_ ? 1 : 0;
00401 }

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.

Definition at line 355 of file Containers_T.cpp.

References not_done.

Referenced by ACE_Double_Linked_List_Reverse_Iterator::advance_and_remove, and ACE_Double_Linked_List_Iterator::advance_and_remove.

00356 {
00357   return this->not_done ();
00358 }

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 361 of file Containers_T.cpp.

References not_done.

Referenced by ACE_Thread_Manager::apply_all, ACE_Thread_Manager::apply_grp, ACE_Thread_Manager::apply_task, ACE_Double_Linked_List::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::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.

00362 {
00363   ptr = this->not_done ();
00364   return ptr ? 1 : 0;
00365 }

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 404 of file Containers_T.cpp.

References current_, and dllist_.

Referenced by do_advance, do_retreat, done, next, and operator *.

00405 {
00406   if (this->current_ != this->dllist_->head_)
00407     return this->current_;
00408   else
00409     return 0;
00410 }

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 375 of file Containers_T.cpp.

References not_done.

00376 {
00377   return *(this->not_done ());
00378 }

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.

Definition at line 383 of file Containers_T.cpp.

References current_, and dllist_.

00384 {
00385   current_ = 0;
00386   dllist_ = &dll;
00387 }


Member Data Documentation

template<class T>
ACE_Double_Linked_List_Iterator_Base::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented in ACE_Double_Linked_List_Iterator.

Definition at line 589 of file Containers_T.h.

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

Remember where we are.

Definition at line 634 of file Containers_T.h.

Referenced by ACE_Double_Linked_List_Iterator::ACE_Double_Linked_List_Iterator, ACE_Double_Linked_List_Reverse_Iterator::ACE_Double_Linked_List_Reverse_Iterator, do_advance, do_retreat, go_head, go_tail, not_done, ACE_Double_Linked_List_Reverse_Iterator::reset, ACE_Double_Linked_List_Iterator::reset, and reset.

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

Definition at line 636 of file Containers_T.h.

Referenced by go_head, go_tail, not_done, and reset.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:47:27 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002