// file: trace.h
//
// this is the header for the path list class that holds a sorted list of
// partial paths at a particular time frame
//

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

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

#ifndef __ISIP_HASH_TABLE
#include <hash_table.h>
#endif

#ifndef __ISIP_LINK_LIST
#include <link_list.h>
#endif

#ifndef __ISIP_NBEST_NODE
#include <nbest_node.h>
#endif

// Path_list: a class that is used as the list of partial paths
//
class Path_list {
  
  //---------------------------------------------------------------------------
  //
  // protected data
  //
  //---------------------------------------------------------------------------
protected:
  
  // sorted linked list of partial paths in the form nbest_node objects
  //
  Link_list* paths_d;          // list of partial paths
  int_4 num_paths_d;           // current number of partial paths on the list
  
  // time information	       
  //			       
  int_4 frame_index_d;         // frame this path list was created

  // score of the best partial path in this list
  //
  float_8 max_score_d;
  
  //---------------------------------------------------------------------------
  //
  // 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
  //
  ~Path_list();  
  Path_list();                                  // default
  Path_list(Path_list& Path_list);                  // copy

  // previous history links methods
  //
  logical_1 set_paths_cc(Link_list* paths);
  Link_list* get_paths_cc();

  // frame index methods
  //
  logical_1 set_frame_ind_cc(int_4 count);  
  int_4 get_frame_ind_cc();
  logical_1 incr_frame_ind_cc();

  // number of paths related functions
  //
  logical_1 set_num_paths_cc(int_4 count);  
  int_4 get_num_paths_cc();

  // max score related methods
  //
  logical_1 set_max_score_cc(float_8 score);  
  float_8 get_max_score_cc();
  
  // add a partial path to this list
  //
  logical_1 add_path_cc(Nbest_node* path);

  // extend the partial paths
  //
  logical_1 grow_paths_cc(Path_list**& path_lists, float_8 lm_scale,
			  float_8 wd_penalty, int_4 max_paths,
			  float_8 beam);

  // beam pruning
  //
  logical_1 prune_cc(float_8 beam_a, int_4 max_paths);

  //---------------------------------------------------------------------------
  //
  // private methods
  //
  //---------------------------------------------------------------------------
private:

};

// end of file
// 
#endif
