//------------------------------------------------------------------------------ class Header { Record* First; // byte offset of first record int NRecords; // total number of records MainIndex* MainIndexRoot; // pointer to root of main index tree Index2* Index2Root; // pointer to root of 2nd index tree }; // Header //------------------------------------------------------------------------------ class Record { int ID; // unique record ID char* Name; // Last Name char* OtherInfo; // stuff void MarkRecord ( Record* Rec ); // THIS IS ALREADY WRITTEN // marks a record as deleted void InsertRecord ( Record* NewRec, int& success ); // YOU WRITE THIS // add a new record to the file // NewRec already contains all required data // success = byte offset of the new record // or ?1 if unsuccessful int FindRecord ( int ID ); // YOU WRITE THIS TOO ? used by DELETE // finds record; // returns byte offset of found record or ?1 if not found void DeleteRecord ( int ID, int& success ); // YOU WRITE THIS TOO // deletes record from file // success = -1 if delete was unsuccessful // 0 if all went well // N indicating nature of error }; // Record //------------------------------------------------------------------------------ class MainIndex { int Key; // same as ID from Record int Offset; // byte offset of record in file MainIndex* Left; // left sub-tree MainIndex* Right; // right sub-tree void InsertMainIndex ( MainIndex* NewEntry, int& success ); // ASSUME THIS CODE IS WRITTEN // inserts new index entry into tree // success = byte offset of the new record or ?1 if unsuccessful MainIndex* FindMainIndex ( int ID ); // ASSUME THIS CODE IS WRITTEN // finds main index entry; // returns pointer to index enrty or ?1 if not found void DeleteMainIndex ( int ID, int& success ); // ASSUME THIS CODE IS WRITTEN // deletes main index entry from tree // success = -1 if delete was unsuccessful // 0 if all went well // N indicating nature of error }; // MainIndex //------------------------------------------------------------------------------ class Index2 { char* Key2; // same as Name from Record MainInex* List[100]; // list of pointers to MainIndex // one for each entry in main index that has this name int ListN; // count of pointers in previous list Index2* Left; // left sub-tree Index2* Right; // right sub-tree void InsertIndex2 ( Index2* NewEntry, int& success ); // ASSUME THIS CODE IS WRITTEN // inserts new index entry into tree // success = byte offset of the new record // or ?1 if unsuccessful Index2* FindIndex2 ( int ID ); // ASSUME THIS CODE IS WRITTEN // finds Secondary index entry; // returns pointer to index enrty or ?1 if not found void DeleteIndex2 ( int ID, int& success ); // ASSUME THIS CODE IS WRITTEN // deletes Secondary index entry from tree // success = -1 if delete was unsuccessful // 0 if all went well // N indicating nature of error }; // Index2