// file: tr_latn_cstr_3.cc
//

// isip include files
//
#include "train_lattice_node.h"
#include "train_lattice_node_constants.h"

#include <train_lex_tree.h>
#include <train_lex_tree_constants.h>

// method: copy constructor
//
// arguments:
//  Train_Lattice_node& lat_node_a: (input) Train_Lattice node from which to copy
//                                    information
//
// return: none
//
// this is the copy constructor
//
Train_Lattice_node::Train_Lattice_node(Train_Lattice_node& lat_node_a) {

  // set node identity
  //
  type_d = lat_node_a.type_d;
  word_d = lat_node_a.word_d;
  pron_variant_d = lat_node_a.pron_variant_d;
  frame_d = lat_node_a.frame_d;
  node_index_d = lat_node_a.node_index_d;
  num_arcs_in_d = lat_node_a.num_arcs_in_d;
  num_arcs_out_d = lat_node_a.num_arcs_out_d;
  
  // set node pointers
  //
  if (prev_nodes_d == (Train_Link_list*)NULL) {
    prev_nodes_d = new Train_Link_list(*lat_node_a.prev_nodes_d);
  }
  if (next_nodes_d == (Train_Link_list*)NULL) {
    next_nodes_d = new Train_Link_list(*lat_node_a.next_nodes_d);
  }
  
  // set the lexical tree
  //
  lex_tree_d = lat_node_a.lex_tree_d;

  // set the lm scores array by copying
  //
  if (lm_scores_d != (float_8*)NULL) {
    delete [] lm_scores_d;
  }  
  lm_scores_d = new float_8[num_arcs_out_d];
  for (int_4 i = 0; i < num_arcs_out_d; i++) {
    lm_scores_d[i] = lat_node_a.lm_scores_d[i];
  }          

  // set the ac scores array by copying
  //
  if (ac_scores_d != (float_8*)NULL) {
    delete [] ac_scores_d;
  }  
  ac_scores_d = new float_8[num_arcs_out_d];
  for (int_4 i = 0; i < num_arcs_out_d; i++) {
    ac_scores_d[i] = lat_node_a.ac_scores_d[i];
  }          

  // exit gracefully
  //
}
