Salome HOME
Merge branch 'origin/abn/openfile_fix'
[modules/paravis.git] / src / VTKWrapping / 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  * IsPODPointer is for unsized arrays of POD types.
42  */
43 /*@{*/
44 int vtkWrap_IsVoid(ValueInfo *val);
45 int vtkWrap_IsVoidFunction(ValueInfo *val);
46 int vtkWrap_IsVoidPointer(ValueInfo *val);
47 int vtkWrap_IsCharPointer(ValueInfo *val);
48 int vtkWrap_IsPODPointer(ValueInfo *val);
49 int vtkWrap_IsVTKObject(ValueInfo *val);
50 int vtkWrap_IsSpecialObject(ValueInfo *val);
51 int vtkWrap_IsQtObject(ValueInfo *val);
52 int vtkWrap_IsQtEnum(ValueInfo *val);
53 /*@}*/
54
55 /**
56  * The basic types, all are mutually exclusive.
57  * Note that enums are considered to be objects,
58  * bool and char are considered to be numeric.
59  */
60 /*@{*/
61 int vtkWrap_IsObject(ValueInfo *val);
62 int vtkWrap_IsFunction(ValueInfo *val);
63 int vtkWrap_IsStream(ValueInfo *val);
64 int vtkWrap_IsNumeric(ValueInfo *val);
65 int vtkWrap_IsString(ValueInfo *val);
66 /*@}*/
67
68 /**
69  * Subcategories of numeric types.  In this categorization,
70  * bool and char are not considered to be integers.
71  */
72 /*@{*/
73 int vtkWrap_IsBool(ValueInfo *val);
74 int vtkWrap_IsChar(ValueInfo *val);
75 int vtkWrap_IsInteger(ValueInfo *val);
76 int vtkWrap_IsRealNumber(ValueInfo *val);
77 /*@}*/
78
79 /**
80  * Arrays and pointers. These are mutually exclusive.
81  * IsPointer() does not include pointers to pointers.
82  * IsArray() and IsNArray() do not include unsized arrays.
83  * Arrays of pointers are not included in any of these.
84  */
85 /*@{*/
86 int vtkWrap_IsScalar(ValueInfo *val);
87 int vtkWrap_IsPointer(ValueInfo *val);
88 int vtkWrap_IsArray(ValueInfo *val);
89 int vtkWrap_IsNArray(ValueInfo *val);
90 /*@}*/
91
92 /**
93  * Properties that can combine with other properties.
94  */
95 /*@{*/
96 int vtkWrap_IsNonConstRef(ValueInfo *val);
97 int vtkWrap_IsConstRef(ValueInfo *val);
98 int vtkWrap_IsRef(ValueInfo *val);
99 int vtkWrap_IsConst(ValueInfo *val);
100 /*@}*/
101
102 /**
103  * Hints.
104  * NewInstance objects must be freed by the caller.
105  */
106 /*@{*/
107 int vtkWrap_IsNewInstance(ValueInfo *val);
108 /*@}*/
109
110
111 /**
112  * Check whether the class is derived from vtkObjectBase.
113  * If "hinfo" is NULL, this just checks that the class
114  * name starts with "vtk".
115  */
116 int vtkWrap_IsVTKObjectBaseType(
117   HierarchyInfo *hinfo, const char *classname);
118
119 /**
120  * Check if the WRAP_SPECIAL flag is set for the class.
121  * If "hinfo" is NULL, it defaults to just checking if
122  * the class starts with "vtk" and returns -1 if so.
123  */
124 int vtkWrap_IsSpecialType(
125   HierarchyInfo *hinfo, const char *classname);
126
127 /**
128  * Check if the class is derived from superclass.
129  * If "hinfo" is NULL, then only an exact match to the
130  * superclass will succeed.
131  */
132 int vtkWrap_IsTypeOf(
133   HierarchyInfo *hinfo, const char *classname, const char *superclass);
134
135 /**
136  * Check whether a class is wrapped.  If "hinfo" is NULL,
137  * it just checks that the class starts with "vtk".
138  */
139 int vtkWrap_IsClassWrapped(
140   HierarchyInfo *hinfo, const char *classname);
141
142 /**
143  * Check whether the destructor is public
144  */
145 int vtkWrap_HasPublicDestructor(ClassInfo *data);
146
147 /**
148  * Check whether the copy constructor is public
149  */
150 int vtkWrap_HasPublicCopyConstructor(ClassInfo *data);
151
152 /**
153  * Expand all typedef types that are used in function arguments.
154  * This should be done before any wrapping is done, to make sure
155  * that the wrappers see the real types.
156  */
157 void vtkWrap_ExpandTypedefs(
158   ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo);
159
160 /**
161  * Apply any hints about array sizes, e.g. hint that the
162  * GetNumberOfComponents() method gives the tuple size.
163  */
164 void vtkWrap_FindCountHints(
165   ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo);
166
167 /**
168  * Get the size of a fixed-size tuple
169  */
170 int vtkWrap_GetTupleSize(ClassInfo *data, HierarchyInfo *hinfo);
171
172 /**
173  * Apply any hints about methods that return a new object instance,
174  * i.e. factory methods and the like.  Reference counts must be
175  * handled differently for such returned objects.
176  */
177 void vtkWrap_FindNewInstanceMethods(
178   ClassInfo *data, HierarchyInfo *hinfo);
179
180 /**
181  * Get the name of a type.  The name will not include "const".
182  */
183 const char *vtkWrap_GetTypeName(ValueInfo *val);
184
185 /**
186  * True if the method a constructor of the class.
187  */
188 int vtkWrap_IsConstructor(ClassInfo *c, FunctionInfo *f);
189
190 /**
191  * True if the method a destructor of the class.
192  */
193 int vtkWrap_IsDestructor(ClassInfo *c, FunctionInfo *f);
194
195 /**
196  * Check if a method is from a SetVector method.
197  */
198 int vtkWrap_IsSetVectorMethod(FunctionInfo *f);
199
200 /**
201  * Check if a method is from a GetVector method.
202  */
203 int vtkWrap_IsGetVectorMethod(FunctionInfo *f);
204
205 /**
206  * Count the number of parameters that are wrapped.
207  * This skips the "void *" parameter that follows
208  * wrapped function pointer parameters.
209  */
210 int vtkWrap_CountWrappedParameters(FunctionInfo *f);
211
212 /**
213  * Count the number of args that are required.
214  * This counts to the last argument that does not
215  * have a default value.  Array args are not allowed
216  * to have default values.
217  */
218 int vtkWrap_CountRequiredArguments(FunctionInfo *f);
219
220 /**
221  * Write a variable declaration to a file.
222  * Void is automatically ignored, and nothing is written for
223  * function pointers
224  * Set "idx" to -1 to avoid writing an idx.
225  * Set "flags" to VTK_WRAP_RETURN to write a return value,
226  * or to VTK_WRAP_ARG to write a temp argument variable.
227  * The following rules apply:
228  * - if VTK_WRAP_NOSEMI is set, then no semicolon/newline is printed
229  * - if VTK_WRAP_RETURN is set, then "&" becomes "*"
230  * - if VTK_WRAP_ARG is set, "&" becomes "*" only for object
231  *   types, and is removed for all other types.
232  * - "const" is removed except for return values with "&" or "*".
233  */
234 void vtkWrap_DeclareVariable(
235   FILE *fp, ValueInfo *v, const char *name, int idx, int flags);
236
237 /**
238  * Write an "int" size variable for arrays, initialized to
239  * the array size if the size is greater than zero.
240  * For N-dimensional arrays, write a static array of ints.
241  */
242 void vtkWrap_DeclareVariableSize(
243   FILE *fp, ValueInfo *v, const char *name, int idx);
244
245
246 #ifdef __cplusplus
247 }
248 #endif
249
250 #endif