- A Logic Circuit Simulation Library in C++ |
#include <list.h>
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) |
T | last () |
int | getSize (void) |
void | operator= (const List< T > &l) |
Copy constructor. It is only a reference copier.
Destructor. It does consider the number of references to the object before destruction.
void lcs::List< T >::append | ( | T | node | ) |
Appends a node to the end of the list. It is equivalent to push.
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.
ListIterator< T > lcs::List< T >::getListIterator | ( | void | ) |
Returns an iterator for the list.
int lcs::List< T >::getSize | ( | void | ) |
Returns the number of data nodes in the list.
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.
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.
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.
void lcs::List< T >::push | ( | T | node | ) |
Pushes a node to the end of the list. It is equivalent to append. Infact push calls the function append.
void lcs::List< T >::remove | ( | T | e | ) |
Removes all list elements equal to e
.