#ifndef DATA_HH
#define DATA_HH

#include <vector>
#include <string>
#include <math.h>

class Data {
 public:
  Data(const std::string& filename);

  unsigned int size() const { return m_data.size(); }
  double measurement(int i) const { return m_data[i]; }
  double binCenter(int i) const { return m_bins[i] + (m_bins[i+1] - m_bins[i]) / 2.; }
  double binLow(int i) const { return m_bins[i]; }
  double binHigh(int i) const { return m_bins[i+1]; }
  double error(int i) const { return m_error[i]; }
  std::string name() const { return m_name; }

  int checkCompatibility(const Data* in, int N) const;
  double chisquare(double (*f)(double)) const;

  friend Data operator+(const Data& a, const Data& b);

 private:
  Data() {}  // disallow empty data
  void assertSizes();
  std::string m_name;
  std::vector<double> m_data;
  std::vector<double> m_error;
  std::vector<double> m_bins;
};

#endif
