#ifndef _STATE_H
#define _STATE_H

static char State_h_id[] = "$Header: State.h,v 1.2 97/03/20 12:25:09 oreilly Exp $";


/*
$Log:	State.h,v $
 * Revision 1.2  97/03/20  12:25:09  12:25:09  oreilly (Thomas C. O'Reilly)
 * *** empty log message ***
 * 
 * Revision 1.1  96/10/28  09:10:14  09:10:14  oreilly (Thomas C. O'Reilly)
 * Initial revision
 * 
*/

#include "DataManager.h"

/* ***
#include "kalman.h"
#define BadStateValue NAN
*** */


#define BadStateValue -9999.
#define ATTITUDE_DM "TIBURON.VEHICLE.ATTITUDE"
#define POSITION_DM "TIBURON.VEHICLE.POSITION"

#define NStateElements 6
typedef Flt32 StateValue;

enum 
{
  HeadingIndex, PitchIndex, RollIndex, 
  HeadingRateIndex, PitchRateIndex, RollRateIndex
};

class DmStateObject : public DmObject
{
  public:
  DmStateObject(const char *itemName);
  ~DmStateObject();

  virtual Errno read(StateValue *values, DM_Time *t);
  virtual Errno write(StateValue *values, DM_Time *t);
  
  protected:
};


class DmAttitudeObject : public DmStateObject
{
  public:
  DmAttitudeObject(MBool useRaw = FALSE);
  ~DmAttitudeObject();  

  DmObjectType objectType()
  {
    return DmAttitudeType;
  }

  virtual Errno read(StateValue *values, DM_Time *t);
  virtual Errno write(StateValue *values, DM_Time *t);

  protected:
  
  MBool _useRaw;
  
  DmFlt32Object *_rawRoll;
  DmFlt32Object *_rawPitch;
  DmFlt32Object *_rawHeading;
};


class DmPositionObject : public DmStateObject
{
  public:
  DmPositionObject(MBool useRaw = FALSE);
  ~DmPositionObject();  

  DmObjectType objectType()
  {
    return DmPositionType;
  }

  virtual Errno read(StateValue *values, DM_Time *t);
  virtual Errno write(StateValue *values, DM_Time *t);

  protected:

  MBool _useRaw;
  DmFlt64Object *_rawDepth;
  
};



#endif
