// file: token.h
//
// this is the header for the path token class
//

// make sure definitions are only made once
//
#ifndef __ISIP_TOKEN
#define __ISIP_TOKEN

// isip include files
//
#ifndef __ISIP_INTEGRAL
#include <integral.h>
#endif

// forward declaration of classes
//
#ifndef __ISIP_LINK_LIST
#include <link_list.h>
#endif

#ifndef __ISIP_TRACE
#include <trace.h>
#endif

// Token: a class that is used to hold path information at each state
//
class Token {
  
  //---------------------------------------------------------------------------
  //
  // protected data
  //
  //---------------------------------------------------------------------------
protected:

  // state-level properties
  //
  int_4 state_d;                      // the state index

  // trace information
  //
  Trace* trace_d;                     // the best new trace
  Trace* marker_d;                    // the best current trace
  
  //---------------------------------------------------------------------------
  //
  // public methods
  //
  //---------------------------------------------------------------------------
public:
 
  // required methods
  //
  char_1* name_cc();
  volatile void error_handler_cc(char_1* mname, char_1* msg);
  logical_1 debug_cc(FILE* fp, char_1* message);
  int_4 size_cc();
    
  // destructors/constructors
  //
  ~Token();  
  Token();                                          // default
  Token(int_4 state);                               // overloaded
  Token(Token& token);                              // copy

  // set methods
  //
  logical_1 set_state_cc(int_4 state) {
    state_d = state;
    return ISIP_TRUE;
  }
  
  logical_1 set_trace_cc(Trace* tr) {
    trace_d = tr;
    return ISIP_TRUE;
  }

  logical_1 set_marker_cc(Trace* tr) {
    marker_d = tr;
    return ISIP_TRUE;
  }

  // get methods
  //
  int_4 get_state_cc() {
    return state_d;
  }
  
  Trace* get_trace_cc() {
    return trace_d;
  }
  
  Trace* get_marker_cc() {
    return marker_d;
  }

  // trace update methods
  //
  logical_1 insert_trace_cc(Trace* tr, logical_1 flag, float_4& score);

  logical_1 reset_marker_cc() {
    marker_d = trace_d;
    trace_d = (Trace*)NULL;
    return ISIP_TRUE;
  }
  
  logical_1 prune_cc(float_4 beam, logical_1 flag, int_4& ndel);
  logical_1 prune_all_cc(logical_1 flag, int_4& ndel);
  
  //---------------------------------------------------------------------------
  //
  // private methods
  //
  //---------------------------------------------------------------------------
private:

};

// end of file
// 
#endif
