-
Notifications
You must be signed in to change notification settings - Fork 16
/
fieldcoding.h
83 lines (55 loc) · 2.47 KB
/
fieldcoding.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
#ifndef FIELDCODING_H
#define FIELDCODING_H
#include "protocolscaling.h"
class FieldCoding : public ProtocolScaling
{
public:
FieldCoding(ProtocolSupport sup);
//! Perform the generation, writing out the files
bool generate(std::vector<std::string>& fileNameList, std::vector<std::string>& filePathList);
protected:
//! Get a human readable type name like "unsigned 3 byte integer".
std::string getReadableTypeName(int type);
//! Generate the encode header file
bool generateEncodeHeader(void);
//! Generate the encode source file
bool generateEncodeSource(void);
//! Generate the helper functions in the encode source file
void generateEncodeHelpers(void);
//! Generate the decode header file
bool generateDecodeHeader(void);
//! Generate the decode source file
bool generateDecodeSource(void);
//! Generate the one line brief comment for the encode function
std::string briefEncodeComment(int type, bool bigendian);
//! Generate the full comment for the encode function
std::string fullEncodeComment(int type, bool bigendian);
//! Generate the encode function signature
std::string encodeSignature(int type, bool bigendian);
//! Generate the full encode function
std::string fullEncodeFunction(int type, bool bigendian);
//! Generate the float encode function
std::string floatEncodeFunction(int type, bool bigendian);
//! Generate the integer encode function
std::string integerEncodeFunction(int type, bool bigendian);
//! Generate the one line brief comment for the decode function
std::string briefDecodeComment(int type, bool bigendian);
//! Generate the full comment for the decode function
std::string fullDecodeComment(int type, bool bigendian);
//! Generate the decode function signature
std::string decodeSignature(int type, bool bigendian);
//! Generate the full decode function
std::string fullDecodeFunction(int type, bool bigendian);
//! Generate the float decode function
std::string floatDecodeFunction(int type, bool bigendian);
//! Generate the integer decode function
std::string integerDecodeFunction(int type, bool bigendian);
//! List of built in type names
std::vector<std::string> typeNames;
//! List of type names in function signature
std::vector<std::string> typeSigNames;
//! Size of built in types
std::vector<int> typeSizes;
std::vector<bool> typeUnsigneds;
};
#endif // FIELDCODING_H