// file: tr_mm_delete_4.cc
//
 
// isip include files
//
#include "train_memory_manager.h"
#include "train_memory_manager_constants.h"

#include "train_hash_cell.h"

// method: delete_cc
//
// arguments:
//  Train_Hash_cell* hcell : (input) the node to be put back in the list
//
// return: a logical_1 indicating success
//
// this method takes the input hash table cell and puts it in the free
// hash table cells list
//
logical_1 Train_Memory_manager::delete_cc(Train_Hash_cell* hcell_a) {
  
  // get a link node to hold this hash table cell
  //
  Train_Link_node* node = new_node_cc();
  
  // put the hash table cell in this
  //
  hcell_a->clear_cc();
  node->set_item_cc((void_p)hcell_a);
  
  // insert the incoming node in the node list
  //
  if (hash_count_d == (int_4)0) {
    hash_list_d = node;
  }
  else {
    hash_list_d->insert_cc(node);
  }
  
  // increment free hash table cell count
  //
  hash_count_d++;

  // exit gracefully
  //
  return ISIP_TRUE;
}
