IntrusiveListMutator< T, DerivedListNode > Class Template Reference

IntrusiveListMutator is the companion mutator for InstrusiveList. More...

#include <IntrusiveList.h>

Inheritance diagram for IntrusiveListMutator< T, DerivedListNode >:

RawIntrusiveListMutator List of all members.

Public Member Functions

 IntrusiveListMutator ()
 Constructs a singular mutator.
 IntrusiveListMutator (IntrusiveList< T, DerivedListNode > &list)
 Constructs a mutator positioned at the front of a given list.
T * operator-> () const
 
Returns:
pointer to current element

 operator T * () const
 
Returns:
reference to current element

T & operator * () const
 
Returns:
reference to current element

T * detach ()
 Removes current element from list.
void repositionToFront (IntrusiveList< T, DerivedListNode > &list)
 Repositions this mutator to the front of a given list.
void repositionToFront ()
 Repositions this mutator to the front of the current list.
void operator++ ()
 Advances iterator position to next node.
void promoteCurrToFront ()
 Moves the current node to the front of the list.
void demoteCurrToBack ()
 Moves the current node to the back of the list.
void demoteFrontBeforeCurr ()
 Moves the front node of the list to just before the current node.

Protected Member Functions

IntrusiveListNodegetCurrent () const
void repositionToFront (RawIntrusiveList &l)

Protected Attributes

IntrusiveListNodepCurr
IntrusiveListNodepPrev
RawIntrusiveListpList
bool bJustDeleted

Private Types

typedef RawIntrusiveListMutator super

Detailed Description

template<class T, class DerivedListNode = IntrusiveListNode>
class IntrusiveListMutator< T, DerivedListNode >

IntrusiveListMutator is the companion mutator for InstrusiveList.

It allows the list to be modified during the course of iteration.

Definition at line 181 of file IntrusiveList.h.


Member Typedef Documentation

template<class T, class DerivedListNode = IntrusiveListNode>
typedef RawIntrusiveListMutator IntrusiveListMutator< T, DerivedListNode >::super [private]

Definition at line 184 of file IntrusiveList.h.


Constructor & Destructor Documentation

template<class T, class DerivedListNode = IntrusiveListNode>
IntrusiveListMutator< T, DerivedListNode >::IntrusiveListMutator (  )  [inline, explicit]

Constructs a singular mutator.

Definition at line 190 of file IntrusiveList.h.

00191     {
00192     }

template<class T, class DerivedListNode = IntrusiveListNode>
IntrusiveListMutator< T, DerivedListNode >::IntrusiveListMutator ( IntrusiveList< T, DerivedListNode > &  list  )  [inline, explicit]

Constructs a mutator positioned at the front of a given list.

Parameters:
list the list to access

Definition at line 199 of file IntrusiveList.h.

00201         : super(list)
00202     {
00203     }


Member Function Documentation

template<class T, class DerivedListNode = IntrusiveListNode>
T* IntrusiveListMutator< T, DerivedListNode >::operator-> (  )  const [inline]

Returns:
pointer to current element

Definition at line 208 of file IntrusiveList.h.

References RawIntrusiveListMutator::getCurrent().

00209     {
00210         return static_cast<T *>(
00211             static_cast<DerivedListNode *>(getCurrent()));
00212     }

template<class T, class DerivedListNode = IntrusiveListNode>
IntrusiveListMutator< T, DerivedListNode >::operator T * (  )  const [inline]

Returns:
reference to current element

Definition at line 217 of file IntrusiveList.h.

References RawIntrusiveListMutator::getCurrent().

00218     {
00219         return static_cast<T *>(
00220             static_cast<DerivedListNode *>(getCurrent()));
00221     }

template<class T, class DerivedListNode = IntrusiveListNode>
T& IntrusiveListMutator< T, DerivedListNode >::operator * (  )  const [inline]

Returns:
reference to current element

