All pastes #385791 Raw Edit

Something

public text v1 · immutable
·published 2007-03-08 02:19 UTC
rendered paste body
template <class T>
struct HashItem {
  bool isEmpty; // indicates whether this item has data or not
  T data;       // the actual data of the item
};


template <class T>
class PermHash {
  fstream datafile; // where to read/write the data
  int cap_;         // the number of indices on the table
  int max_;         // the maximum number of records allowed on the table
  int size_;        // how many records are on the table currently
  int recSize;      // the size of one record in the table

public:
  PermHash(const char*, int);
  virtual ~PermHash();

  virtual bool remove(const char*);
  virtual bool find(const char*, T&);
  virtual bool update(const T&);

  int cap()const { return cap_; };
  int max()const { return max_; };
  int size()const { return size_; };

private:
  bool getPosFor(const char*, int&);
  bool getItemAt(int, HashItem<T>&);
  void putItemAt(int, HashItem<T>);
  vo