using namespace std; #include #include "bowlingAlley.h" #include "QueueP.h" #ifndef BOWLINGORWAITING_H #define BOWLINGORWAITING_H class bowlingOrWaiting: public bowlingAlley { public: void displayGroups(ostream& out) const throw(outputException); // Displays a list of all parties bowling and all parties // in the waiting queue. // Precondition: out is a valid ostream ready to output // Postcondition: The information for each group is output to the // stream. No particular order can be guaranteed. A header line is // given before the first group. Each group is displayed on a // single line. See party::printOut for more information. If // the bowlingAlley is empty, no output is produced. Parties in // the waiting queue are printed seperate from bowling parties // Exception: If out ever enters the fail state, an outputException // exception is thrown void assignGroup(const party& newGroup) throw(bowlingAlleyFull, duplicateGroup); // Assigns newGroup a lane in the bowlingAlley or adds the party // to the waiting queue. // Precondition: newGroup has not already been assigned a lane // Postcondition: newGroup is assigned a lane if one is available or // added to the waiting queue otherwise. Duplicates are allowed in // the waiting queue. // Exceptions: If a duplicate group is given, a duplicateGroup // exception is thrown. // Note: This function will not throw bowlingAlleyFull. This // exception is included for compatability with bowlingAlley. void removeGroup(const party& group) throw(groupNotPresent); // removes group from the list of assigned groups. Assigns first // unique group in the waiting queue the available lane. // Precondition: group is a party currently assigned a lane // Postcondition: group is removed from the list of assigned groups. // If the waiting queue is non-empty, the first unique party is // assigned the availabe lane. Duplicates are ignored. // Exception: If group is not currently assigned a lane, a // groupNotPresent exception is thrown. private: Queue waiting; }; #endif