Definition at line 226 of file IntrusiveList.h.

References RawIntrusiveListMutator::getCurrent().

00227     {
00228         return *static_cast<T *>(
00229             static_cast<DerivedListNode *>(getCurrent()));
00230     }

template<class T, class DerivedListNode = IntrusiveListNode>
T* IntrusiveListMutator< T, DerivedListNode >::detach (  )  [inline]

Removes current element from list.

This mutator will advance to the original successor on next increment.

Returns:
element removed

Reimplemented from RawIntrusiveListMutator.

Definition at line 238 of file IntrusiveList.h.

References RawIntrusiveListMutator::detach().

Referenced by CacheImpl< PageT, VictimPolicyT >::findFreePage(), ThreadPoolScheduler::schedule(), IoCompletionPortScheduler::schedule(), AioSignalScheduler::schedule(), AioPollingScheduler::schedule(), CacheImpl< PageT, VictimPolicyT >::setAllocatedPageCount(), and AioLinuxScheduler::submitRequests().

00239     {
00240         return static_cast<T *>(
00241             static_cast<DerivedListNode *>(super::detach()));
00242     }

template<class T, class DerivedListNode = IntrusiveListNode>
void IntrusiveListMutator< T, DerivedListNode >::repositionToFront ( IntrusiveList< T, DerivedListNode > &  list  )  [inline]

Repositions this mutator to the front of a given list.

Parameters:
list the list to access

Definition at line 249 of file IntrusiveList.h.

References RawIntrusiveListMutator::repositionToFront().

00251     {
00252         super::repositionToFront(list);
00253     }

template<class T, class DerivedListNode = IntrusiveListNode>
void IntrusiveListMutator< T, DerivedListNode >::repositionToFront (  )  [inline]

Repositions this mutator to the front of the current list.

Reimplemented from RawIntrusiveListMutator.

Definition at line 258 of file IntrusiveList.h.

References RawIntrusiveListMutator::repositionToFront().

00259     {
00260         super::repositionToFront();
00261     }

IntrusiveListNode* RawIntrusiveListMutator::getCurrent (  )  const [inline, protected, inherited]

Definition at line 173 of file RawIntrusiveList.h.

Referenced by IntrusiveListMutator< T, DerivedListNode >::operator *(), IntrusiveListMutator< T, DerivedListNode >::operator T *(), and IntrusiveListMutator< T, DerivedListNode >::operator->().

00174     {
00175         return pCurr;
00176     }

void RawIntrusiveListMutator::repositionToFront ( RawIntrusiveList l  )  [inline, protected, inherited]

Definition at line 178 of file RawIntrusiveList.h.

References RawIntrusiveList::pFront.

00179     {
00180         pList = &l;
00181         bJustDeleted = 0;
00182         pCurr = pList->pFront;
00183         pPrev = NULL;
00184     }

void RawIntrusiveListMutator::operator++ (  )  [inline, inherited]

Advances iterator position to next node.

Definition at line 192 of file RawIntrusiveList.h.

00193     {
00194         if (bJustDeleted) {
00195             bJustDeleted = 0;
00196         } else {
00197             pPrev = pCurr;
00198             if (pCurr) {
00199                 pCurr = pCurr->pNext;
00200             }
00201         }
00202     }

void RawIntrusiveListMutator::promoteCurrToFront (  )  [inherited]

Moves the current node to the front of the list.

This iterator will advance to the original successor on next increment.

Definition at line 79 of file RawIntrusiveList.cpp.

References RawIntrusiveListMutator::bJustDeleted, RawIntrusiveList::pBack, RawIntrusiveListMutator::pCurr, RawIntrusiveList::pFront, RawIntrusiveListMutator::pList, IntrusiveListNode::pNext, and RawIntrusiveListMutator::pPrev.

