//-------------------------------------------------------------------- // // Laboratory 4 listarr2.h // // Class declaration for the array implementation of the List ADT // (Laboratory 3) with modifications to support inheritance by the // array implementation of the Ordered List ADT // //-------------------------------------------------------------------- #ifndef LISTARR2_H #define LISTARR2_H #include using namespace std; const int defMaxListSize = 10; // Default maximum list size class List { public: // Constructor List ( int maxNumber = defMaxListSize ); // Destructor ~List (); // List manipulation operations virtual void insert ( const DataType &newDataItem ) // Insert throw ( logic_error ); void remove () // Remove throw ( logic_error ); virtual void replace ( const DataType &newDataItem ) // Replace throw ( logic_error ); void clear (); // Clear list // List status operations bool isEmpty () const; // List is empty bool isFull () const; // List is full // List iteration operations void gotoBeginning () // Go to beginning throw ( logic_error ); void gotoEnd () // Go to end throw ( logic_error ); bool gotoNext () // Go to next element throw ( logic_error ); bool gotoPrior () // Go to prior element throw ( logic_error ); DataType getCursor () const // Return element throw ( logic_error ); // Output the list structure -- used in testing/debugging void showStructure () const; // In-lab operations (Laboratory 4) void moveToNth ( int n ) // Move element to pos. n throw ( logic_error ); bool find ( const DataType &searchElement ) // Find element throw ( logic_error ); protected: // Data members int maxSize, // Maximum number of elements in the list size, // Actual number of elements in the list cursor; // Cursor array index DataType *dataItems; // Array containing the list elements }; #endif // #ifndef LISTARR2_H