Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

Slist< T > Class Template Reference

#include <nilist.h>

Inheritance diagram for Slist< T >:

Inheritance graph
[legend]
Collaboration diagram for Slist< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void insert (const T &a)
void append (const T &a)
get ()

Private Member Functions

void insert (slink *a)
void append (slink *a)
void remove (slink *a, slink *prev)
slinkfind (int key)
void clear ()
int count ()
slinklast ()
int ac ()
int rc ()

Friends

class Slist_iter< T >
class slist_base_iter

template<class T>
class Slist< T >


Member Function Documentation

int slist_base::ac  )  [inline, inherited]
 

Definition at line 65 of file nilist.h.

References slist_base::append_count_.

00065 {return append_count_;} /* XXX */

void slist_base::append slink a  )  [inherited]
 

Definition at line 80 of file nilist.cc.

References slist_base::append_count_, slist_base::count_, slist_base::last_, and slink::next_.

Referenced by Slist< T >::append(), and Islist< Segment >::append().

00081 {
00082     append_count_++; /* XXX */
00083     count_++;
00084     if (last_) {
00085         a->next_ = last_->next_;
00086         last_ = last_->next_ = a;
00087     }
00088     else
00089         last_ = a->next_ = a;
00090 }

template<class T>
void Slist< T >::append const T &  a  )  [inline]
 

Definition at line 98 of file nilist.h.

References slist_base::append().

00099          { slist_base::append(new Tlink<T>(a));}

Here is the call graph for this function:

void slist_base::clear  )  [inline, inherited]
 

Definition at line 62 of file nilist.h.

References slist_base::last_.

00062 {last_ = 0;}

int slist_base::count  )  [inline, inherited]
 

Reimplemented in Islist< T >, Islist< TcpSessionAgent >, Islist< IntTcpAgent >, and Islist< Segment >.

Definition at line 63 of file nilist.h.

References slist_base::count_.

Referenced by slist_base_iter::count(), and Islist< Segment >::count().

00063 {return count_;}        

slink * slist_base::find int  key  )  [inherited]
 

Reimplemented in Islist< T >, Islist< TcpSessionAgent >, Islist< IntTcpAgent >, and Islist< Segment >.

Definition at line 104 of file nilist.cc.

References slink::key_, slist_base::last_, and slink::next_.

Referenced by Islist< Segment >::find().

00105 {
00106     slink *cur = last_;
00107     
00108     if (last_ == 0) return NULL;
00109     do {
00110         cur = cur->next_;
00111         if (cur->key_ == key)
00112             return cur;
00113     } while (cur != last_);
00114     return NULL;
00115 }

template<class T>
T Slist< T >::get  ) 
 

Reimplemented from slist_base.

Definition at line 40 of file nilist.cc.

References slist_base::get(), and Tlink< T >::info.

00041 {
00042     Tlink<T>* lnk = (Tlink<T>*) slist_base::get();
00043     T i = lnk->info;
00044     delete lnk;
00045     return i;
00046 }

Here is the call graph for this function:

void slist_base::insert slink a  )  [inherited]
 

Definition at line 48 of file nilist.cc.

References slist_base::count_, slist_base::last_, and slink::next_.

Referenced by Slist< T >::insert(), and Islist< Segment >::insert().

00049 {
00050     count_++;
00051     if (last_)
00052         a->next_ = last_->next_;
00053     else
00054         last_ = a;
00055     last_->next_ = a;
00056 }

template<class T>
void Slist< T >::insert const T &  a  )  [inline]
 

Definition at line 96 of file nilist.h.

References slist_base::insert().

00097          { slist_base::insert(new Tlink<T>(a));}

Here is the call graph for this function:

slink* slist_base::last  )  [inline, inherited]
 

Definition at line 64 of file nilist.h.

References slist_base::last_.

00064 {return last_;}    /* XXX */

int slist_base::rc  )  [inline, inherited]
 

Definition at line 66 of file nilist.h.

References slist_base::remove_count_.

00066 {return remove_count_;} /* XXX */

void slist_base::remove slink a,
slink prev
[inherited]
 

Definition at line 59 of file nilist.cc.

References slist_base::count_, slist_base::last_, slink::next_, and slist_base::remove_count_.

Referenced by Islist< Segment >::remove().

00060 {
00061     remove_count_++; /* XXX */
00062     count_--;
00063     if (prev && prev->next_ != a)
00064             printf("In remove(): Error: prev->next!=a  prev=%p  a=%p\n", prev, a);
00065     if (last_ == NULL) 
00066         return;
00067     if (prev == NULL)
00068         if (last_->next_ == a)
00069             prev = last_;
00070         else 
00071             return;
00072 
00073     prev->next_ = a->next_;
00074     if (last_ == a)             // a was last in list
00075         last_ = prev;
00076     if (last_->next_ == a)      // a was only one in list
00077         last_ = NULL;
00078 }


Friends And Related Function Documentation

friend class slist_base_iter [friend, inherited]
 

Definition at line 67 of file nilist.h.

template<class T>
friend class Slist_iter< T > [friend]
 

Definition at line 94 of file nilist.h.


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 13:23:29 2004 for NS2.26SourcesOriginal by doxygen 1.3.3