// // File: List.h Class and type definitions for the // C++ dynamic memory allocation implementation of ADT list // #ifndef LIST_H #define LIST_H #include "El.h" typedef struct Node * NodePtr; struct Node { El el; NodePtr next; }; class List { public: // List constructor and destructor List (); -List (); // Methods that manipulate list nodes void storeInfo(El); El retrieveInfo(); El retrieveNextInfo(); // Methods that manipulate the list void insert(El); void insertAfter(El); void remove(); // Methods that traverse the list void toFirst(); void advance(); // Methods that test for certain conditions bool atFirst(); bool atEnd(); bool listIsEmpty(); bool listIsFull(); bool curIsEmpty(); private: NodePtr head; // pointer to head node NodePtr cur; // pointer to current node NodePtr prev; // pointer to previous node NodePtr makeNode(El); void destroyNode(NodePtr p); void nodeReferenceError(); }; #endif