// file: state.h
//
// this is the header file for the State class
//

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

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

#ifndef __ISIP_INTEGRAL_CONSTANTS
#include <integral_constants.h>
#endif

// State: a class that defines an HMM state with Gaussian mixture
// components, each mixture is assumed to have a diagonal covariance
// matrix
//
class 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_4 score_d;                           // score for this frame
  
  //---------------------------------------------------------------------------
  //
  // 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
  //
  ~State();
  State();
  State(int_4 num_mix, float_4* weights, float_4* scale, float_4** mean,
	float_4** covar);
  State(const State& state);

  // static methods
  //
  static logical_1 set_num_features_cc(int_4 num_feat) {
    num_features_d = num_feat;
    return ISIP_TRUE;
  }
  
  static int_4 get_num_features_cc() {
    return num_features_d;
  }

  // set methods
  //
  logical_1 set_num_mixtures_cc(int_4 num_mix) {
    num_mixtures_d = num_mix;
    return ISIP_TRUE;
  }
  
  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_score_cc(float_4 score) {
    score_d = score;
    return ISIP_TRUE;
  }
  
  logical_1 set_frame_cc(int_4 frame) {
    frame_d = frame;
    return ISIP_TRUE;
  }
  
  // get methods
  //
  int_4 get_num_mixtures_cc() {
    return num_mixtures_d;
  }
  
  float_4* get_weights_cc() {
    return weights_d;
  }
  
  float_4* get_scale_cc() {
    return scale_d;
  }
  
  float_4** get_mean_cc() {
    return mean_d;
  }
  
  float_4** get_covar_cc() {
    return covar_d;
  }
  
  float_4 get_score_cc() {
    return score_d;
  }
  
  int_4 get_frame_cc() {
    return frame_d;
  }
  
  // read data from file
  //
  logical_1 read_data_cc(FILE* fp);
  
  // transform methods
  //
  float_4 eval_score_cc(float_4* data, int_4 frame);

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

};

// end of file
//
# endif
