CS 3050, Spring 2006
Programming Assignment 6
Due Monday, May 30, 2006

Building a Data File with Primary and Secondary Indexes


In this lab we will create and manage a data file of books and its indexes with a program written in C++. The format of the book records is:
The fields will appear in the order given above.  Author, Publisher, and Title fields will be terminated with the character "|" as a delimiter.  The fixed-size fields Size, Have/Have Not, and ISBN will not be terminated with delimiters.

The program supports the following operations: 
The primary index will use ISBN for the key and the byte offset for the reference number. The secondary index will use either Publisher as the key and the primary key as the reference number. In the secondary index, for each secondary key, you should maintain its reference numbers in sorted order. You may use any of the implementations that we have discussed in class for the secondary index (e.g. arrays or linked lists).

The program will do the following:
1. Do a scan of the datafile and create a simple primary index and a secondary index in main memory.
2. Be able to perform a sequence of operations of the following types:
After each search, wait for the user to press a key on the keyboard before processing the next operation to allow the user time to read the results of the search.


The following files are provided:

Data: Lab6.dat

Files courtesy of Jordan Erro:
Main: Lab6.cpp

Classes:
    Book.h
    Buffer.h
    PrimaryIndex.h
    SecondaryIndex.h

You will first need to read, understand and document the .h files, then write the .cpp files for the classes. Once you get things working you are free to modify the programs to make them more robust, as long as you maintain the required functionality.
(Please note that these files have been tested on the sol in the cs domain, you should probably use "save as" rather than cut and paste.)