// file: train_state.h
//
// this is the header file for the Train_State class
//

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

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

// Train_State: a class that defines an HMM state with Gaussian mixture
// components, each mixture is assumed to have a diagonal covariance
// matrix
//
class Train_State {

  //---------------------------------------------------------------------------
  //
  // protected data
  //
  //---------------------------------------------------------------------------
protected:
  
  // contents of the state
  //
  static int_4 num_features_d;               // size of feature vector
  int_4 num_mixtures_d;                      // number of mixtures
  float_4* weights_d;                        // log mixture weights
  float_4* scale_d;                          // Gaussian log scale factors
  float_4** mean_d;                          // mean vectors
  float_4** covar_d;                         // inv diagonal covar matrices
  int_4 frame_d;                             // current frame index
  float_8 score_d;                           // score for this frame
  int_4 state_index_d;                       // unique state index
  
  //---------------------------------------------------------------------------
  //
  // 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
  //
  ~Train_State();
  Train_State();
  Train_State(int_4 num_mix, float_4* weights, float_4* scale, float_4** mean,
	float_4** covar);
  Train_State(const Train_State& state);

  // static methods
  //
  static logical_1 set_num_features_cc(int_4 num_feat);
  static int_4 get_num_features_cc();

  // set methods
  //
  logical_1 set_num_mixtures_cc(int_4 num_mix);
  logical_1 set_weights_cc(float_4* weights);
  logical_1 set_scale_cc(float_4* scale);
  logical_1 set_mean_cc(float_4** mean);
  logical_1 set_covar_cc(float_4** covar);
  logical_1 set_frame_cc(int_4 frame);
  logical_1 set_state_index_cc(int_4 state_ind);

  // get methods
  //
  int_4 get_num_mixtures_cc();
  float_4* get_weights_cc();
  float_4* get_scale_cc();
  float_4** get_mean_cc();
  float_4** get_covar_cc();
  int_4 get_state_index_cc();

  // read data from file
  //
  logical_1 read_data_cc(FILE* fp);
  
  // transform methods
  //
  float_8 eval_score_cc(float_8* data, int_4 frame, int_4& max_mix);
  float_8 eval_score_cc(int_4 mix_ind, float_8* data);

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

};

// end of file
//
# endif
