// file: tp_cstr_1.cc
//

// isip include files
//
#include "trace_projector.h"
#include "trace_projector_constants.h"

// method: constructor
//
// arguments: none
//
// return: none
//
// this is the default constructor for the class
//
Trace_projector::Trace_projector(char_1*& param_file_a,
				 logical_1& demo_flag_a) {
  // instantiate the decoder
  //
  decoder_d = new Decoder();

  // variables to hold commandline parameters
  //
  demo_flag_d = ISIP_FALSE;

  // variables to hold data in parameters file
  //
  monophones_file_d = (char_1*)NULL;
  transitions_file_d = (char_1*)NULL;
  states_file_d = (char_1*)NULL;
  models_file_d = (char_1*)NULL;
  phones_file_d = (char_1*)NULL;
  
  lexicon_file_d = (char_1*)NULL;
  lm_file_d = (char_1*)NULL;
  gram_list_file_d = (char_1*)NULL;

  forcealign_file_d = (char_1*)NULL;
  lattice_file_d = (char_1*)NULL;
  outlat_file_d = (char_1*)NULL;
  latwer_file_d = (char_1*)NULL;

  input_file_d = (char_1*)NULL;
  output_file_d = (char_1*)NULL;
  outnbest_file_d = (char_1*)NULL;
  
  ngram_size_d = TP_NGRAM_ORDER;
  num_nbest_d = TP_NUM_NBEST;
  num_hist_d = TP_NUM_HISTORY;

  frontend_params_d = (char_1*)NULL;

  // language model
  //
  word_penalty_d = TP_WORD_PENALTY;
  lm_scale_d = TP_LM_SCALE;
  
  // default function is cross-word lattice rescoring mode with word
  // alignments and binary mfcc input
  //
  function_mode_d = TP_LATTICE_RESCORE_FUNCTION;
  context_mode_d = TP_CROSS_WORD_MODE;
  align_mode_d = TP_WORD_ALIGN_MODE;
  input_format_d = TP_ASCII_FORMAT;
  input_feature_format_d = TP_ISIP_PROTO_FORMAT;
  delta_win_d = TP_DF_DELTA_WIN;
  delta_d = TP_DF_DELTA;
  acc_d = TP_DF_ACC;
  context_size_d = TP_TRIPHONE_SIZE;

  compact_lattice_d = ISIP_FALSE;
  
  // pruning thresholds and parameters
  //
  mapmi_limit_d = (int_4)0;
  num_wdcut_d = (int_4)0;
  num_levels_d = TP_NUM_LEVELS;
  beam_width_d = new float_4[num_levels_d];
  for(int_4 i = 0; i < num_levels_d; i++) {
    beam_width_d[i] = (float_4)0;
  }

  // nbest pruning parameters
  //
  nbest_max_paths_d = TP_NUM_NBEST_MAX_PATH;
  nbest_beam_d = TP_NUM_NBEST_BEAM;

  // set isCommunicator flag
  //
  isCommunicator_d = ISIP_FALSE;

  // segment level mode
  //
  segment_mode_d = TP_NONE_SEGMENT_MODE;
  
  // open parameter file
  //
  FILE* fp = (FILE*)NULL;
  open_file_cc(fp, param_file_a, (char_1*)"r");

  // read parameters
  //
  read_params_cc(fp);
  
  // configure the decoder according to these parameter
  //
  config_decoder_cc(demo_flag_a);
		    
  // exit gracefully
  //
}
