// file: dec_insert_1.cc
//
 
// isip include files
//
#include "decoder.h"
#include "decoder_constants.h"
 
// method: insert_word_cc
//
// arguments:
//  Link_list*& tr_list: (input) the word level trace list
//  Trace* trace: (input) the trace to be inserted
//  
// return: a logical_1 indicating status
//
// this method inserts the given trace in the specified word level
// trace list
//
logical_1 Decoder::insert_word_cc(Link_list*& tr_list_a, Trace* trace_a) {

  // allocate trace list if one doesn't exist yet
  //
  if (tr_list_a == (Link_list*)NULL) {
    tr_list_a = new Link_list();
  }

  // update maximum score
  //
  float_4 score = trace_a->get_score_cc();
  if (score > max_score_d[DEC_WORD_LEVEL]) {
    max_score_d[DEC_WORD_LEVEL] = score;
  }

  // insert the trace and update count
  //
  tr_list_a->insert_cc(trace_a);
  num_traces_gen_d[DEC_WORD_LEVEL]++;

  // exit gracefully
  //
  return ISIP_TRUE;
}
