// file: dtn_cstr_0.cc
//

// isip include files
//
#include "dt_node.h"
#include "dt_node_constants.h"

// method: destructor
//
// arguments: none
//
// return: none
//
// this is the default destructor
//
Dt_node::~Dt_node() {
  
  // reset parent pointer
  //
  parent_d = (Dt_node*)NULL;

  // free children
  //
  if(l_child_d!=(Dt_node*)NULL) {
    delete l_child_d;
  }
  
  if(r_child_d!=(Dt_node*)NULL) {
    delete r_child_d;
  }
  
  l_child_d = (Dt_node*)(NULL);
  r_child_d = (Dt_node*)(NULL);

  // clear the optimal question
  //
  opt_question_d = (Question*)NULL;
  
  // delete the states related data
  //
  num_states_d = 0;
  
  if( state_index_d != (int_4*)NULL) {
    delete [] state_index_d;
  }
  state_index_d = (int_4*)NULL;
  
  // delete the likelihood
  //
  likelihood_d = (float_4)0;
  split_lk_inc_d = (float_4)0;
  
  // delete the label value
  //
  label_d = (int_4)0;
  
  // reset the visited flag
  //
  flag_leaf_d = ISIP_TRUE ;
  flag_visit_d = ISIP_FALSE;
  
  // exit gracefully
  //
}
