// file: tr_tr_debug_0.cc
//

// isip include files
//
#include "train_trace.h"
#include "train_trace_constants.h"

// method: debug_cc
//
// arguments:
//  FILE* fp: (input) a open file pointer
//  char_1* message: (input) a message to be displayed
//
// return: a logical_1 flag indicating success
//
logical_1 Train_Trace::debug_cc(FILE *fp_a, char_1* message_a) {
  
  // dump the contents of the class to the file
  //
  fprintf(fp_a, "%s::%s lat_node_d = %p\n", TRAIN_TRACE_CLASS_NAME, message_a,
	  lat_node_d);
  if (lat_node_d != (Train_Lattice_node*)NULL) {
    lat_node_d->debug_cc(fp_a, message_a);
  }
  fprintf(fp_a, "%s::%s lex_node_d = %p\n", TRAIN_TRACE_CLASS_NAME, message_a,
	  lex_node_d);
  if (lex_node_d != (Train_Lex_node*)NULL) {
    lex_node_d->debug_cc(fp_a, message_a);
  }

  // level and phone index
  //
  fprintf(fp_a, "%s::%s level_d = %ld\n", TRAIN_TRACE_CLASS_NAME, message_a,
	  level_d);
  fprintf(fp_a, "%s::%s phone_index_d = %ld\n", TRAIN_TRACE_CLASS_NAME, message_a,
	  phone_index_d);

  // path history data
  //
  fprintf(fp_a, "%s::%s backptr_size_d = %ld\n", TRAIN_TRACE_CLASS_NAME, message_a,
	  backptr_size_d);
  fprintf(fp_a, "%s::%s back_ptr_d = %p\n", TRAIN_TRACE_CLASS_NAME, message_a,
	  back_ptr_d);
  for (int_4 i = 0; i < backptr_size_d; i++) {
    if (back_ptr_d[i] == (Train_Trace*)NULL) {
      break;
    }
    back_ptr_d[i]->debug_cc(fp_a, message_a);
  }
  
  // path data
  //
  fprintf(fp_a, "%s::%s frame_index_d = %ld\n", TRAIN_TRACE_CLASS_NAME, message_a,
	  frame_index_d);
  fprintf(fp_a, "%s::%s score_d = %.4f\n", TRAIN_TRACE_CLASS_NAME, message_a,
	  score_d);
  fprintf(fp_a, "%s::%s ref_count_d = %ld\n", TRAIN_TRACE_CLASS_NAME, message_a,
	  ref_count_d);

  // exit gracefully
  //
  return ISIP_TRUE;
}
