-
Notifications
You must be signed in to change notification settings - Fork 0
/
Macros.hpp
92 lines (77 loc) · 2 KB
/
Macros.hpp
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
#ifndef MACROS_H_
#define MACROS_H_
#define GET(Type, MemberName, FaceName) \
Type get##FaceName() const { \
return MemberName; \
};
#define SET(Type, MemberName, FaceName) \
void set##FaceName(Type value) { \
MemberName = value; \
};
#define SET_CONST_REF(Type, MemberName, FaceName) \
void set##FaceName(const Type& value) { \
MemberName = value; \
};
#define GET_CONST_REF(Type, MemberName, FaceName) \
const Type& get##FaceName() const { \
return MemberName; \
};
#define SET_REF(Type, MemberName, FaceName) \
void set##FaceName(Type& value) { \
MemberName = value; \
};
#define GET_REF(Type, MemberName, FaceName) \
Type& get##FaceName() { \
return MemberName; \
};
#define GETSET(Type, MemberName, FaceName) \
Type get##FaceName() const { \
return MemberName; \
}; \
\
void set##FaceName(Type value) { \
MemberName = value; \
};
#define GETSET_CONST_REF(Type, MemberName, FaceName) \
const Type& get##FaceName() const { \
return MemberName; \
}; \
\
void set##FaceName(const Type& value) { \
MemberName = value; \
};
#define GETSET_REF(Type, MemberName, FaceName) \
Type& get##FaceName() const { \
return MemberName; \
}; \
\
void set##FaceName(Type& value) { \
MemberName = value; \
};
#define GETSET_INTERFACE(Type, FaceName) \
virtual Type get##FaceName() const = 0; \
\
virtual void set##FaceName(Type value) = 0;
/*
#define GETSET(ClassName, Type, MemberName, FaceName) \
Type ClassName::get##FaceName() const { \
return MemberName; \
}; \
\
void ClassName::set##FaceName(Type value) { \
MemberName = value; \
}
*/
// Debug Macros
#define FILE_AND_LINE_NUMBER std::string(__FILE__) + " (" + std::to_string(__LINE__) + ")"
#define OPENGL_CHECK_ERRORS(openGlDevice) \
{ \
glr::glw::GlError err = openGlDevice->getGlError(); \
if (err.type != GL_NONE) \
{ \
std::string msg = FILE_AND_LINE_NUMBER + ": Error occured during OpenGL operation: " + err.name; \
LOG_ERROR( msg ); \
throw glr::exception::GlException( msg ); \
} \
}
#endif /* MACROS_H_ */