1 | #ifndef __XIOS_DECLARE_ATTRIBUTE__ |
---|
2 | #define __XIOS_DECLARE_ATTRIBUTE__ |
---|
3 | |
---|
4 | /// ///////////////////////////// Macros ///////////////////////////// /// |
---|
5 | #define DECLARE_ATTRIBUTE(type, name, ...) \ |
---|
6 | class name##_attr : public CAttributeTemplate<type> \ |
---|
7 | { \ |
---|
8 | public : \ |
---|
9 | name##_attr(void) \ |
---|
10 | : CAttributeTemplate<type> \ |
---|
11 | (#name, *CAttributeMap::Current) \ |
---|
12 | { /* Ne rien faire de plus */ } \ |
---|
13 | type operator=(const type & value) \ |
---|
14 | { return (CAttributeTemplate<type>::operator=(value)); } \ |
---|
15 | virtual bool doSend() const { return helper(__VA_ARGS__); } \ |
---|
16 | bool helper(bool returnTrue=true) const { return returnTrue; } \ |
---|
17 | virtual ~name##_attr(void) \ |
---|
18 | { /* Ne rien faire de plus */ } \ |
---|
19 | } name; |
---|
20 | |
---|
21 | #define DECLARE_ATTRIBUTE_PRIVATE(type, name, ...) \ |
---|
22 | class name##_attr : public CAttributeTemplate<type> \ |
---|
23 | { \ |
---|
24 | public : \ |
---|
25 | name##_attr(void) \ |
---|
26 | : CAttributeTemplate<type> \ |
---|
27 | (#name, *CAttributeMap::Current) \ |
---|
28 | { /* Ne rien faire de plus */ } \ |
---|
29 | type operator=(const type & value) \ |
---|
30 | { return (CAttributeTemplate<type>::operator=(value)); } \ |
---|
31 | virtual bool isPublic() const \ |
---|
32 | { return false; } \ |
---|
33 | virtual bool doSend() const { return helper(__VA_ARGS__); } \ |
---|
34 | bool helper(bool returnTrue=true) const { return returnTrue; } \ |
---|
35 | virtual ~name##_attr(void) \ |
---|
36 | { /* Ne rien faire de plus */ } \ |
---|
37 | } name; |
---|
38 | |
---|
39 | #define DECLARE_ARRAY(T_num, T_rank, name, ...) \ |
---|
40 | class name##_attr : public CAttributeArray<T_num, T_rank> \ |
---|
41 | { \ |
---|
42 | public : \ |
---|
43 | using CAttributeArray<T_num, T_rank>::operator = ; \ |
---|
44 | bool alwaysFalse=false;\ |
---|
45 | name##_attr(void) : CAttributeArray<T_num, T_rank> (#name, *CAttributeMap::Current) {if (alwaysFalse) TV_ttf_display_type(this);} \ |
---|
46 | virtual bool doSend() const { return helper(__VA_ARGS__); } \ |
---|
47 | bool helper(bool returnTrue=true) const { return returnTrue; } \ |
---|
48 | static int TV_ttf_display_type ( const name##_attr* array )\ |
---|
49 | {\ |
---|
50 | cout<<"TV_ttf_display_type"<<endl ;\ |
---|
51 | return CArray<T_num,T_rank>::TV_ttf_display_type((const CArray<T_num,T_rank>*)array) ;\ |
---|
52 | }\ |
---|
53 | virtual ~name##_attr(void) {} \ |
---|
54 | } name; |
---|
55 | |
---|
56 | #define DECLARE_ARRAY_PRIVATE(T_num, T_rank, name, ...) \ |
---|
57 | class name##_attr : public CAttributeArray<T_num, T_rank> \ |
---|
58 | { \ |
---|
59 | public : \ |
---|
60 | using CAttributeArray<T_num, T_rank>::operator = ; \ |
---|
61 | name##_attr(void) : CAttributeArray<T_num, T_rank> (#name, *CAttributeMap::Current) {} \ |
---|
62 | virtual bool isPublic() const \ |
---|
63 | { return false; } \ |
---|
64 | virtual bool doSend() const { return helper(__VA_ARGS__); } \ |
---|
65 | bool helper(bool returnTrue=true) const { return returnTrue; } \ |
---|
66 | virtual ~name##_attr(void) {} \ |
---|
67 | } name; |
---|
68 | |
---|
69 | #define DECLARE_CLASS_ENUM(name, ...) \ |
---|
70 | class name##_attr : public CAttributeEnum<Enum_##name> \ |
---|
71 | { \ |
---|
72 | public : \ |
---|
73 | name##_attr(void) : CAttributeEnum<Enum_##name>(#name, *CAttributeMap::Current) { } \ |
---|
74 | virtual bool doSend() const { return helper(__VA_ARGS__); } \ |
---|
75 | bool helper(bool returnTrue=true) const { return returnTrue; } \ |
---|
76 | virtual ~name##_attr(void) {} \ |
---|
77 | } name; |
---|
78 | |
---|
79 | #define DECLARE_ENUM2(name,arg1,arg2) \ |
---|
80 | class Enum_##name \ |
---|
81 | { \ |
---|
82 | public: \ |
---|
83 | enum t_enum { arg1=0, arg2} ; \ |
---|
84 | const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2 } ; return enumStr ; } \ |
---|
85 | int getSize(void) const { return 2 ; } \ |
---|
86 | } ; \ |
---|
87 | DECLARE_CLASS_ENUM(name) |
---|
88 | |
---|
89 | #define DECLARE_ENUM3(name,arg1,arg2,arg3) \ |
---|
90 | class Enum_##name \ |
---|
91 | { \ |
---|
92 | public: \ |
---|
93 | enum t_enum { arg1=0, arg2, arg3} ; \ |
---|
94 | const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3 } ; return enumStr ; } \ |
---|
95 | int getSize(void) const { return 3 ; } \ |
---|
96 | } ; \ |
---|
97 | DECLARE_CLASS_ENUM(name) |
---|
98 | |
---|
99 | #define DECLARE_ENUM4(name,arg1,arg2,arg3,arg4) \ |
---|
100 | class Enum_##name \ |
---|
101 | { \ |
---|
102 | public: \ |
---|
103 | enum t_enum { arg1=0, arg2, arg3,arg4} ; \ |
---|
104 | const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4 } ; return enumStr ; } \ |
---|
105 | int getSize(void) const { return 4 ; } \ |
---|
106 | } ; \ |
---|
107 | DECLARE_CLASS_ENUM(name) |
---|
108 | |
---|
109 | #define DECLARE_ENUM5(name,arg1,arg2,arg3,arg4,arg5) \ |
---|
110 | class Enum_##name \ |
---|
111 | { \ |
---|
112 | public: \ |
---|
113 | enum t_enum { arg1=0, arg2, arg3,arg4,arg5} ; \ |
---|
114 | const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4,#arg5 } ; return enumStr ; } \ |
---|
115 | int getSize(void) const { return 5 ; } \ |
---|
116 | } ; \ |
---|
117 | DECLARE_CLASS_ENUM(name) |
---|
118 | |
---|
119 | #define DECLARE_ENUM6(name,arg1,arg2,arg3,arg4,arg5,arg6) \ |
---|
120 | class Enum_##name \ |
---|
121 | { \ |
---|
122 | public: \ |
---|
123 | enum t_enum { arg1=0, arg2, arg3,arg4,arg5,arg6} ; \ |
---|
124 | const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4,#arg5,#arg6 } ; return enumStr ; } \ |
---|
125 | int getSize(void) const { return 6 ; } \ |
---|
126 | } ; \ |
---|
127 | DECLARE_CLASS_ENUM(name) |
---|
128 | |
---|
129 | #define DECLARE_ENUM7(name,arg1,arg2,arg3,arg4,arg5,arg6,arg7) \ |
---|
130 | class Enum_##name \ |
---|
131 | { \ |
---|
132 | public: \ |
---|
133 | enum t_enum { arg1=0, arg2, arg3,arg4,arg5,arg6,arg7} ; \ |
---|
134 | const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4,#arg5,#arg6,#arg7 } ; return enumStr ; } \ |
---|
135 | int getSize(void) const { return 7 ; } \ |
---|
136 | } ; \ |
---|
137 | DECLARE_CLASS_ENUM(name) |
---|
138 | |
---|
139 | #define DECLARE_ENUM8(name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) \ |
---|
140 | class Enum_##name \ |
---|
141 | { \ |
---|
142 | public: \ |
---|
143 | enum t_enum { arg1=0, arg2, arg3,arg4,arg5,arg6,arg7,arg8} ; \ |
---|
144 | const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4,#arg5,#arg6,#arg7,#arg8 } ; return enumStr ; } \ |
---|
145 | int getSize(void) const { return 8 ; } \ |
---|
146 | } ; \ |
---|
147 | DECLARE_CLASS_ENUM(name) |
---|
148 | |
---|
149 | #define DECLARE_ENUM9(name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) \ |
---|
150 | class Enum_##name \ |
---|
151 | { \ |
---|
152 | public: \ |
---|
153 | enum t_enum { arg1=0, arg2, arg3,arg4,arg5,arg6,arg7,arg8,arg9} ; \ |
---|
154 | const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4,#arg5,#arg6,#arg7,#arg8,#arg9 } ; return enumStr ; } \ |
---|
155 | int getSize(void) const { return 9 ; } \ |
---|
156 | } ; \ |
---|
157 | DECLARE_CLASS_ENUM(name) |
---|
158 | |
---|
159 | #define DECLARE_TYPE(name) \ |
---|
160 | class Enum_##name \ |
---|
161 | { \ |
---|
162 | public: \ |
---|
163 | enum t_enum { t_bool=0, t_int16, t_int, t_int32, t_int64, t_float, t_double, t_string }; \ |
---|
164 | const char** getStr(void) const { static const char * enumStr[] = { "bool", "int16", "int", "int32", "int64", "float", "double", "string" }; return enumStr; } \ |
---|
165 | int getSize(void) const { return 8; } \ |
---|
166 | }; \ |
---|
167 | DECLARE_CLASS_ENUM(name) |
---|
168 | |
---|
169 | #define BEGIN_DECLARE_ATTRIBUTE_MAP(type) \ |
---|
170 | class type##Attributes : public virtual CAttributeMap \ |
---|
171 | { \ |
---|
172 | public : |
---|
173 | |
---|
174 | #define END_DECLARE_ATTRIBUTE_MAP(type) \ |
---|
175 | type##Attributes (void) : CAttributeMap() \ |
---|
176 | { /* Ne rien faire de plus */ } \ |
---|
177 | virtual ~type##Attributes (void) \ |
---|
178 | { /* Ne rien faire de plus */ } \ |
---|
179 | }; |
---|
180 | |
---|
181 | #endif // __XIOS_DECLARE_ATTRIBUTE__ |
---|