// simplified Account List class // // Based on simplified List Template Class // described in Chapter 9 of // Data Structures in C++ using the STL // // // MAR 4/4/00 - avoided templates // #ifndef ACCTLISTLIST_H #define ACCTLISTLIST_H #include #include "Account-new.h" #include "AcctListNode.h" class AcctList { public: // constructors and destructor AcctList (); // copy constructor AcctList (AcctList & x); // destructor - gives back any storage ~AcctList(); /////////////////// // list operations /////////////////// ////// // inspectors ////// // reports whether the list is empty or not bool empty(); // reports current list size int size(); // show whole list in order void ShowList(); ////// // not exactly inspectors, since making element available ////// // reports first Account in List Account & front(); // reports last Account in List Account & back(); // reports pointer to first Node in List AcctNode * begin(); // reports pointer to last Node in List AcctNode * end(); ////// // mutators ////// // add an element to the front of the list void push_front(Account & newOne); // add an element to the back of the list void push_back(Account & newOne); // remove the front element from the list void pop_front(); // remove the back element from the list void pop_back(); // insert an element at a particular place in a list void insert (AcctNode * placePtr, Account & toAdd); // erase one element from a list (pointed to by param) void erase (AcctNode * toErasePtr); // erase a range of elements from a list // first param is a pointer to the first element to be deleted // second param is a pointer to the first element tot to be deleted // (the first element after the last one to be deleted) void erase (AcctNode * startPtr, AcctNode * keepPtr); private: AcctNode * firstLink; AcctNode * lastLink; int currSize; }; #endif