//-------------------------------------------------------------------- // // Laboratory 2 ptlist.h // // Class declaration for the array implementation of the Point // List ADT // //-------------------------------------------------------------------- const int defMaxListSize = 10; // Default maximum list size //-------------------------------------------------------------------- class Point { public: Point ( float x0 = 0, float y0 = 0 ) // Constructor { x = x0; y = y0; } float x, y; // Point coordinates (can be accessed directly) }; //-------------------------------------------------------------------- class PointList { public: // Constructor PointList ( int maxNumber = defMaxListSize ); // Destructor ~PointList (); // List manipulation operations void append ( Point newPoint ); // Append point to list void clear (); // Clear list // List status operations int empty () const; // List is empty int full () const; // List is full // List iteration operations int gotoBeginning (); // Go to beginning int gotoEnd (); // Go to end int gotoNext (); // Go to next point int gotoPrior (); // Go to prior point Point getCursor () const; // Return point // Output the list structure -- used in testing/debugging void showStructure () const; // In-lab operations void operator = ( const PointList &rightList ); // Assignment void insertBeginning ( Point newPoint ); // Insert begin. private: // Data members int maxSize, // Maximum number of points in the list size, // Actual number of points in the list cursor; // Cursor array index Point *ptlist; // Array containing the points };