// file: tr_tok_cstr_0.cc
//

// isip include files
//
#include "train_token.h"
#include "train_token_constants.h"

// method: destructor
//
// arguments: none
//
// return: none
//
// this is the default destructor
//
Train_Token::~Train_Token() {

  // dummy variables
  //
  Train_Memory_manager* manager = Train_Link_list::get_manager_cc();

  // remove the path information
  //
  Train_Trace* tr = (Train_Trace*)NULL;
  Train_Link_node* pd = (Train_Link_node*)NULL;
  if (trace_list_d != (Train_Link_list*)NULL) {
    for (Train_Link_node* node = trace_list_d->get_head_cc();
	 node != (Train_Link_node*)NULL; node = pd) {
      pd = node->get_next_cc();
      tr = (Train_Trace*)(node->get_item_cc());
      if (tr != (Train_Trace*)NULL) {
	manager->delete_cc(tr);
      }
      trace_list_d->remove_cc(node);
    }
    delete trace_list_d;
    trace_list_d = (Train_Link_list*)NULL;
  }

  // reset markers
  //
  marker_d = (Train_Link_node*)NULL;
  prev_marker_d = (Train_Link_node*)NULL;
  
  // reset params
  //
  state_d = TRAIN_TOKEN_DEFAULT_INDEX;
  score_d = TRAIN_TOKEN_DEFAULT_SCORE;
  
  // exit gracefully
  //
}
