-
Notifications
You must be signed in to change notification settings - Fork 0
/
PORIS.h
98 lines (81 loc) · 2.32 KB
/
PORIS.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// This code is (c) 2021 cosmoBots.eu
#ifndef _PORIS_H
#define _PORIS_H
#include <iostream>
#include <list>
#include <iterator>
#include <string>
using namespace std;
class PORIS {
public:
int id;
uint8_t idx;
std::string ident;
std::string name;
std::string description;
PORIS *parent;
virtual ~PORIS() = default;
};
class PORISParam;
class PORISSys;
class PORISValue : public PORIS {
public:
};
class PORISValueFloat : public PORISValue {
public:
double data;
double min;
double max;
double default_data;
double setData(double floatdata);
};
class PORISValueText : public PORISValue {
public:
string data;
string default_data;
double setData(string strdata);
};
class PORISMode : public PORIS {
public:
std::list<PORISValue *> values;
std::list<PORISMode *> submodes;
PORISValue *getEligibleValue(PORISValue *v);
PORISMode *getEligibleSubMode(PORISMode *m);
uint8_t getEligibleValue(uint8_t idx);
uint8_t getEligibleSubMode(uint8_t idx);
};
class PORISNode : public PORIS {
public:
std::list<PORISMode *> modes;
PORISMode *selectedMode = NULL;
virtual void init(void);
virtual PORISMode* setMode(PORISMode *m) = 0;
virtual uint8_t setMode(uint8_t idx);
PORISMode *setEligibleMode(void);
PORISMode *getEligibleMode(PORISMode *m);
uint8_t getEligibleMode(uint8_t idx);
};
class PORISParam : public PORISNode {
public:
std::list<PORISValue *> values;
PORISValue *selectedValue = NULL;
PORISMode* setMode(PORISMode *m) override;
uint8_t setMode(uint8_t idx) { return PORISNode::setMode(idx); };
PORISValue *setEligibleValue(void);
PORISValue *getEligibleValue(PORISValue *v);
PORISValue *setValue(PORISValue *v);
uint8_t getEligibleValue(uint8_t idx);
uint8_t setValue(uint8_t idx);
};
class PORISSys : public PORISNode {
public:
std::list<PORISParam *> params;
std::list<PORISSys *> subsystems;
PORISMode* setMode(PORISMode *m) override;
uint8_t setMode(uint8_t idx) { return PORISNode::setMode(idx); };
PORISSys *getSubSystemFromName(string name);
PORISParam *getSubParamFromName(string name);
PORISSys *getDescendantFromName(string name);
PORISParam *getDescendantParamFromName(string name);
};
#endif //_PORIS_H