// file: dec_cstr_2.cc
//

// isip include files
//
#include "decoder.h"
#include "decoder_constants.h"
 
// method: constructor
//
// arguments:
//
//  Decoder& decoder: (input) the decoder object to copy
//
// return: none
//
// this is the copy constructor for the class
//
Decoder::Decoder(Decoder& decoder_a) {

  // reset function and align modes
  //
  restructure_memory_d = decoder_a.restructure_memory_d;
  function_mode_d = decoder_a.function_mode_d;
  context_mode_d = decoder_a.context_mode_d;
  align_mode_d = decoder_a.align_mode_d;
  input_format_d = decoder_a.input_format_d;
  input_feature_format_d = decoder_a.input_feature_format_d;
  demo_mode_d = decoder_a.demo_mode_d;

  // reset delta and acceleration computaional modes
  //
  delta_win_d = decoder_a.delta_win_d;
  delta_d = decoder_a.delta_d;
  acc_d = decoder_a.acc_d;
    
  // number of utterances decoded
  //
  num_utt_d = decoder_a.num_utt_d;
  
  // levels in the search hierarchy
  //
  num_levels_d = decoder_a.num_levels_d;

  // timing information
  //
  frame_d = decoder_a.frame_d;
  frame_dur_d = decoder_a.frame_dur_d;

  // input feature data information
  //
  num_feat_d = decoder_a.num_feat_d;
  features_d = decoder_a.features_d;
  
  // acoustic model information
  //
  // context independent models
  //
  ci_models_d = decoder_a.ci_models_d;
  num_ci_d = decoder_a.num_ci_d;

  // context dependent models
  //
  cd_models_d = decoder_a.cd_models_d;
  cdmap_d = decoder_a.cdmap_d;
  cd_size_d = decoder_a.cd_size_d;
  num_cd_d = decoder_a.num_cd_d;
  
  // Hidden Markov models
  //
  models_d = decoder_a.models_d;
  num_models_d = decoder_a.num_models_d;
  
  // state transition matrices
  //
  transitions_d = decoder_a.transitions_d;
  num_trans_d = decoder_a.num_trans_d;

  // model states
  //
  states_d = decoder_a.states_d;
  num_states_d = decoder_a.num_states_d;

  // lexicon
  //
  lexicon_d = decoder_a.lexicon_d;
  num_words_d = decoder_a.num_words_d;
  
  // lm related parameters
  //
  lmscale_d = decoder_a.lmscale_d;
  wdpenalty_d = decoder_a.wdpenalty_d;
  ngram_order_d = decoder_a.ngram_order_d;
  ngram_d = decoder_a.ngram_d;
  gram_list_d = decoder_a.gram_list_d;
  lattice_d = decoder_a.lattice_d;
  compact_lattice_d = decoder_a.compact_lattice_d;
  
  // path information
  //
  // active model instances
  //
  inst_table_d = decoder_a.inst_table_d;
  inst_list_d = decoder_a.inst_list_d;
  inst_count_d = decoder_a.inst_count_d;

  // hypotheses information
  //
  nbest_d = decoder_a.nbest_d;
  num_hyps_d = decoder_a.num_hyps_d;
  num_nbest_d = decoder_a.num_nbest_d;
  
  // path history information
  //
  history_list_d = decoder_a.history_list_d;
  num_hist_d = decoder_a.num_hist_d;

  // lexical tree information
  //
  proto_tree_d = decoder_a.proto_tree_d;
  lextree_list_d = decoder_a.lextree_list_d;

  // list of traces at model level
  //
  active_models_d = decoder_a.active_models_d;
  model_trlist_d = decoder_a.model_trlist_d;
  num_active_models_d = decoder_a.num_active_models_d;

  // list of traces at word level
  //
  active_words_d = decoder_a.active_words_d;
  word_scores_d = decoder_a.word_scores_d;
  word_trlist_d = decoder_a.word_trlist_d;
  num_active_words_d = decoder_a.num_active_words_d;

  // pruning-related information
  //
  // beam pruning information
  //
  max_score_d = decoder_a.max_score_d;
  beam_d = decoder_a.beam_d;
  beam_thresh_d = decoder_a.beam_thresh_d;

  // instance pruning information
  //
  mapmi_limit_d = decoder_a.mapmi_limit_d;
  mapmi_thresh_d = decoder_a.mapmi_thresh_d;

  // word-end pruning information
  //
  num_wordends_d = decoder_a.num_wordends_d;
  wordend_thresh_d = decoder_a.wordend_thresh_d;

  // demo information
  //
  num_steps_d = decoder_a.num_steps_d;

  // trace generation and other statistics
  //
  num_traces_total_d = decoder_a.num_traces_total_d;
  num_traces_gen_d = decoder_a.num_traces_gen_d;
  num_traces_del_d = decoder_a.num_traces_del_d;
  total_gen_d = decoder_a.total_gen_d;
  total_del_d = decoder_a.total_del_d;

  // special models
  //
  sil_model_d = decoder_a.sil_model_d;
  sp_model_d = decoder_a.sp_model_d;
  sp_score_d = decoder_a.sp_score_d;
  
  // memory manager
  //
  manager_d = decoder_a.manager_d;

  // Communicator API
  //
  if (buf_d) {
    free(buf_d);
  }
  
  // model-level segment information
  //
  model_seglist_d = decoder_a.model_seglist_d;
  
  // exit gracefully
  //
}

