RawIntrusiveList Class Reference

RawIntrusiveList is the type-unsafe implementation for the type-safe IntrusiveList template. More...

#include <RawIntrusiveList.h>

Inheritance diagram for RawIntrusiveList:

IntrusiveList< T, DerivedListNode > List of all members.

Public Member Functions

uint size () const
 
Returns:
length of this list

bool empty () const
 
Returns:
true iff size() is zero

void clear (bool debugClear=true)
 Truncates this list to zero nodes.

Protected Member Functions

 RawIntrusiveList ()
IntrusiveListNodefront () const
IntrusiveListNodeback () const
void push_front (IntrusiveListNode &t)
void push_back (IntrusiveListNode &t)
bool remove (IntrusiveListNode &)

Protected Attributes

uint nNodes
 Number of nodes in this list.
IntrusiveListNodepFront
 First node in this list.
IntrusiveListNodepBack
 Last node in this list.

Friends

class RawIntrusiveListIter
class RawIntrusiveListMutator

Detailed Description

RawIntrusiveList is the type-unsafe implementation for the type-safe IntrusiveList template.

See InstrusiveList for details.

Definition at line 37 of file RawIntrusiveList.h.


Constructor & Destructor Documentation

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

Definition at line 58 of file RawIntrusiveList.h.

00059     {
00060         pFront = NULL;
00061         pBack = NULL;
00062         nNodes = 0;
00063     }


Member Function Documentation

IntrusiveListNode& RawIntrusiveList::front (  )  const [inline, protected]

Reimplemented in IntrusiveList< T, DerivedListNode >.

Definition at line 65 of file RawIntrusiveList.h.

Referenced by IntrusiveList< T, DerivedListNode >::front().

00066     {
00067         return *pFront;
00068     }

IntrusiveListNode& RawIntrusiveList::back (  )  const [inline, protected]

Reimplemented in IntrusiveList< T, DerivedListNode >.

Definition at line 70 of file RawIntrusiveList.h.

Referenced by IntrusiveList< T, DerivedListNode >::back().

00071     {
00072         return *pBack;
00073     }

void RawIntrusiveList::push_front ( IntrusiveListNode t  )  [protected]

Definition at line 29 of file RawIntrusiveList.cpp.

References nNodes, pBack, pFront, and IntrusiveListNode::pNext.

Referenced by IntrusiveList< T, DerivedListNode >::push_front().

00030 {
00031     assert(!listNode.pNext);
00032     listNode.pNext = pFront;
00033     pFront = &listNode;
00034     if (!pBack) {
00035         pBack = pFront;
00036     }
00037     nNodes++;
00038 }

void RawIntrusiveList::push_back ( IntrusiveListNode t  )  [protected]

Definition at line 40 of file RawIntrusiveList.cpp.

References nNodes, pBack, pFront, and IntrusiveListNode::pNext.

Referenced by IntrusiveList< T, DerivedListNode >::push_back().

00041 {
00042     assert(!listNode.pNext);
00043     listNode.pNext = NULL;
00044     if (pBack) {
00045         pBack = pBack->pNext = &listNode;
00046     } else {
00047         pFront = pBack = &listNode;
00048     }
00049     nNodes++;
00050 }

bool RawIntrusiveList::remove ( IntrusiveListNode  )  [protected]

Definition at line 68 of file RawIntrusiveList.cpp.

Referenced by IntrusiveList< T, DerivedListNode >::remove().

00069 {
00070     for (RawIntrusiveListMutator iter(*this); iter.getCurrent(); ++iter) {
00071         if (iter.getCurrent() == &listNode) {
00072             iter.detach();
00073             return 1;
00074         }
00075     }
00076     return 0;
00077 }

uint RawIntrusiveList::size (  )  const [inline]

Returns:
length of this list

Definition at line 85 of file RawIntrusiveList.h.

Referenced by AioLinuxScheduler::submitRequests().

00086     {
00087         return nNodes;
00088     }

bool RawIntrusiveList::empty (  )  const [inline]

Returns:
true iff size() is zero

Definition at line 93 of file RawIntrusiveList.h.

00094     {
00095         return nNodes ? false : true;
00096     }

void RawIntrusiveList::clear ( bool  debugClear = true  ) 

Truncates this list to zero nodes.

Parameters:
debugClear when true and a DEBUG build is in effect, pNext links of nodes are nulled out

Definition at line 52 of file RawIntrusiveList.cpp.

References nNodes, pBack, pFront, and IntrusiveListNode::pNext.

00053 {
00054     nNodes = 0;
00055 #ifdef DEBUG
00056     if (debugClear) {
00057         IntrusiveListNode *p = pFront;
00058         while (p) {
00059             IntrusiveListNode *pNext = p->pNext;
00060             p->pNext = NULL;
00061             p = pNext;
00062         }
00063     }
00064 #endif
00065     pFront = pBack = NULL;
00066 }


Friends And Related Function Documentation

friend class RawIntrusiveListIter [friend]

Definition at line 39 of file RawIntrusiveList.h.

friend class RawIntrusiveListMutator [friend]

Definition at line 40 of file RawIntrusiveList.h.


Member Data Documentation

uint RawIntrusiveList::nNodes [protected]

Number of nodes in this list.

Definition at line 46 of file RawIntrusiveList.h.

Referenced by clear(), RawIntrusiveListMutator::detach(), push_back(), and push_front().

IntrusiveListNode* RawIntrusiveList::pFront [protected]

First node in this list.

Definition at line 51 of file RawIntrusiveList.h.

Referenced by clear(), RawIntrusiveListMutator::demoteCurrToBack(), RawIntrusiveListMutator::demoteFrontBeforeCurr(), RawIntrusiveListMutator::detach(), RawIntrusiveListMutator::promoteCurrToFront(), push_back(), push_front(), RawIntrusiveListMutator::repositionToFront(), and RawIntrusiveListIter::repositionToFront().

IntrusiveListNode* RawIntrusiveList::pBack [protected]

Last node in this list.

Definition at line 56 of file RawIntrusiveList.h.

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


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