// file: hist_init_1.cc
//

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

// method: init_cc
//
// arguments:
//  void_p word: (input) the word node
//  int_4 level: (input) the level in the search space hierarchy
//  int_4 phone: (input) the model index
//  int_4 state: (input) the state index
//  int_4 frame: (input) the time stamp of creation
//  float_4 score: (input) the path score at this point
//
// return: a logical_1 indicating status
//
// this method sets all elements of the history
//
logical_1 History::init_cc(void_p* word_a, int_4 level_a, int_4 phone_a,
			   int_4 state_a, int_4 frame_a, float_4 score_a) {

  // set the parameters
  //
  level_d = level_a;
  phone_index_d = phone_a;
  state_index_d = state_a;

  if (histwords_d != (void_p*)NULL) {
    delete [] histwords_d;
  }
  histwords_d = word_a;

  // initialize the link list
  //
  if (prev_d != (Link_list*)NULL) {
    delete prev_d;
  }
  prev_d = (Link_list*)NULL;
  hist_num_d = (int_4)0;

  // set the path parameters
  //
  frame_index_d = frame_a;
  score_d = score_a;
  ref_count_d = (int_4)0;
  
  // exit gracefully
  //
  return ISIP_TRUE;
}
