- A Logic Circuit Simulation Library in C++





lcs::List< T > Class Template Reference

#include <list.h>

List of all members.


Detailed Description

template<class T>
class lcs::List< T >

A class encapsulating a doubly linked list.


Public Member Functions

 List (void)
 List (const List< T > &l)
 ~List ()
void append (T node)
void push (T node)
void pop (void)
ListIterator< T > getListIterator (void)
void remove (T e)
void destroy (void)
last ()
bool isPresent (const T &t)
int getSize (void)
void operator= (const List< T > &l)


Constructor & Destructor Documentation

template<class T>
lcs::List< T >::List ( void   ) 

Default Constructor.

template<class T>
lcs::List< T >::List ( const List< T > &  l  ) 

Copy constructor. It is only a reference copier.

template<class T>
lcs::List< T >::~List (  ) 

Destructor. It does consider the number of references to the object before destruction.


Member Function Documentation

template<class T>
void lcs::List< T >::append ( node  ) 

Appends a node to the end of the list. It is equivalent to push.

template<class T>
void lcs::List< T >::destroy ( void   ) 

Destroys the list. All the memory held by the list is destroyed. Care has to be taken in using this method when the list data has multiple references. In case of an object with multiple references is destroyed to empty-ness, then the multiple references would no longer hold. Each individual object would have its own data in memory on subsequent refilling of the object.

template<class T>
ListIterator< T > lcs::List< T >::getListIterator ( void   ) 

Returns an iterator for the list.

template<class T>
int lcs::List< T >::getSize ( void   ) 

Returns the number of data nodes in the list.

template<class T>
bool lcs::List< T >::isPresent ( const T &  t  ) 

Checks if an element is present in the list. Returns true if present, false if not. The type T should support the operator '==' for this function to compile successfully.

template<class T>
T lcs::List< T >::last (  ) 

Returns the data in the last node of the list. The parameter validity will hold true on success and false on failure.

template<class T>
void lcs::List< T >::operator= ( const List< T > &  l  ) 

Assignment operator. It is only a reference copier. i.e., after an assignment operation, the l-value and the r-value share the same data.

template<class T>
void lcs::List< T >::pop ( void   ) 

Pops a node from the end of the list. Does nothing in case of an empty list.
In case of an object with multiple references is pop-ed out to empty-ness, then the multiple references would no longer hold. Each individual object would have its own data in memory on subsequent refilling of the object.

template<class T>
void lcs::List< T >::push ( node  ) 

Pushes a node to the end of the list. It is equivalent to append. Infact push calls the function append.

template<class T>
void lcs::List< T >::remove ( e  ) 

Removes all list elements equal to e.


Copyright © 2006, 2007 Siva Chandra