#ifndef OneSample_h
#define OneSample_h

#include <vector>
#include <QString>

// Hold a single recorded sample for one button press. Basically just an
// array of unsigned short.
//
class OneSample {
public:

   OneSample(const std::vector<unsigned short> & init_data);

   OneSample(const OneSample & cpy);

   ~OneSample();

   unsigned int
   Length() const;

   unsigned short
   operator[](unsigned int ndx) const;

   const unsigned short *
   Data() const {
         return data;
      }

      // Return true if this sample is OK, false if the analysis
      // of dutton data has decided to mark it as a bad sample.
      //
   bool
   SampleOK() {
         return sample_ok;
      }

      // If analyzer decides to reject this sample, it calls this
      // to mark it bad and record why.
      //
   void
   MarkSampleBad(const QString & the_reason) {
         sample_ok = false;
         reason = the_reason;
      }

   QString
   RejectionReason() {
         return reason;
      }

   unsigned long
   TotalTime() {
         return total_time;
      }

   double
   LogTotalTime() {
         return log_total_time;
      }

private:

   unsigned int      len;
   unsigned short * data;
   bool              sample_ok;
   QString           reason;
   unsigned long     total_time;
   double            log_total_time;
};

#endif // OneSample_h
