Skip to content

Wrap vtkSmartPointer<T> parameters in Python

David Gobbi requested to merge dgobbi/vtk:wrap-smart-pointers into master

This allows the use of vtkSmartPointer<T> and std::vector<vtkSmartPointer<T>> in method parameters and in return values.

The wrappers will convert a vtkSmartPointer<T> to the Python equivalent of T. In other words, Python users will not see any difference between a vtkSmartPointer<vtkObject> and a vtkObject.

If a C++ method returns a vector of smart pointers, then in Python that same method will return a tuple of objects. Likewise, a tuple (or list or sequence) of objects can be passed to a method that expects a vector of smart pointers. A TypeError will be raised if the objects are not of the correct type.

Merge request reports