[vtk-developers] New header file Wrapping/vtkParseType.h

David Gobbi david.gobbi at gmail.com
Wed Apr 28 11:58:42 EDT 2010


On Wed, Apr 28, 2010 at 9:35 AM, Marcus D. Hanwell
<marcus.hanwell at kitware.com> wrote:
> On Wed, Apr 28, 2010 at 11:30 AM, David Gobbi <david.gobbi at gmail.com> wrote:
>>
>> There were no comments about my changes to the wrappers so I went
>> ahead and pushed them.  So if anyone found vtkWrapPython.c to be
>> completely incomprehensible before, they should find the code to be a
>> little bit friendlier now.
>>
>> In the longer term, I'm looking at how the wrappers can be made to
>> handle special types (with vtkVariant being the favorite).  The
>> wrappers used to handle special types fairly well, many years ago, but
>> support for special types fell by the wayside when vtkObjectBase was
>> introduced.  Last night I did some work to resurrect the old
>> special-type handling code with good results.
>
> I would love to see handling for vtkVariant, along with vtkStdString, and
> the unicode variant. It would also be great to have a way to wrap some C++
> data structures so that they could be used from the wrapped languages. Is
> there a document on how this is/could be achieved?
> Marcus

There already is support for vtkStdString, it is directly converted
into the native "string" type in the wrapper languages.  The unicode
strings can eventually be handled in exactly the same way.

For vtkVariant, it will appear in Python as "vtkVariant" and have all
the same methods as the C++ version.  In fact I wrapped it last night
and got it working nicely except that only the default constructor was
wrapped.  The other (non-constructor) methods were wrapped
automatically, though.  That was enough to convince me that this isn't
such a big job after all.

The wrapper generator code is very difficult to read and, as far as I
know, there is no documentation.  For one of my projects with Queen's
University I have made a tool called WrapVTK that makes the data
structures a bit easier to handle.  I'll see if I can push it to a
public git repository and maybe (eventually) write a paper about it.
All that WrapVTK does now is generate XML descriptions of the classes,
but it would probably be useful for seeing how things work.

   David



More information about the vtk-developers mailing list