00001 // DataBase.hpp - Binary Search Tree DataBase Class Interface 00002 00003 #ifndef __DataBase_HPP__ // Is it defined already !? 00004 #define __DataBase_HPP__ 00005 00006 #include "Const.hpp" // All the constants 00007 #include "DBase.hpp" // ID, Name & Tel information class 00008 #include "String.hpp" // My own personnal String class 00009 #include "BST.hpp" 00010 #include "BinNode.hpp" 00011 00012 class DataBase { 00013 00014 public: 00015 00016 DataBase(); // Default Construtor 00017 virtual ~DataBase(); // Destructor 00018 int read(const char* datafile); // Read and scan a datafile 00019 00020 private: 00021 00022 double findID(int index); // Calculate the nb of comparisions 00023 // for each commands when searching for an ID 00024 00025 DBase* _db; // Contains ID, Name & Tel information 00026 // from the new command line. 00027 00028 DBase* _current; // Contains the current ID, Name & Tel info 00029 char* cmd; 00030 00031 BinSearchTree* BST; // Contains the Double-Linked list Object 00032 00033 double pos; // Where we found the ID in the list 00034 double* cmp; // Table of comparisons for each command 00035 double* NbCmp; // Number of calls to FindID for each command 00036 00037 private: 00038 // No COPY CONSTRUCTOR needed. 00039 inline DataBase( const DataBase& src ); 00040 inline const DataBase& operator= ( const DataBase& src ); 00041 }; 00042 00043 #endif // End of DataBase.hpp