/*************************************************************************/ /* File: ins_rec.h Author: B. De Hamer */ /* */ /* Class InsRecord is derived from DBItem and is used to store info */ /* about instructors in the InsDB. InsRecord has fields for the name of */ /* an instructor as well as lists of his/her class and time preferences */ /*************************************************************************/ #ifndef INS_RECORD #define INS_RECORD #include "node.h" #include "ins_name.h" #include "ins_course_list.h" #include "time_list.h" #include "std-macros.h" typedef float Rank ; typedef int WTU ; class InsRecord : public Node { public: InsRecord () ; // Construct a default InsRecord InsRecord (const InsName&) ; // Construct a new instructor with the given name InsRecord (const InsRecord&) ; // Construct a new InsRecord from an existing one InsRecord (char*) ; // Construct an InsRecord from the given stream of data. // To be used only by InsDB::Read(). ~InsRecord () ; // Destruct an InsRecord void AddCoursePref (CourseID id, int weight) ; // Adds a course to the instructor's course preference list. void AddTimePref (char* days, float start, float end, int weight) ; // Adds a time preference to the instructor's time preference list. InsCourseList& GetCourseList () ; // Returns the instructor's course preference list. TimeList& GetTimeList () ; // Returns the instructor's time preference list. InsName& GetName (); // Returns the name of this instructor Boolean HasMinWTUs () ; // Returns true if the instructor has exceeded the minimum WTUs // Returns false otherwise Boolean HasMaxWTUs () ; // Returns true if the instructor has exceed the maximum WTUs // Returns false otherwise void SortCoursePrefs () ; // Sorts the instructor's course preferences by weight void SortTimePrefs () ; // Sorts the instructor's time preferences by weight void SetPickyRank () ; // Calculates the instructor's pickiness rank float GetPickyRank () ; // Return this instructor's pickiness rank void operator= (const InsRecord&) ; // Assign the argument to this InsRecord void sout (ostream&) ; // Output instructor to file void print () const ; // Print the instructor Node* copy() const ; // Returns a copy of this instructor /** * View-handling fucntions. */ UpdatePrefs(); /* * Do processing in response to "OK" button in View. */ protected: InsName name ; // Instructor's first and last name TimeList time_list ; // List of day and time preferences TimeList scheduled_times ; // List of days/times scheduled InsCourseList course_list ; // List of course preferences WTU wtu ; // Current amount of WTU's WTU min_wtu ; // Minimum WTU's required WTU max_wtu ; // Maximum WTU's allowed Boolean handicap_flag ; // Is instructor handicapped? Rank picky_rank ; // Instructor's pickiness rank InsUI* view; // Companion View } ; #endif