#ifndef DTCLUSTERHMM_HH
#define DTCLUSTERHMM_HH

#include "DecisionTool.hh"
#include "SmartSamplerData.hh"
#include "HMM.hh"
#include <vector>

#define DEBUG_CLUSTER_STATE false

/****************************************************************************
 *
 * Specific instance of a DecisionTool, using an HMM model and the
 * cluster server.  The HMM consists a number of states and state
 * transition probabilities, as well as a number of conditional
 * probabilities of cluster value given state.
 *
 ****************************************************************************/

class dtClusterHMM : public DecisionTool{
public:
  typedef struct{
    state_t state;
    prob_t thresh;
  }fot_t;
  typedef std::vector<fot_t>::iterator foti_t;
  

  dtClusterHMM(char *name);
  ~dtClusterHMM();

  
  void loadConfig(char *cfgname,SmartSamplerData *ssdIn);
  bool update();
  void reset();

private:
  char *cluster_name; // Name of classifier
  char *m_name; // Name of this particular DT (may be multiple DT's for a single classifier)
  HMM m_hmm;
  std::vector<fot_t> firethresh;

  SmartSamplerData *ssd;

  void dumpstate();
  bool fireDecision();
}; // dtClusterHMM

#endif // DTCLUSTERHMM
