reSIProcate/rutil  9694
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | Friends
resip::IntrusiveListElement< P > Class Template Reference

#include <IntrusiveListElement.hxx>

Inheritance diagram for resip::IntrusiveListElement< P >:
Inheritance graph
[legend]
Collaboration diagram for resip::IntrusiveListElement< P >:
Collaboration graph
[legend]

List of all members.

Classes

class  iterator

Public Member Functions

 IntrusiveListElement ()
virtual ~IntrusiveListElement ()
bool empty () const
iterator begin ()
iterator end ()
void push_front (P elem)
void push_back (P elem)
void remove ()

Static Public Member Functions

static P makeList (P elem)

Protected Attributes

mNext
mPrev

Friends

class iterator

Detailed Description

template<class P>
class resip::IntrusiveListElement< P >

Definition at line 61 of file IntrusiveListElement.hxx.


Constructor & Destructor Documentation

template<class P>
resip::IntrusiveListElement< P >::IntrusiveListElement ( ) [inline]

Definition at line 64 of file IntrusiveListElement.hxx.

         : mNext(0),
           mPrev(0)
      {}
template<class P>
virtual resip::IntrusiveListElement< P >::~IntrusiveListElement ( ) [inline, virtual]

Definition at line 69 of file IntrusiveListElement.hxx.

      {
         remove();
      }

Member Function Documentation

template<class P>
iterator resip::IntrusiveListElement< P >::begin ( ) [inline]

Definition at line 133 of file IntrusiveListElement.hxx.

Referenced by main(), and resip::RRCache::purge().

      {
         assert(mPrev);
         assert(mNext);
         return iterator(mNext);
      }
template<class P>
bool resip::IntrusiveListElement< P >::empty ( ) const [inline]

Definition at line 85 of file IntrusiveListElement.hxx.

Referenced by main().

      {
         assert(mPrev);
         assert(mNext);

         return static_cast<const IntrusiveListElement<P>*>(mNext) == static_cast<const IntrusiveListElement<P>*>(this);
      }
template<class P>
iterator resip::IntrusiveListElement< P >::end ( ) [inline]

Definition at line 140 of file IntrusiveListElement.hxx.

Referenced by main().

      {
         assert(mPrev);
         assert(mNext);
         return iterator(static_cast<P>(this));
      }
template<class P>
static P resip::IntrusiveListElement< P >::makeList ( elem) [inline, static]

Definition at line 75 of file IntrusiveListElement.hxx.

      {
         assert(!elem->IntrusiveListElement<P>::mNext);

         elem->IntrusiveListElement<P>::mPrev = elem;
         elem->IntrusiveListElement<P>::mNext = elem;

         return elem;
      }
template<class P>
void resip::IntrusiveListElement< P >::push_back ( elem) [inline]

Definition at line 163 of file IntrusiveListElement.hxx.

Referenced by resip::RRCache::cacheTTL(), main(), resip::RRCache::touch(), resip::RRCache::updateCache(), and resip::RRCache::updateCacheFromHostFile().

      {
         assert(mPrev);
         assert(mNext);

         elem->IntrusiveListElement<P>::mPrev = mPrev;
         elem->IntrusiveListElement<P>::mNext = static_cast<P>(this);
         
         elem->IntrusiveListElement<P>::mPrev->IntrusiveListElement<P>::mNext = elem;
         elem->IntrusiveListElement<P>::mNext->IntrusiveListElement<P>::mPrev = elem;
      }
template<class P>
void resip::IntrusiveListElement< P >::push_front ( elem) [inline]

Definition at line 150 of file IntrusiveListElement.hxx.

Referenced by main().

      {
         assert(mPrev);
         assert(mNext);

         elem->IntrusiveListElement<P>::mNext = mNext;
         elem->IntrusiveListElement<P>::mPrev = static_cast<P>(this);
         
         elem->IntrusiveListElement<P>::mNext->IntrusiveListElement<P>::mPrev = elem;
         elem->IntrusiveListElement<P>::mPrev->IntrusiveListElement<P>::mNext = elem;
      }
template<class P>
void resip::IntrusiveListElement< P >::remove ( ) [inline]

Definition at line 175 of file IntrusiveListElement.hxx.

Referenced by resip::RRCache::purge(), and resip::RRCache::touch().

      {
         if (mNext)
         {
            // prev  -> this -> next
            //       <-      <-
            //
            // prev -> next
            //      <-
            mNext->IntrusiveListElement<P>::mPrev = mPrev;
            mPrev->IntrusiveListElement<P>::mNext = mNext;
         }

         mNext = 0;
         mPrev = 0;
      }

Friends And Related Function Documentation

template<class P>
friend class iterator [friend]

Member Data Documentation

template<class P>
P resip::IntrusiveListElement< P >::mNext [mutable, protected]
template<class P>
P resip::IntrusiveListElement< P >::mPrev [mutable, protected]

The documentation for this class was generated from the following file: