Arff.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Arff.h
  2. #ifndef __ARFF_H__
  3. #define __ARFF_H__
  4. #include "ArffBase.h"
  5. #include <chrono>
  6. using namespace std;
  7. // struct that holds the information about the change in one point
  8. struct Change
  9. {
  10. Change() {row=0; column=0; value=0;
  11. time=chrono::system_clock::now();
  12. }
  13. Change(int r, int c, int val){row=r; column=c;
  14. value=val; time=chrono::system_clock::now();
  15. }
  16. int row;
  17. int column;
  18. double value;
  19. chrono::system_clock::time_point time;
  20. };
  21. class Arff : public ArffBase
  22. {
  23. public:
  24. Arff();
  25. Arff(const char* filename);
  26. void Save(const char *filename);
  27. void ChangeData(int row, int column, double value);
  28. ///< This function is called instead of the oveloaded [] operator in
  29. ///< case that we require a reversible change.
  30. int WidthPx() const;
  31. void SetWidthPx(int width);
  32. int HeightPx() const;
  33. void SetHeightPx(int height);
  34. void UndoLastChange();
  35. void RedoLastChange();
  36. bool IsDataChanged();
  37. private:
  38. vector<Change> m_changes;
  39. vector<Change> m_redoChanges;
  40. bool m_isChanged;
  41. void MoveChanges(vector<Change> &from, vector<Change> &to);
  42. };
  43. #endif /*__ARFF_H__*/