/* * CSI2131 Winter 2005 * * Assignment#2 Solution : The IndexedDatafile class *( Handles both the index and the datafile reads the operations file and executes operations ) * * Shantanu Das */ #ifndef INDEXED_DATAFILE_H #define INDEXED_DATAFILE_H #include "Record.h" #include "Index.h" #include "DataFile.h" #include #include #include using namespace std; class IndexedDatafile { private: Index *ind; // Pointer to the index object DataFile *dfp; // Pointer to the datafile object Record *rp; // Pointer to Record for internal use //internal functions void search(Record& rec); // execute search operation and print results void insert(Record& rec); // execute insert operation and print results void readData(fstream& fs,Record &rec); // input the fields of the record to be inserted public: IndexedDatafile(DataFile &x); //Constructor virtual ~IndexedDatafile(); //Destructor int createIndex(); // create the index for existing records in datafile int executeOp(fstream &fs); // execute operations from file fs }; #endif