-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.h
More file actions
47 lines (40 loc) · 967 Bytes
/
code.h
File metadata and controls
47 lines (40 loc) · 967 Bytes
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
#ifndef CODE_H
#define CODE_H
#include <string>
#include <variant>
#include <vector>
//example: 006196|maxObliqueRange|long|Distance oblique maximal d'utilisation des donnees|m|-3|0|16
struct Code {
int code = -1;
std::string name;
std::string type;
std::string description;
std::string unit;
int factor = 0;
int offset = 0;
int size = 0;
};
struct SmallCode {
int code = -1;
int factor = 0;
int offset = 0;
int size = 0;
std::variant<std::nullopt_t, long long, double, std::string> value = std::nullopt;
unsigned long pos = -1;
unsigned long repetitions = 0;
std::vector<SmallCode> block;
SmallCode() = default;
explicit SmallCode(Code code) :
code{code.code},
factor{code.factor},
offset{code.offset},
size{code.size}
{}
};
inline bool operator<(const Code& left, const Code& right) {
return left.code < right.code;
}
inline bool operator<(const SmallCode& left, const SmallCode& right) {
return left.code < right.code;
}
#endif