/**************************************************************************************************/
/*                                                                                                */
/*  Name:  DarC KonQuesT                                                                          */
/*  Program:  #                                                                                   */
/*  Date:  2005.                                                                                  */
/*  Purpose:                                                                                      */
/*     Estimate efficiency of quotient offset hashing using prebuilt hash_map3.h                  */
/*                                                                                                */
/*                                                                                                */
/*                                                                                                */
/**************************************************************************************************/

#include <iostream>
#include <fstream>
#include "hash_map3.h"

using namespace std;

class hash_func
{
  public:
    unsigned long operator() (const string& key)
    {
       const unsigned long BIG_PRIME = 4294967291;
       unsigned long total = 0;
       for (unsigned i = 0; i < key.length(); i++)
         total += 13 * key [i];
       return total * BIG_PRIME;
    }
};


int main()
{
  typedef hash_map <string, int, hash_func> hash_map_class;
  
  float start_time, finish_time, elapsed_time;
  string word, in_file;
  fstream input;
  hash_map_class string_map;
  
  in_file = "input.dat";
  input.open(in_file.c_str(), ios::in);
  start_time = clock();
  input >> word;
  while(input >> word)
  {
   string_map.insert(value_type<const string, int> (word, 0));
  }
 
  finish_time = clock();
  elapsed_time = finish_time - start_time;
  cout << endl << "Start time was: " <<  start_time << endl;
  cout << endl << "End time was: " <<  finish_time << endl;
  cout << endl << "Elapsed time was: " <<  elapsed_time << endl;  

  return 0;        
}

