21 #include <sys/types.h>    49         std::cout <<
"LinkList: Adding first "<<
this<<
" with previous "<< prev << 
" next " << next <<std::endl;
    57         std::cout <<
"LinkList: Adding "<<
this<<
" with previous "<< prev << 
" next " << next <<std::endl;
    60         (*oldOne).next = 
this;
    69         std::cout <<
"LinkList: getNext =  "<< next <<std::endl;
    78         std::cout <<
"LinkList: getPrev =  "<< prev <<std::endl;
   106 #ifdef LINKLIST_DEBUG   107         std::cout <<
"LinkList:~LinkList  removing "<<std::endl;
   119     void add(TYPE newElement) { 
   120 #ifdef LINKLIST_DEBUG   121         std::cout <<
"LinkList:add "<< newElement <<std::endl;
   128         lug->
ptr = newElement;
   138 #ifdef LINKLIST_DEBUG   139         std::cout <<
"LinkList:change "<< changeElement <<std::endl;
   142             TYPE tempPtr = lug->
ptr;
   143             lug->
ptr = changeElement;
   158             TYPE tempPtr = lug->
ptr;
   213 #ifdef LINKLIST_DEBUG   214         std::cout <<
"LinkList:current " <<std::endl;
   227 #ifdef LINKLIST_DEBUG   228         std::cout <<
"LinkList:next "<<std::endl;
   260 #ifdef LINKLIST_DEBUG   261         std::cout <<
"LinkList:grab "<< i <<std::endl;
   264             std::cerr<<
"LinkList: grab: index is less then or equal to zero"<<std::endl;
   266         } 
else if (i>count) {
   267             std::cerr<<
"LinkList: grab: index exceeds count"<<std::endl;
   279 #ifdef LINKLIST_DEBUG   280         std::cout <<
"LinkList:getCount "<< count <<std::endl;
 TYPE change(TYPE changeElement)
exchange lugs The current lug is replaced with this lug. 
Lug * getPrev(void)
Return a pointer to the previous element. 
TYPE current(void)
return a pointer to the current lug 
Lug * getNext(void)
Return a pointer to the next element. 
TYPE grab(int i)
returns the i'th lug in the chain irrespective of direction 
direction dir
The current direction. 
TYPE prev(void)
Return a pointer to the previous lug and move to that lug Increments against dir (either forward or b...
Lug(Lug< TYPE > *oldOne)
Links to previous element and next element. 
long count
The number in the list. 
LinkList(void)
Initialiser This is for the first element - links to itself. 
Lug< TYPE > * startLug
The first Lug in the looped list. 
Lug< TYPE > * next
Links to the next and prev elements in the list. 
TYPE next(void)
Return a pointer to the next lug and move on to that lug Increments according to dir (either forward ...
Lug(void)
This is for the first element - links to itself. 
Defines a lug in a linked list The concept is simple, this Lug points to a next or previous Lug...
void add(TYPE newElement)
Adds as the current element ... Added to the next of the current lug. 
std::ostream & operator<<(std::ostream &stream, const BitStream &bitStream)
Lug< TYPE > * lug
The current Lug we are pointing to. 
virtual ~LinkList(void)
Small cleanup ...