class AllTimeList { private: class Node { public: String2002 name; Time bestTime; Node *next, *prior; // Node *nextInBucket; // Needed only if you want hashing with buckets. // constructor fills in data and makes pointers both NULL Node (const String2002 &name, const Time &bestTime) { Node::name = name; Node::bestTime = bestTime; next = prior = NULL; } }; // head and tail pointers for "by time" linked list Node *fastest, *slowest; Node* *table; // pointer to dynamically allocated hash table int tableSize; // size of hash table int count; bool walkInProgress; Node *walkPosition; // points to last node visited int hash (const String2002 &name) const; // Given a newly created node containing a name and a time, // inserts this node into the linked list at its correct position. void addNodeToList (Node* node); // Given a node that is already on the linked list but which // contains a modified time, adjusts the node's list position. void moveNodeIfNecessary (Node* node); // By declaring copy construction and assignment to be private, // we effectively make these operations illegal. "AllTimeList" // objects cannot be initialized, passed by value, returned by functions, // or assigned. AllTimeList (const AllTimeList &otherList); AllTimeList &operator= (const AllTimeList &otherList); public: AllTimeList (int capacity); // capacity = max expected entries ~AllTimeList (); // Adds a new swimmer to the table with his/her best time. // Throws "invalid_argument" exception if name already exists. // Throws "overflow_error" exception if table too full. void add (const String2002 &name, const Time &bestTime); // Updates the best time for this swimmer if the time given is // the existing swimmer's best. // Throws "invalid_argument" exception if no such name. // Has no effect if the time is slower than the existing best time. void reportTime (const String2002 &name, const Time &time); // Returns the best time for the given swimmer. // Throws "invalid_argument" exception if no such name Time lookupTime (const String2002 &name) const; // These methods work in the usual way. Walks start with // the fastest ever person and run through the slowest ever. bool startWalk (String2002 &name, Time &time); bool continueWalk (String2002 &name, Time &time); };