IntrusiveTwoDListIter< ElementT, ReturnT > Class Template Reference

Iterator over two intrusive doubly-linked lists. More...

#include <IntrusiveDList.h>

List of all members.

Public Member Functions

 IntrusiveTwoDListIter ()
 IntrusiveTwoDListIter (ElementT *list1, ElementT *list2)
virtual ~IntrusiveTwoDListIter ()
void operator++ ()
ReturnT * operator-> () const
 operator ReturnT * () const
ReturnT & operator * () const
bool operator== (IntrusiveTwoDListIter const &other) const

Protected Member Functions

virtual ReturnT * getReturnElement (ElementT *element) const=0
 Returns a pointer to the return element corresponding to the element that the iterator is currently positioned at.

Private Attributes

ElementT * curr
 Pointer to the current list element.
ElementT * next
 Pointer to the start of the second list.
bool processingNext
 True if the first list has been walked.


Detailed Description

template<class ElementT, class ReturnT>
class IntrusiveTwoDListIter< ElementT, ReturnT >

Iterator over two intrusive doubly-linked lists.

The first list is walked followed by the second list. The lists can only be walked over in the forward direction.

Elements in both lists are all of the same type. A callback method must be defined that determines what should be returned for each element in the lists.

Definition at line 153 of file IntrusiveDList.h.


Constructor & Destructor Documentation

template<class ElementT, class ReturnT>
IntrusiveTwoDListIter< ElementT, ReturnT >::IntrusiveTwoDListIter (  )  [inline, explicit]

Definition at line 184 of file IntrusiveDList.h.

00185     {
00186         curr = NULL;
00187         next = NULL;
00188         processingNext = false;
00189     }

template<class ElementT, class ReturnT>
IntrusiveTwoDListIter< ElementT, ReturnT >::IntrusiveTwoDListIter ( ElementT *  list1,
ElementT *  list2 
) [inline, explicit]

Definition at line 191 of file IntrusiveDList.h.

00192     {
00193         if (list1 == NULL) {
00194             curr = list2;
00195             processingNext = true;
00196         } else {
00197             curr = list1;
00198             next = list2;
00199             processingNext = false;
00200         }
00201     }

template<class ElementT, class ReturnT>
virtual IntrusiveTwoDListIter< ElementT, ReturnT >::~IntrusiveTwoDListIter (  )  [inline, virtual]

Definition at line 203 of file IntrusiveDList.h.

00204     {
00205     }


Member Function Documentation

template<class ElementT, class ReturnT>
virtual ReturnT* IntrusiveTwoDListIter< ElementT, ReturnT >::getReturnElement ( ElementT *  element  )  const [protected, pure virtual]

Returns a pointer to the return element corresponding to the element that the iterator is currently positioned at.

Parameters:
element the current element
Returns:
pointer to the return element

Implemented in TwoQPageListIter< PageT >, and TwoQDirtyPageListIter< PageT >.

Referenced by IntrusiveTwoDListIter< TwoQDirtyPage, PageT >::operator *(), IntrusiveTwoDListIter< ElementT, ReturnT >::operator ReturnT *(), and IntrusiveTwoDListIter< TwoQDirtyPage, PageT >::operator->().

template<class ElementT, class ReturnT>
void IntrusiveTwoDListIter< ElementT, ReturnT >::operator++ (  )  [inline]

Definition at line 207 of file IntrusiveDList.h.

00208     {
00209         curr = static_cast<ElementT *>(curr->getNext());
00210         if (curr == NULL && !processingNext) {
00211             curr = next;
00212             processingNext = true;
00213         }
00214     }

template<class ElementT, class ReturnT>
ReturnT* IntrusiveTwoDListIter< ElementT, ReturnT >::operator-> (  )  const [inline]

Definition at line 216 of file IntrusiveDList.h.

00217     {
00218         return getReturnElement(curr);
00219     }

template<class ElementT, class ReturnT>
IntrusiveTwoDListIter< ElementT, ReturnT >::operator ReturnT * (  )  const [inline]

Definition at line 221 of file IntrusiveDList.h.

References IntrusiveTwoDListIter< ElementT, ReturnT >::curr, and IntrusiveTwoDListIter< ElementT, ReturnT >::getReturnElement().

00222     {
00223         return getReturnElement(curr);
00224     }

template<class ElementT, class ReturnT>
ReturnT& IntrusiveTwoDListIter< ElementT, ReturnT >::operator * (  )  const [inline]

Definition at line 226 of file IntrusiveDList.h.

00227     {
00228         return *(getReturnElement(curr));
00229     }

template<class ElementT, class ReturnT>
bool IntrusiveTwoDListIter< ElementT, ReturnT >::operator== ( IntrusiveTwoDListIter< ElementT, ReturnT > const &  other  )  const [inline]

Definition at line 231 of file IntrusiveDList.h.

00232     {
00233         return curr == other.curr;
00234     }


Member Data Documentation

template<class ElementT, class ReturnT>
ElementT* IntrusiveTwoDListIter< ElementT, ReturnT >::curr [private]

Pointer to the current list element.

Definition at line 158 of file IntrusiveDList.h.

Referenced by IntrusiveTwoDListIter< TwoQDirtyPage, PageT >::IntrusiveTwoDListIter(), IntrusiveTwoDListIter< TwoQDirtyPage, PageT >::operator *(), IntrusiveTwoDListIter< ElementT, ReturnT >::operator ReturnT *(), IntrusiveTwoDListIter< TwoQDirtyPage, PageT >::operator++(), IntrusiveTwoDListIter< TwoQDirtyPage, PageT >::operator->(), and IntrusiveTwoDListIter< TwoQDirtyPage, PageT >::operator==().

template<class ElementT, class ReturnT>
ElementT* IntrusiveTwoDListIter< ElementT, ReturnT >::next [private]

Pointer to the start of the second list.

Definition at line 163 of file IntrusiveDList.h.

Referenced by IntrusiveTwoDListIter< TwoQDirtyPage, PageT >::IntrusiveTwoDListIter(), and IntrusiveTwoDListIter< TwoQDirtyPage, PageT >::operator++().

template<class ElementT, class ReturnT>
bool IntrusiveTwoDListIter< ElementT, ReturnT >::processingNext [private]

True if the first list has been walked.

Definition at line 168 of file IntrusiveDList.h.

Referenced by IntrusiveTwoDListIter< TwoQDirtyPage, PageT >::IntrusiveTwoDListIter(), and IntrusiveTwoDListIter< TwoQDirtyPage, PageT >::operator++().


The documentation for this class was generated from the following file:
Generated on Mon Jun 22 04:00:33 2009 for Fennel by  doxygen 1.5.1