Description
- Date : 5 bytes
- End : 5 bytes
- Type : 8 bytes
- Place : 15 bytes
- Reference : 7 bytes
- Description : variable
In the data file, an asterisk is also used to delimit each field and the last character of each record is an asterisk. The width of any record is never greater than 120 bytes. Therefore you can block the data accordingly. This part of the project will require you to implement the following class:
Class Table : Public Filesys
{
Public :
Table(string diskname,int blocksize,int numberofblocks, string flatfile, string indexfile);
int Build_Table(string input_file);
int Search(string value);
Private :
string flatfile;
string indexfile;
int IndexSearch(string value);
};
The member functions are specified as follows :
-
Table(diskname,blocksize,numberofblocks,flatfile,indexfile)
This constructor creates the table object. It creates the new (empty) files flatfile and indexfile in the file system on the Sdisk using diskname.
-
Build_Table(input_file)
This module will read records from the input file (the raw data file described above), add the records to the flatfile and create index records consisting of the date and block number, and then add the index records to the index file. (Note that index records will have 10 bytes .. 5 bytes for the date and 5 bytes for the block number.)
-
Search(value)
This module accepts a key value, and searches the index file with a call to IndexSearch for the record where the date matches the specified value. IndexSearch returns the blocknumber of the block in the flat file where the target record is located. This block should then be read and the record displayed.
-
IndexSearch(value)
This module accepts a key value, and searches the index file indexfile for the record where the date matches the specified value. IndexSearch then returns the block number key of the index record where the match occurs.
See the main program for Shell here which includes a search command.

