[vtk-developers] Abstract trouble today

David Gobbi dgobbi at imaging.robarts.ca
Sat Jul 6 02:34:08 EDT 2002


On Sat, 6 Jul 2002, Prabhu Ramachandran wrote:

> >>>>> "DG" == David Gobbi <dgobbi at imaging.robarts.ca> writes:
>
>     DG> P.S. JB: I started wrapping abstract classes in python because
>     DG> I had this dream that the python wrappers would eventually
>     DG> support proper subclassing of all VTK classes, including
>     DG> virtual method hooks and the whole bit.  Alas, it is still
>     DG> just a dream.
>
> It is still possible if we use the Boost.Python library (BPL) for the
> wrapping.  Unfortunately, doing this is a pretty huge job and after a
> while I gave up on doing it since I simply didnt have the time.

This is one big reason why it is better to work with the existing
wrappers than to go to a totally different solution.  With the
existing wrappers, it is possible to incrementally improve them
until they finally fulfill everyone's needs.  If we go to Boost,
there is no guarantee that the end result will be better than what
we have now (or that it will ever be finished).

> The other problem with BPL is that it will add a few new dependencies
> and also pose severe demands on the c++ compiler.
>
> However, doing it directly, the way it is done currently, is also
> possible.  What would it involve to add virtual method hooks and is it
> easier to do with Python 2.2?

It is possible with Python 1.5.2 and 2.0/2.1 as well, but the mechanism
is slightly different compared to 2.2.  It is just as easy/difficult in
either.

It involves a fair bit of work, mainly generating a C++ subclass for
each existing VTK C++ class that 'knows' about python and that searches
the corresponding python 'vtkclass' object for overloaded virtual
methods and calls them if they exist.  Conceptually it is simple,
but it would take a fair bit of time to implement and it would make
the vtk/python .dll/.so files a lot larger.

 - David




More information about the vtk-developers mailing list