// file: hist_init_0.cc
//

// isip include files
//
#include "history.h"
#include "history_constants.h"

// method: clear_cc
//
// arguments: none
//
// return: a logical_1 indicating status
//
// this method resets all elements of the history
//
logical_1 History::clear_cc() {

  // delete memory in the link list
  //
  if (prev_d != (Link_list*)NULL) {
    delete prev_d;
  }
  prev_d = (Link_list*)NULL;

  // delete memory in score list
  //
  if (prevsc_d != (float_4*)NULL) {
    delete [] prevsc_d;
    prevsc_d = (float_4*)NULL;
  }

  // reset number of histories
  //
  hist_num_d = (int_4)0;

  // reset the parameters
  //
  if (histwords_d != (void_p*)NULL) {
    delete [] histwords_d;
    histwords_d = (void_p*)NULL;
  }
  score_d = HISTORY_DEFAULT_SCORE;
  level_d = HISTORY_DEFAULT_INDEX;
  phone_index_d = HISTORY_DEFAULT_INDEX;
  state_index_d = HISTORY_DEFAULT_INDEX;
  frame_index_d = (int_4)0;
  ref_count_d = (int_4)0;
  
  // exit gracefully
  //
  return ISIP_TRUE;
}
