RawIntrusiveListMutator Class Reference

RawIntrusiveListMutator is the type-unsafe implementation for the type-safe IntrusiveListMutator template. More...

#include <RawIntrusiveList.h>

Inheritance diagram for RawIntrusiveListMutator:

IntrusiveListMutator< T, DerivedListNode > List of all members.

Public Member Functions

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.
void repositionToFront ()
 Moves iterator position to front of list.

Protected Member Functions

 RawIntrusiveListMutator ()
 RawIntrusiveListMutator (RawIntrusiveList &l)
IntrusiveListNodegetCurrent () const
void repositionToFront (RawIntrusiveList &l)
IntrusiveListNodedetach ()

Protected Attributes

IntrusiveListNodepCurr
IntrusiveListNodepPrev
RawIntrusiveListpList
bool bJustDeleted

Friends

class RawIntrusiveList

Detailed Description

RawIntrusiveListMutator is the type-unsafe implementation for the type-safe IntrusiveListMutator template.

See InstrusiveListMutator for details.

Definition at line 151 of file RawIntrusiveList.h.


Constructor & Destructor Documentation

RawIntrusiveListMutator::RawIntrusiveListMutator (  )  [inline, explicit, protected]

Definition at line 160 of file RawIntrusiveList.h.

00161     {
00162         pList = NULL;
00163         pCurr = pPrev = NULL;
00164         bJustDeleted = 0;
00165     }

RawIntrusiveListMutator::RawIntrusiveListMutator ( RawIntrusiveList l  )  [inline, explicit, protected]

Definition at line 167 of file RawIntrusiveList.h.

00168         : pCurr(l.pFront), pPrev(NULL), pList(&l)
00169     {
00170         bJustDeleted = 0;
00171     }


Member Function Documentation

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

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]

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     }

IntrusiveListNode * RawIntrusiveListMutator::detach (  )  [protected]

Reimplemented in IntrusiveListMutator< T, DerivedListNode >.

Definition at line 132 of file RawIntrusiveList.cpp.

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

Referenced by IntrusiveListMutator< T, DerivedListNode >::detach().

00133 {
00134     assert(pCurr);
00135     IntrusiveListNode *pListNode = pCurr;
00136     if (pCurr == pList->pBack) {
00137         pList->pBack = pPrev;
00138     }
00139     if (pPrev) {
00140         pPrev->pNext = pCurr->pNext;
00141         pCurr = pPrev->pNext;
00142     } else {
00143         pList->pFront = pCurr->pNext;
00144         pCurr = pList->pFront;
00145     }
00146     pList->nNodes--;
00147     bJustDeleted = 1;
00148 #ifdef DEBUG
00149     pListNode->pNext = NULL;
00150 #endif
00151     return pListNode;
00152 }

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

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 (  ) 

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 bJustDeleted, RawIntrusiveList::pBack, pCurr, RawIntrusiveList::pFront, pList, IntrusiveListNode::pNext, and 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 (  ) 

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 bJustDeleted, RawIntrusiveList::pBack, pCurr, RawIntrusiveList::pFront, pList, IntrusiveListNode::pNext, and 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 (  ) 

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 pCurr, RawIntrusiveList::pFront, pList, IntrusiveListNode::pNext, and 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 }

void RawIntrusiveListMutator::repositionToFront (  )  [inline]

Moves iterator position to front of list.

Reimplemented in IntrusiveListMutator< T, DerivedListNode >.

Definition at line 225 of file RawIntrusiveList.h.

Referenced by IntrusiveListMutator< T, DerivedListNode >::repositionToFront().

00226     {
00227         bJustDeleted = 0;
00228         pCurr = pList->pFront;
00229         pPrev = NULL;
00230     }


Friends And Related Function Documentation

friend class RawIntrusiveList [friend]

Definition at line 153 of file RawIntrusiveList.h.


Member Data Documentation

IntrusiveListNode* RawIntrusiveListMutator::pCurr [protected]

Definition at line 156 of file RawIntrusiveList.h.

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

IntrusiveListNode * RawIntrusiveListMutator::pPrev [protected]

Definition at line 156 of file RawIntrusiveList.h.

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

RawIntrusiveList* RawIntrusiveListMutator::pList [protected]

Definition at line 157 of file RawIntrusiveList.h.

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

bool RawIntrusiveListMutator::bJustDeleted [protected]

Definition at line 158 of file RawIntrusiveList.h.

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


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