// file: tr_ht_cstr_0.cc
//

// isip include files
//
#include "train_hash_table.h"
#include "train_hash_table_constants.h"
 
// method: destructor
//
// arguments: none
//
// return: none
//
// this is the destructor for the class
//
Train_Hash_table::~Train_Hash_table() {

  // make sure the table has been allocated
  //
  if (cells_d != (Train_Hash_cell**)NULL) {
    
    // free memory in the hash table lists
    // this is assuming that the items are deleted independently
    //
    Train_Hash_cell* next = (Train_Hash_cell*)NULL;
    for (int_4 k = 0; k < size_d; k++) {
      for (Train_Hash_cell* cell = cells_d[k]; cell != (Train_Hash_cell*)NULL;
	   cell = next) {
	next = cell->get_next_cc();
	delete cell;
      }
    }
    delete [] cells_d;
    cells_d = (Train_Hash_cell**)NULL;
  }

  // reset size
  //
  size_d = (int_4)0;
  mode_d = TRAIN_HASH_TABLE_DEF_MODE;
  
  // exit gracefully
  //
}
