#ifndef LIST_OF_PEOPLE_H #define LIST_OF_PEOPLE_H // // ============================================================ // // ListOfPeople // in an elevator simulator // // ============================================================ // #include "Person.h" class ListOfPeople { private : // Head and tail of the list Person *_head, *_tail ; // Private output function used by operator<< ostream& output ( ostream& ) const ; public : // Constructors ListOfPeople () ; // Copy Constructor ListOfPeople ( const ListOfPeople& ) ; // Destructor virtual ~ListOfPeople () ; // Assignment ListOfPeople& operator= ( const ListOfPeople& ) ; // Comparison friend int operator== ( const ListOfPeople&, const ListOfPeople& ) ; friend int operator!= ( const ListOfPeople&, const ListOfPeople& ) ; // Output friend ostream& operator<< ( ostream&, const ListOfPeople& ) ; // How to get things onto the list: push onto the // front, or append onto the rear. void push ( const Person& ) ; void push ( Person* ) ; void append ( const Person& ) ; void append ( Person* ) ; // Inquiry about the list int is_empty () const ; int is_not_empty () const ; // Length of the list int length() const ; // Total weight of the people on the list double weight() const ; // Decrementing times for people. Used as the // clock ticks. void decrement_stay() ; void decrement_entry_time() ; // Access the head of the list Person * head() const ; // Remove a person from the list void remove ( Person * ) ; // Remove a person from the front of the list Person * get () ; // Remove the first person from the list who can // go to a certain floor Person * get_for_floor ( const int ) ; } ; #endif