00080 {
00081     assert(pCurr);
00082     if (pList->pFront == pCurr) {
00083         return;
00084     }
00085     if (pList->pBack == pCurr) {
00086         pList->pBack = pPrev;
00087     }
00088     pPrev->pNext = pCurr->pNext;
00089     pCurr->pNext = pList->pFront;
00090     pList->pFront = pCurr;
00091     pCurr = pPrev->pNext;
00092     bJustDeleted = 1;
00093 }

void RawIntrusiveListMutator::demoteCurrToBack (  )  [inherited]

Moves the current node to the back of the list.

This iterator will advance to the original successor on next increment.

Definition at line 95 of file RawIntrusiveList.cpp.

References RawIntrusiveListMutator::bJustDeleted, RawIntrusiveList::pBack, RawIntrusiveListMutator::pCurr, RawIntrusiveList::pFront, RawIntrusiveListMutator::pList, IntrusiveListNode::pNext, and RawIntrusiveListMutator::pPrev.

00096 {
00097     assert(pCurr);
00098     if (pList->pBack == pCurr) {
00099         return;
00100     }
00101     if (pPrev) {
00102         pPrev->pNext = pCurr->pNext;
00103     } else {
00104         pList->pFront = pCurr->pNext;
00105     }
00106     pCurr->pNext = NULL;
00107     pList->pBack->pNext = pCurr;
00108     pList->pBack = pCurr;
00109     if (pPrev) {
00110         pCurr = pPrev->pNext;
00111     } else {
00112         pCurr = pList->pFront;
00113     }
00114     bJustDeleted = 1;
00115 }

void RawIntrusiveListMutator::demoteFrontBeforeCurr (  )  [inherited]

Moves the front node of the list to just before the current node.

Iterator position is unchanged.

Definition at line 117 of file RawIntrusiveList.cpp.

References RawIntrusiveListMutator::pCurr, RawIntrusiveList::pFront, RawIntrusiveListMutator::pList, IntrusiveListNode::pNext, and RawIntrusiveListMutator::pPrev.

00118 {
00119     assert(pCurr);
00120     if (!pPrev) {
00121         return;
00122     }
00123     IntrusiveListNode *pOldFront = pList->pFront;
00124     if (pOldFront == pPrev) {
00125         return;
00126     }
00127     pList->pFront = pOldFront->pNext;
00128     pPrev = pPrev->pNext = pOldFront;
00129     pOldFront->pNext = pCurr;
00130 }


Member Data Documentation

IntrusiveListNode* RawIntrusiveListMutator::pCurr [protected, inherited]

Definition at line 156 of file RawIntrusiveList.h.

Referenced by RawIntrusiveListMutator::demoteCurrToBack(), RawIntrusiveListMutator::demoteFrontBeforeCurr(), RawIntrusiveListMutator::detach(), and RawIntrusiveListMutator::promoteCurrToFront().

IntrusiveListNode * RawIntrusiveListMutator::pPrev [protected, inherited]

Definition at line 156 of file RawIntrusiveList.h.

Referenced by RawIntrusiveListMutator::demoteCurrToBack(), RawIntrusiveListMutator::demoteFrontBeforeCurr(), RawIntrusiveListMutator::detach(), and RawIntrusiveListMutator::promoteCurrToFront().

RawIntrusiveList* RawIntrusiveListMutator::pList [protected, inherited]

Definition at line 157 of file RawIntrusiveList.h.

Referenced by RawIntrusiveListMutator::demoteCurrToBack(), RawIntrusiveListMutator::demoteFrontBeforeCurr(), RawIntrusiveListMutator::detach(), and RawIntrusiveListMutator::promoteCurrToFront().

bool RawIntrusiveListMutator::bJustDeleted [protected, inherited]

Definition at line 158 of file RawIntrusiveList.h.

Referenced by RawIntrusiveListMutator::demoteCurrToBack(), RawIntrusiveListMutator::detach(), and RawIntrusiveListMutator::promoteCurrToFront().


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