// dlist.h
// Data structures to manage doubly linked lists
//
#ifndef DLIST_H
#define DLIST_H
// The links and values are declared locally in dlist.cc
//
template class Dlink;
template
class Dlist {
public:
Dlist(); // initialize the list
~Dlist(); // de-allocate the list, and any
// items on list
Dlink* First() { return first; } // return the first item
Dlink* Last() { return last; } // return the last item
void Prepend(T value); // add "this" to beginning of list
void Postpend(T value); // add "this" to end of list
void Append(T value, Dlink *p); // add "this" after p
Dlink* Remove(Dlink *p); // Take p out of the list, return p
void Sort();
void Print();
void SelfTest(T start);
private:
Dlink *first; // Head of the list, NULL if list is empty
Dlink *last; // Last element of list
};
#endif // DLIST_H