]> SALOME platform Git repositories - modules/paravis.git/blob - src/ParaView/vtkWrap.h
Salome HOME
Merge from BR_PORTING_VTK6 01/03/2013
[modules/paravis.git] / src / ParaView / vtkWrap.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    vtkWrap.h
5
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13
14 =========================================================================*/
15
16 /**
17  * vtkWrap provides useful functions for generating wrapping code.
18 */
19
20 #ifndef VTK_WRAP_H
21 #define VTK_WRAP_H
22
23 #include "vtkParse.h"
24 #include "vtkParseHierarchy.h"
25
26 /**
27  * For use with vtkWrap_DeclareVariable.
28  */
29 /*@{*/
30 #define VTK_WRAP_RETURN  1
31 #define VTK_WRAP_ARG     2
32 #define VTK_WRAP_NOSEMI  4
33 /*@}*/
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /**
40  * Check for common types.
41  */
42 /*@{*/
43 int vtkWrap_IsVoid(ValueInfo *val);
44 int vtkWrap_IsVoidFunction(ValueInfo *val);
45 int vtkWrap_IsVoidPointer(ValueInfo *val);
46 int vtkWrap_IsCharPointer(ValueInfo *val);
47 int vtkWrap_IsVTKObject(ValueInfo *val);
48 int vtkWrap_IsSpecialObject(ValueInfo *val);
49 int vtkWrap_IsQtObject(ValueInfo *val);
50 int vtkWrap_IsQtEnum(ValueInfo *val);
51 /*@}*/
52
53 /**
54  * The basic types, all are mutually exclusive.
55  * Note that enums are considered to be objects,
56  * bool and char are considered to be numeric.
57  */
58 /*@{*/
59 int vtkWrap_IsObject(ValueInfo *val);
60 int vtkWrap_IsFunction(ValueInfo *val);
61 int vtkWrap_IsStream(ValueInfo *val);
62 int vtkWrap_IsNumeric(ValueInfo *val);
63 int vtkWrap_IsString(ValueInfo *val);
64 /*@}*/
65
66 /**
67  * Subcategories of numeric types.  In this categorization,
68  * bool and char are not considered to be integers.
69  */
70 /*@{*/
71 int vtkWrap_IsBool(ValueInfo *val);
72 int vtkWrap_IsChar(ValueInfo *val);
73 int vtkWrap_IsInteger(ValueInfo *val);
74 int vtkWrap_IsRealNumber(ValueInfo *val);
75 /*@}*/
76
77 /**
78  * Arrays and pointers. These are mutually exclusive.
79  * IsPointer() does not include pointers to pointers.
80  * IsArray() and IsNArray() do not include unsized arrays.
81  * Arrays of pointers are not included in any of these.
82  */
83 /*@{*/
84 int vtkWrap_IsScalar(ValueInfo *val);
85 int vtkWrap_IsPointer(ValueInfo *val);
86 int vtkWrap_IsArray(ValueInfo *val);
87 int vtkWrap_IsNArray(ValueInfo *val);
88 /*@}*/
89
90 /**
91  * Properties that can combine with other properties.
92  */
93 /*@{*/
94 int vtkWrap_IsNonConstRef(ValueInfo *val);
95 int vtkWrap_IsConstRef(ValueInfo *val);
96 int vtkWrap_IsRef(ValueInfo *val);
97 int vtkWrap_IsConst(ValueInfo *val);
98 /*@}*/
99
100 /**
101  * Hints.
102  * NewInstance objects must be freed by the caller.
103  */
104 /*@{*/
105 int vtkWrap_IsNewInstance(ValueInfo *val);
106 /*@}*/
107
108
109 /**
110  * Check whether the class is derived from vtkObjectBase.
111  * If "hinfo" is NULL, this just checks that the class
112  * name starts with "vtk".
113  */
114 int vtkWrap_IsVTKObjectBaseType(
115   HierarchyInfo *hinfo, const char *classname);
116
117 /**
118  * Check if the WRAP_SPECIAL flag is set for the class.
119  * If "hinfo" is NULL, it defaults to just checking if
120  * the class starts with "vtk" and returns -1 if so.
121  */
122 int vtkWrap_IsSpecialType(
123   HierarchyInfo *hinfo, const char *classname);
124
125 /**
126  * Check if the class is derived from superclass.
127  * If "hinfo" is NULL, then only an exact match to the
128  * superclass will succeed.
129  */
130 int vtkWrap_IsTypeOf(
131   HierarchyInfo *hinfo, const char *classname, const char *superclass);
132
133 /**
134  * Check whether a class is wrapped.  If "hinfo" is NULL,
135  * it just checks that the class starts with "vtk".
136  */
137 int vtkWrap_IsClassWrapped(
138   HierarchyInfo *hinfo, const char *classname);
139
140 /**
141  * Check whether the destructor is public
142  */
143 int vtkWrap_HasPublicDestructor(ClassInfo *data);
144
145 /**
146  * Check whether the copy constructor is public
147  */
148 int vtkWrap_HasPublicCopyConstructor(ClassInfo *data);
149
150 /**
151  * Expand all typedef types that are used in function arguments.
152  * This should be done before any wrapping is done, to make sure
153  * that the wrappers see the real types.
154  */
155 void vtkWrap_ExpandTypedefs(
156   ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo);
157
158 /**
159  * Apply any hints about array sizes, e.g. hint that the
160  * GetNumberOfComponents() method gives the tuple size.
161  */
162 void vtkWrap_FindCountHints(
163   ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo);
164
165 /**
166  * Get the size of a fixed-size tuple
167  */
168 int vtkWrap_GetTupleSize(ClassInfo *data, HierarchyInfo *hinfo);
169
170 /**
171  * Apply any hints about methods that return a new object instance,
172  * i.e. factory methods and the like.  Reference counts must be
173  * handled differently for such returned objects.
174  */
175 void vtkWrap_FindNewInstanceMethods(
176   ClassInfo *data, HierarchyInfo *hinfo);
177
178 /**
179  * Get the name of a type.  The name will not include "const".
180  */
181 const char *vtkWrap_GetTypeName(ValueInfo *val);
182
183 /**
184  * True if the method a constructor of the class.
185  */
186 int vtkWrap_IsConstructor(ClassInfo *c, FunctionInfo *f);
187
188 /**
189  * True if the method a destructor of the class.
190  */
191 int vtkWrap_IsDestructor(ClassInfo *c, FunctionInfo *f);
192
193 /**
194  * Check if a method is from a SetVector method.
195  */
196 int vtkWrap_IsSetVectorMethod(FunctionInfo *f);
197
198 /**
199  * Check if a method is from a GetVector method.
200  */
201 int vtkWrap_IsGetVectorMethod(FunctionInfo *f);
202
203 /**
204  * Count the number of parameters that are wrapped.
205  * This skips the "void *" parameter that follows
206  * wrapped function pointer parameters.
207  */
208 int vtkWrap_CountWrappedParameters(FunctionInfo *f);
209
210 /**
211  * Count the number of args that are required.
212  * This counts to the last argument that does not
213  * have a default value.  Array args are not allowed
214  * to have default values.
215  */
216 int vtkWrap_CountRequiredArguments(FunctionInfo *f);
217
218 /**
219  * Write a variable declaration to a file.
220  * Void is automatically ignored, and nothing is written for
221  * function pointers
222  * Set "idx" to -1 to avoid writing an idx.
223  * Set "flags" to VTK_WRAP_RETURN to write a return value,
224  * or to VTK_WRAP_ARG to write a temp argument variable.
225  * The following rules apply:
226  * - if VTK_WRAP_NOSEMI is set, then no semicolon/newline is printed
227  * - if VTK_WRAP_RETURN is set, then "&" becomes "*"
228  * - if VTK_WRAP_ARG is set, "&" becomes "*" only for object
229  *   types, and is removed for all other types.
230  * - "const" is removed except for return values with "&" or "*".
231  */
232 void vtkWrap_DeclareVariable(
233   FILE *fp, ValueInfo *v, const char *name, int idx, int flags);
234
235 /**
236  * Write an "int" size variable for arrays, initialized to
237  * the array size if the size is greater than zero.
238  * For N-dimensional arrays, write a static array of ints.
239  */
240 void vtkWrap_DeclareVariableSize(
241   FILE *fp, ValueInfo *v, const char *name, int idx);
242
243
244 #ifdef __cplusplus
245 }
246 #endif
247
248 #endif