// file: tr_latn_add_3.cc
//

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

// method: add_lm_score_cc
//
// arguments:
//  float_8 lm_score: (input) lm score to be added
//
// return: logical_1 indicating status
//
// this method adds the lm score for the node just created
//
logical_1 Train_Lattice_node::add_lm_score_cc(float_8 lm_score_a) {

  // define a temporary array
  //
  float_8* new_list = new float_8[num_arcs_out_d];

  // check if the lm_scores array exists
  //
  if (lm_scores_d != (float_8*)NULL) {
    
    // copy old data to new array
    //
    memcpy(new_list, lm_scores_d, (num_arcs_out_d - 1) * sizeof(float_8));
  }
  
  // add the new value to the end of the array
  //
  new_list[(num_arcs_out_d - 1)] = lm_score_a;
  
  // free old memory and reset pointers
  //
  if (lm_scores_d != (float_8*)NULL) {
    delete [] lm_scores_d;
    lm_scores_d = (float_8*)NULL;
  }
  lm_scores_d = new_list;    
  
  // exit gracefully
  //
  return ISIP_TRUE;
}






