// file: train_lex_tree.h
//
// this is the header file for the lexical tree class
//

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

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

#ifndef __ISIP_TRAIN_TRACE
#include <train_trace.h>
#endif

#ifndef __ISIP_TRAIN_LEX_NODE
#include <train_lex_node.h>
#endif

#ifndef __ISIP_TRAIN_LATTICE_NODE
#include <train_lattice_node.h>
#endif

#ifndef __ISIP_TRAIN_LINK_LIST
#include <train_link_list.h>
#endif

#ifndef __ISIP_TRAIN_WORD
#include <train_word.h>
#endif

#ifndef __ISIP_TRAIN_HASH_TABLE
#include <train_hash_table.h>
#endif

// Train_Lex_tree: a class that holds a lexical tree
//
class Train_Lex_tree {

  //---------------------------------------------------------------------------
  //
  // protected data
  //
  //---------------------------------------------------------------------------
protected:

  // the word-history for this lexical tree
  //
  Train_Hash_cell* history_d;

  // the start node for the tree
  //
  Train_Lex_node* head_d;

  // flag to indicate active status
  //
  logical_1 status_d;
  
  //---------------------------------------------------------------------------
  //
  // public methods
  //
  //---------------------------------------------------------------------------
public:
  
  // required methods
  //
  char_1* name_cc();
  volatile void error_handler_cc(char_1* method_name, char_1* message);
  logical_1 debug_cc(FILE *fp, char_1* message);
  int_4 size_cc();
  
  // destructors/constructors
  //
  ~Train_Lex_tree();
  Train_Lex_tree();                                             // default
  Train_Lex_tree(Train_Hash_cell* history);                     // overloaded
  Train_Lex_tree(Train_Lex_tree& tree);                         // copy

  // set data access methods
  //
  logical_1 set_history_cc(Train_Hash_cell* history);
  logical_1 set_head_cc(Train_Lex_node* node);
  logical_1 set_status_cc(logical_1 status);
  
  // get data access methods
  //
  Train_Hash_cell* get_history_cc();
  Train_Lex_node* get_head_cc();
  logical_1 get_status_cc();

  // setting up the tree
  //
  logical_1 build_tree_cc(Train_Lattice_node* lat_node, float_8 score);
  logical_1 build_traintree_cc(int_4* phn_ind, int_4* phones, int_4 num_ph,
			       int_4 num_mono, Train_Lattice_node* lat_node);
  
  logical_1 build_train_tree_cc(char_1* phn_list, char_1** monophones,
				int_4 num_mono, Train_Lattice_node* lat_node);
  

  // count the number of nodes in the tree
  //
  int_4 num_lexnodes_cc();
  
  //---------------------------------------------------------------------------
  //
  // private methods
  //
  //---------------------------------------------------------------------------
private:

};

// end of file
// 
#endif
