VTK/WrapHierarchy
WrapHierarchy is a proposed tool for generating a text file (or multiple files) that describe the VTK class hierarchy. The goal is to make the full VTK class hierarchy available to the wrappers at compile time, so that they can do special wrapping of classes depending on their superclasses (or absence of superclasses), even if the superclass in question is several generations from the class that is being wrapped.
Why is this tool useful?
- vtkObjectBase-derived parameters and parameters of vtk "special" types can be handled differently
- certain categories of classes, e.g. array classes, can be given specific features
How can this be done?
Three pieces are needed:
- a vtkWrapHierarchy executable to read header files and output all classes, superclasses for the file
- a CMake macro to call vtkWrapHierarchy on all VTK classes
- a utility function to read hierarchy files so that the wrappers can use them
A big issue is how to handle dependencies. Having one big hierarchy file could be a problem because a change to any VTK header file would mean that all the wrappers would have to be regenerated. Having a small stub hierarchy file for each class header file means that the wrappers would have to read many small files. A good solution might be to have CMake generate a "temporary" hierarchy file, compare it to the existing file (if one exists), and only replace the existing file if the new file is different. That way, the wrappers will only have to be completely re-generated if the hierarchy changes.
If this is done, then there can be one "hierarchy" file per kit.