-
Notifications
You must be signed in to change notification settings - Fork 58
/
tubeWrappingMacros.h
263 lines (225 loc) · 12.8 KB
/
tubeWrappingMacros.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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
/*=========================================================================
Library: TubeTK
Copyright 2010 Kitware Inc. 28 Corporate Drive,
Clifton Park, NY, 12065, USA.
All rights reserved.
Licensed under the Apache License, Version 2.0 ( the "License" );
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
/**
*
* Defines macros for defining set/get functions of inputs of shadow classes
* in TubeTK/ITKModukes that do python wrapping of TubeTK/Applications
*
* \ingroup TubeTK
*/
#ifndef __tubeWrappingMacros_h
#define __tubeWrappingMacros_h
/** Boolean macro */
#define tubeWrapBooleanMacro( name, wrap_filter_object_name ) \
void name##On( void ) const \
{ \
this->m_##wrap_filter_object_name->name##On(); \
} \
void name##Off( void ) const \
{ \
this->m_##wrap_filter_object_name->name##Off(); \
}
/** Get input of fundamental type */
#define tubeWrapGetMacro( name, type, wrap_filter_object_name ) \
type Get##name( void ) const \
{ \
return this->m_##wrap_filter_object_name->Get##name(); \
}
/** Get pointer to input of object type. */
#define tubeWrapGetObjectMacro( name, type, wrap_filter_object_name ) \
type * Get##name( void ) \
{ \
return this->m_##wrap_filter_object_name->Get##name(); \
}
/** Get a const pointer to input of object type. */
#define tubeWrapGetConstObjectMacro( name, type, wrap_filter_object_name ) \
const type * Get##name( void ) const \
{ \
return this->m_##wrap_filter_object_name->Get##name(); \
}
/** Get a const reference to input of object type. */
#define tubeWrapGetConstReferenceMacro( name, type, wrap_filter_object_name ) \
const type & Get##name( void ) const \
{ \
return this->m_##wrap_filter_object_name->Get##name(); \
}
/** Set input of fundamental type */
#define tubeWrapSetMacro( name, type, wrap_filter_object_name ) \
void Set##name( type value ) \
{ \
if( this->m_##wrap_filter_object_name->Get##name() != value ) \
{ \
this->m_##wrap_filter_object_name->Set##name( value ); \
this->Modified(); \
} \
}
/** Set input of fundamental type */
#define tubeWrapForceSetMacro( name, type, wrap_filter_object_name ) \
void Set##name( type value ) \
{ \
this->m_##wrap_filter_object_name->Set##name( value ); \
this->Modified(); \
}
/** Set input using pointer to object type */
#define tubeWrapSetObjectMacro( name, type, wrap_filter_object_name ) \
void Set##name( type * value ) \
{ \
if( this->m_##wrap_filter_object_name->Get##name() != value ) \
{ \
this->m_##wrap_filter_object_name->Set##name( value ); \
this->Modified(); \
} \
}
/** Set input using pointer to object type, without testing if changed */
#define tubeWrapForceSetObjectMacro( name, type, wrap_filter_object_name ) \
void Set##name( type * value ) \
{ \
this->m_##wrap_filter_object_name->Set##name( value ); \
this->Modified(); \
}
/** Set input using reference to object type */
#define tubeWrapSetReferenceMacro( name, type, wrap_filter_object_name ) \
void Set##name( type & value ) \
{ \
if( this->m_##wrap_filter_object_name->Get##name() != value ) \
{ \
this->m_##wrap_filter_object_name->Set##name( value ); \
this->Modified(); \
} \
}
/** Set input using reference to object type */
#define tubeWrapForceSetReferenceMacro( name, type, wrap_filter_object_name ) \
void Set##name( const type & value ) \
{ \
this->m_##wrap_filter_object_name->Set##name( value ); \
this->Modified(); \
}
/** Add input using reference to object type */
#define tubeWrapAddMacro( name, type, wrap_filter_object_name ) \
void Add##name( type value ) \
{ \
this->m_##wrap_filter_object_name->Add##name( value ); \
this->Modified(); \
}
/** Set Nth in an object list */
#define tubeWrapSetNthMacro( name, type, wrap_filter_object_name ) \
void Set##name( unsigned int i, type value ) \
{ \
this->m_##wrap_filter_object_name->Set##name( i, value ); \
this->Modified(); \
}
/** Set input using const pointer to object type */
#define tubeWrapSetConstObjectMacro( name, type, wrap_filter_object_name ) \
void Set##name( const type * value ) \
{ \
if( this->m_##wrap_filter_object_name->Get##name() != value ) \
{ \
this->m_##wrap_filter_object_name->Set##name( value ); \
this->Modified(); \
} \
}
#define tubeWrapAddConstObjectMacro( name, type, wrap_filter_object_name ) \
void Add##name( const type * value ) \
{ \
this->m_##wrap_filter_object_name->Add##name( value ); \
this->Modified(); \
}
/** Set Nth in an const pointer object list */
#define tubeWrapSetNthObjectMacro( name, type, wrap_filter_object_name ) \
void Set##name( unsigned int i, type * value ) \
{ \
this->m_##wrap_filter_object_name->Set##name( i, value ); \
this->Modified(); \
}
/** Set Nth in an const pointer object list */
#define tubeWrapSetNthConstObjectMacro( name, type, wrap_filter_object_name ) \
void Set##name( unsigned int i, const type * value ) \
{ \
this->m_##wrap_filter_object_name->Set##name( i, value ); \
this->Modified(); \
}
/** Get Nth in an object list */
#define tubeWrapGetNthMacro( name, type, wrap_filter_object_name ) \
type Get##name( unsigned int i ) \
{ \
return this->m_##wrap_filter_object_name->Get##name( i ); \
}
/** Get Nth in an object list */
#define tubeWrapGetNthObjectMacro( name, type, wrap_filter_object_name ) \
type * Get##name( unsigned int i ) \
{ \
return this->m_##wrap_filter_object_name->Get##name( i ); \
}
/** Get Nth in an object list */
#define tubeWrapGetNthConstObjectMacro( name, type, wrap_filter_object_name ) \
const type * Get##name( unsigned int i ) \
{ \
return this->m_##wrap_filter_object_name->Get##name( i ); \
}
/** Get Nth in an object list */
#define tubeWrapGetNthConstReferenceMacro( name, type, wrap_filter_object_name ) \
const type & Get##name( unsigned int i ) \
{ \
return this->m_##wrap_filter_object_name->Get##name( i ); \
}
/** Set input using const pointer to object type */
#define tubeWrapForceSetConstObjectMacro( name, type, \
wrap_filter_object_name ) \
void Set##name( const type * value ) \
{ \
this->m_##wrap_filter_object_name->Set##name( value ); \
this->Modified(); \
}
/** Set input using const reference to object type */
#define tubeWrapSetConstReferenceMacro( name, type, wrap_filter_object_name ) \
void Set##name( const type & value ) \
{ \
if( this->m_##wrap_filter_object_name->Get##name() != value ) \
{ \
this->m_##wrap_filter_object_name->Set##name( value ); \
this->Modified(); \
} \
}
/** Set input using const reference to object type */
#define tubeWrapForceSetConstReferenceMacro( name, type, \
wrap_filter_object_name ) \
void Set##name( const type & value ) \
{ \
this->m_##wrap_filter_object_name->Set##name( value ); \
this->Modified(); \
}
/** Redirect call to a function of the same named in the wrapped filter */
#define tubeWrapCallMacro( name, wrap_filter_object_name ) \
void name() \
{ \
this->m_##wrap_filter_object_name->name(); \
}
/** Redirect call to a function of the same named in the wrapped filter */
#define tubeWrapCallWithConstReferenceArgMacro( name, type, wrap_filter_object_name ) \
void name( const type & value ) \
{ \
this->m_##wrap_filter_object_name->name( value ); \
}
/** Redirect call to a function of the same named in the wrapped filter */
#define tubeWrapCallOverrideMacro( name, wrap_filter_object_name ) \
void name() override \
{ \
this->m_##wrap_filter_object_name->name(); \
}
/** Redirect call to Update() wrapped filter's Update() */
#define tubeWrapUpdateMacro( wrap_filter_object_name ) \
tubeWrapCallOverrideMacro( Update, wrap_filter_object_name ) \
#endif