B15F
Board 15 Famulus Edition
plottyfile.h
1 #ifndef PLOTTYFILE_H
2 #define PLOTTYFILE_H
3 
4 #include <iostream>
5 #include <fstream>
6 #include <exception>
7 #include <vector>
8 #include "dot.h"
9 
10 enum FunctionType
11 {
12  CurveFamily = 'S',
13  Curve = 'C',
14  Level = 'P'
15 };
16 
18 {
19 public:
20  void addDot(Dot& dot);
21  void addDot(Dot dot);
22 
23  void setFunctionType(FunctionType);
24  void setQuadrant(uint8_t);
25  void setRefX(uint16_t);
26  void setRefY(uint16_t);
27  void setParaFirstCurve(uint16_t);
28  void setParaStepWidth(uint16_t);
29  void setUnitX(std::string);
30  void setDescX(std::string);
31  void setUnitY(std::string);
32  void setDescY(std::string);
33  void setUnitPara(std::string);
34  void setDescPara(std::string);
35 
36  FunctionType getFunctionType(void) const;
37  uint8_t getQuadrant(void) const;
38  uint16_t getRefX(void) const;
39  uint16_t getRefY(void) const;
40  uint16_t getParaFirstCurve(void) const;
41  uint16_t getParaStepWidth(void) const;
42  std::string getUnitX(void) const;
43  std::string getDescX(void) const;
44  std::string getUnitY(void) const;
45  std::string getDescY(void) const;
46  std::string getUnitPara(void) const;
47  std::string getDescPara(void) const;
48 
49  void writeToFile(std::string filename);
50  void startPlotty(std::string filename);
51 private:
52  void prepStr(std::string& str, uint8_t len);
53 
54  std::vector<Dot> dots;
55 
56  int8_t command = 0x1D;
57  const std::string head = "HTWK-HWLab";
58  const std::string filetype = "MD";
59  int16_t version = 1;
60  int16_t subversion = 0;
61  FunctionType function_type = FunctionType::Curve;
62  uint8_t quadrant = 1;
63  uint16_t ref_x = 1023;
64  uint16_t ref_y = 1023;
65  uint16_t para_first = 1;
66  uint16_t para_stepwidth = 1;
67  std::string unit_x;
68  std::string desc_x;
69  std::string unit_y;
70  std::string desc_y;
71  std::string unit_para;
72  std::string desc_para;
73  const uint8_t eof = 0xD;
74 
75  constexpr static uint8_t STR_LEN_SHORT = 10;
76  constexpr static uint8_t STR_LEN_LARGE = 20;
77 };
78 
79 #endif // PLOTTYFILE_H
PlottyFile
Definition: plottyfile.h:17
Dot
Definition: dot.h:7