//DLinkedList.h #ifndef DLINKEDLIST_H #define DLINKEDLIST_H #include "DNode.h" // Class DLinkedList: // Is a container class and provides all of the standard // functionality provided by container classes. As elements are added // to it it automatically grows to be able to accept more. // The list can be sorted or not. If chosen to be sorted sorts elements // so that the smaller ones are at the beginning, maintaining the insertion // squence for equally valued elements. // Assumtions made: // - the list is never full unless the machine is out of memory, // what in that case doesnt matter - the function always returns true // and is implemented only for compatibility with other list types. class DLinkedList { private: DNode* first; // head DNode DNode* last; // tail DNode DNode* marker; // current marker position bool sorted; // remembers if list is to be sorted public: DLinkedList(); // default constructor DLinkedList(const bool sort); // sets the bool sorted to sort DLinkedList(const DLinkedList& source); // copy-constructor ~DLinkedList(); // destructor DLinkedList& operator=(const DLinkedList& RHS); // assingment operator // overload bool insert(const ElementD& item); // insertion operation bool deleteData(ElementD& item); // deletion operation ElementD& getData() const; // accessing data at // current marker position bool advanceMarker(); // move marker towards // tail element // in list bool recedeMarker(); // move marker towards // head element // in list void resetMarker(); // move marker back to // head position void goToLast(); // move marker forward to // to tail position bool isEmpty() const; // indicates if empty bool isFull() const; // indicates if full void clear(); // clears list, deallocating // all dynamic data friend class Tester; //Do not remove. Will be //used to test your LL }; #endif