-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintrospec.h
More file actions
126 lines (94 loc) · 3.2 KB
/
introspec.h
File metadata and controls
126 lines (94 loc) · 3.2 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#ifndef INTROSPECTION_H
#define INTROSPECTION_H
class IntrospecObject;
struct IntroSpecDescription;
class IntrospecObject
{
IntroSpecDescription * pDesc;
const char * m_name;
public:
static void Element(void * p, size_t siz,const char * label, char c);
static bool bShowMe;
IntrospecObject(const char * name);
virtual void GetExtent(uint32_t * & sm, uint32_t * &em)=0;
virtual void BuildOne()=0;
void LogStructure();
void Log(bool ForceLog=false);
};
class START_MARKER_OBJ
{
public:
uint32_t pItem;
START_MARKER_OBJ() {if(IntrospecObject::bShowMe) IntrospecObject::Element(this,sizeof(*this),NULL,0); };
};
#define START_INTRO_OBJ(name,label) \
class name : public IntrospecObject \
{ \
public: \
name():IntrospecObject(#name){}; \
private: \
virtual void BuildOne() {name ni;}; \
public: \
START_MARKER_OBJ start_marker;
#define END_INTRO_OBJ \
uint32_t end_marker; \
virtual void GetExtent(uint32_t * & sm, uint32_t * & em) {sm=&start_marker.pItem; em=&end_marker;}; \
}
template <typename T> class INTROIEL {
public:
T val;
INTROIEL(const char * label) {val=0; if(IntrospecObject::bShowMe) IntrospecObject::Element(this,sizeof(*this),label,'s'); };
inline T operator=(T rhs) { val = rhs; return rhs;}
inline operator T() const { return val; }
inline T operator^=(T rhs) { val ^= rhs; return val; }
inline T operator|=(T rhs) { val |= rhs; return val; }
inline T operator&=(T rhs) { val &= rhs; return val; }
};
template <typename T> class INTROUEL {
public:
T val;
INTROUEL(const char * label) {val=0; if(IntrospecObject::bShowMe) IntrospecObject::Element(this,sizeof(*this),label,'u'); };
inline T operator=(T rhs) { val = rhs; return rhs;}
inline operator T() const { return val; }
inline T operator^=(T rhs) { val ^= rhs; return val; }
inline T operator|=(T rhs) { val |= rhs; return val; }
inline T operator&=(T rhs) { val &= rhs; return val; }
};
template <typename T> class INTROFEL {
public:
T val;
INTROFEL(const char * label) {val=0; if(IntrospecObject::bShowMe) IntrospecObject::Element(this,sizeof(*this),label,'f'); };
inline T operator=(T rhs) { val = rhs; return rhs;}
inline operator T() const { return val; }
inline T operator^=(T rhs) { val ^= rhs; return val; }
inline T operator|=(T rhs) { val |= rhs; return val; }
inline T operator&=(T rhs) { val &= rhs; return val; }
};
typedef INTROIEL<int8_t> int8_element;
typedef INTROIEL<int16_t> int16_element;
typedef INTROIEL<int32_t> int32_element;
typedef INTROIEL<char> char_element;
typedef INTROIEL<int> int_element;
typedef INTROIEL<short> short_element;
typedef INTROUEL<uint8_t> uint8_element;
typedef INTROUEL<uint16_t> uint16_element;
typedef INTROUEL<uint32_t> uint32_element;
typedef INTROFEL<float> float_element;
typedef INTROFEL<double> double_element;
void LogMessage(const char * cp, bool force=false);
void LogEvent(bool force=false);
void InitLogFtp(int prio);
int GetLogPercent();
int GetLogSize();
extern volatile bool bLog;
void LogFileVersions();
void LogAppRecords();
class FileLog
{
public:
const char * LogMsg;
FileLog * pNext;
FileLog(const char * LogMsg);
};
#define LOGFILEINFO static FileLog fl("Source " __FILE__ " build on" __DATE__ "at" __TIME__ ".");
#endif