[vtkusers] mapping a different wrapping to SWIG wrapping
tom fogal
tfogal at apollo.sr.unh.edu
Sat Feb 19 00:30:53 EST 2005
Hi all, I seem to have hit a wall in terms of application structure due
to the fact that the VTK library produces its own wrapping which is not
recognized by SWIG.
I have a C++ setup that is similar to:
class Foo {
...
void Bar(vtkDataSet*) const;
...
};
the problem is that when trying to use this from python (via SWIG
wrappers):
####
import Foo
import vtkpython
foo = Foo.Foo()
foo.Bar(vtkpython.vtkRectilinearGrid())
####
I get a "TypeError: Expected a pointer". I think I know why -- SWIG
wraps the Bar method so that a C++-instantiated vtkDataSet can be
passed into the python method, but that vtkDataSet is not actually
usable from python (the pointer actually ends up like a python string
of sorts similar to "_p_vtkDataSet").
VTK on the other hand creates a wrapper that hides the fact that an
object is really a pointer. Thus vtkpython.vtkRectilinearGrid() gives a
python object back that is actually usable from within python, and
apparently NOT in a form that can be given back to C/C++ easily.
Thus the problem is Bar wants an object that is actually a pointer,
even though that "pointer" is represented a little funky when its
visible from python. This doesn't work because VTK wrapping does not
give a pointer.
Is anyone trying to use SWIG and VTK, or has run into this problem with
other libraries? What can I do? Is there a method that a majority of
VTK objects have that gives a pointer and might be mappable to the
pointer representation SWIG wrapping expects?
Or perhaps there is an ideas for alternate application structure?
Thanks,
- -tom
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
------- End of Forwarded Message
More information about the vtkusers
mailing list