[vtk-developers] Template expansion in wrappers and ParaView client server wrapping

Marcus D. Hanwell marcus.hanwell at kitware.com
Fri Feb 10 17:36:11 EST 2012


I appreciate the history lesson, as well as the preferred approach
going forward. Knowing that those constructs are there purely for the
wrapping makes it clearer.

On Fri, Feb 10, 2012 at 5:28 PM, David Cole <david.cole at kitware.com> wrote:
> That sounds fine to me. I was just explaining the historical reason for it
> for Marcus' benefit.
>
> On Fri, Feb 10, 2012 at 5:11 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>
>> Hi David,
>>
>> For the Tcl, Java, and ClientServer wrappers, the best solution would
>> be to remove templated classes from the inheritance chain, as far as
>> the wrappers are concerned.  I.e. do it automatically as part of the
>> wrapper code, rather than with #ifdef/#undef tricks in the headers.
>>
>> If it was only the python wrappers that we had to worry about, then
>> we would just wrap those templated superclasses and be done with it.
>> That's how vtkDenseArray, vtkSparseArray, and all the vtkVector-
>> derived classes are wrapped in python.
>>
>>  - David
>>
>>
>> On Fri, Feb 10, 2012 at 2:55 PM, David Cole <david.cole at kitware.com>
>> wrote:
>> > That define/undef pattern was previously used to keep template
>> > parameters
>> > out of the wrapped class hierarchy.
>> >
>> > The wrapper generators would simply use vtkSIVectorProperty as the
>> > parent
>> > class.
>> >
>> > Now that generators are macro-aware after this commit, something else
>> > has to
>> > fool them instead.
>> >
>> >
>> > On Fri, Feb 10, 2012 at 4:28 PM, Marcus D. Hanwell
>> > <marcus.hanwell at kitware.com> wrote:
>> >>
>> >> Hi David,
>> >>
>> >> That makes sense, I wasn't quite sure why we would do things like this,
>> >>
>> >> #define vtkSIVectorProperty vtkSIVectorPropertyTemplate<vtkIdType,
>> >> bool>
>> >> class VTK_EXPORT vtkSIIdTypeVectorProperty : public vtkSIVectorProperty
>> >> #undef vtkSIVectorProperty
>> >>
>> >> This is what is leading to the issue I saw. I guess the major issue
>> >> here is that the expanded name is then used to name the command, and
>> >> so changing the <, > characters would have resulted in a valid symbol
>> >> name.
>> >>
>> >> Thanks for fixing this up, I am compiling the proposed patch right now
>> >> to check it out.
>> >>
>> >> Marcus
>> >>
>> >> On Fri, Feb 10, 2012 at 3:27 PM, David Gobbi <david.gobbi at gmail.com>
>> >> wrote:
>> >> > Hi Markus,
>> >> >
>> >> > The error looks identical to an issue that I saw in VTK where the
>> >> > developers used macros to fool the wrappers into thinking that
>> >> > vtkIntArray et al had vtkDataArray as their superclass, when the
>> >> > real superclass was in fact vtkDataArrayTemplate<int>.  With the
>> >> > new macro expansion code, the wrappers aren't fooled anymore.
>> >> >
>> >> > I can add special-cases to the wrapper code for these Paraview
>> >> > classes (as I did for vtkDataArray) until I up with a general
>> >> > solution.
>> >> >
>> >> >  - David
>> >> >
>> >> >
>> >> > On Fri, Feb 10, 2012 at 12:34 PM, Marcus D. Hanwell
>> >> > <marcus.hanwell at kitware.com> wrote:
>> >> >> Hi David,
>> >> >>
>> >> >> It looks like there are some issues introduced in ParaView's client
>> >> >> server wrapping with the new macro expansion code, I am seeing
>> >> >> failures such as,
>> >> >>
>> >> >> [ 85%] Building CXX object
>> >> >>
>> >> >>
>> >> >> ParaViewCore/ServerImplementation/CMakeFiles/vtkPVServerImplementationCS.dir/vtkSIDoubleVectorPropertyClientServer.cxx.o
>> >> >>
>> >> >>
>> >> >> /home/marcus/ssd/build/ParaView/ParaViewCore/ServerImplementation/vtkSIDoubleVectorPropertyClientServer.cxx:16:40:
>> >> >> error: invalid declarator before ‘Command’
>> >> >>
>> >> >>
>> >> >> /home/marcus/ssd/build/ParaView/ParaViewCore/ServerImplementation/vtkSIDoubleVectorPropertyClientServer.cxx:
>> >> >> In function ‘int
>> >> >> vtkSIDoubleVectorPropertyCommand(vtkClientServerInterpreter*,
>> >> >> vtkObjectBase*, const char*, const vtkClientServerStream&,
>> >> >> vtkClientServerStream&)’:
>> >> >>
>> >> >>
>> >> >> /home/marcus/ssd/build/ParaView/ParaViewCore/ServerImplementation/vtkSIDoubleVectorPropertyClientServer.cxx:87:42:
>> >> >> error: expected primary-expression before ‘Command’
>> >> >>
>> >> >>
>> >> >> /home/marcus/ssd/build/ParaView/ParaViewCore/ServerImplementation/vtkSIDoubleVectorPropertyClientServer.cxx:87:42:
>> >> >> error: expected ‘)’ before ‘Command’
>> >> >>
>> >> >>
>> >> >> /home/marcus/ssd/build/ParaView/ParaViewCore/ServerImplementation/vtkSIDoubleVectorPropertyClientServer.cxx:
>> >> >> At global scope:
>> >> >>
>> >> >>
>> >> >> /home/marcus/ssd/build/ParaView/ParaViewCore/ServerImplementation/vtkSIDoubleVectorPropertyClientServer.cxx:109:41:
>> >> >> error: invalid declarator before ‘_Init’
>> >> >>
>> >> >>
>> >> >> /home/marcus/ssd/build/ParaView/ParaViewCore/ServerImplementation/vtkSIDoubleVectorPropertyClientServer.cxx:
>> >> >> In function ‘void
>> >> >> vtkSIDoubleVectorProperty_Init(vtkClientServerInterpreter*)’:
>> >> >>
>> >> >>
>> >> >> /home/marcus/ssd/build/ParaView/ParaViewCore/ServerImplementation/vtkSIDoubleVectorPropertyClientServer.cxx:119:49:
>> >> >> error: no matching function for call to
>> >> >>
>> >> >>
>> >> >> ‘vtkSIVectorPropertyTemplate<double>::vtkSIVectorPropertyTemplate(vtkClientServerInterpreter*&)’
>> >> >>
>> >> >>
>> >> >> /home/marcus/ssd/build/ParaView/ParaViewCore/ServerImplementation/vtkSIDoubleVectorPropertyClientServer.cxx:119:49:
>> >> >> note: candidates are:
>> >> >>
>> >> >>
>> >> >> /home/marcus/ssd/src/ParaView/ParaViewCore/ServerImplementation/vtkSIVectorPropertyTemplate.h:68:3:
>> >> >> note: vtkSIVectorPropertyTemplate<T,
>> >> >> force_idtype>::vtkSIVectorPropertyTemplate(const
>> >> >> vtkSIVectorPropertyTemplate<T, force_idtype>&) [with T = double,
>> >> >> force_idtype = int, vtkSIVectorPropertyTemplate<T, force_idtype> =
>> >> >> vtkSIVectorPropertyTemplate<double>]
>> >> >>
>> >> >>
>> >> >> /home/marcus/ssd/src/ParaView/ParaViewCore/ServerImplementation/vtkSIVectorPropertyTemplate.h:68:3:
>> >> >> note:   no known conversion for argument 1 from
>> >> >> ‘vtkClientServerInterpreter*’ to ‘const
>> >> >> vtkSIVectorPropertyTemplate<double>&’
>> >> >>
>> >> >>
>> >> >> /home/marcus/ssd/src/ParaView/ParaViewCore/ServerImplementation/vtkSIVectorPropertyTemplate.h:46:3:
>> >> >> note: vtkSIVectorPropertyTemplate<T,
>> >> >> force_idtype>::vtkSIVectorPropertyTemplate() [with T = double,
>> >> >> force_idtype = int]
>> >> >>
>> >> >>
>> >> >> /home/marcus/ssd/src/ParaView/ParaViewCore/ServerImplementation/vtkSIVectorPropertyTemplate.h:46:3:
>> >> >> note:   candidate expects 0 arguments, 1 provided
>> >> >>
>> >> >>
>> >> >> /home/marcus/ssd/src/ParaView/ParaViewCore/ServerImplementation/vtkSIVectorPropertyTemplate.h:47:3:
>> >> >> error: ‘vtkSIVectorPropertyTemplate<T,
>> >> >> force_idtype>::~vtkSIVectorPropertyTemplate() [with T = double,
>> >> >> force_idtype = int]’ is protected
>> >> >>
>> >> >>
>> >> >> /home/marcus/ssd/build/ParaView/ParaViewCore/ServerImplementation/vtkSIDoubleVectorPropertyClientServer.cxx:119:49:
>> >> >> error: within this context
>> >> >> make[2]: ***
>> >> >>
>> >> >> [ParaViewCore/ServerImplementation/CMakeFiles/vtkPVServerImplementationCS.dir/vtkSIDoubleVectorPropertyClientServer.cxx.o]
>> >> >> Error 1
>> >> >> make[1]: ***
>> >> >>
>> >> >> [ParaViewCore/ServerImplementation/CMakeFiles/vtkPVServerImplementationCS.dir/all]
>> >> >> Error 2
>> >> >> make: *** [all] Error 2
>> >> >>
>> >> >> The generated code looks wrong too, things such as the following are
>> >> >> appearing,
>> >> >>
>> >> >> int
>> >> >>
>> >> >> vtkSIVectorPropertyTemplate<double>Command(vtkClientServerInterpreter*,
>> >> >> vtkObjectBase*, const char*, const vtkClientServerStream&,
>> >> >> vtkClientServerStream& resultStream);
>> >> >>
>> >> >> and,
>> >> >>
>> >> >> if (vtkSIVectorPropertyTemplate<double>Command(arlu,
>> >> >> op,method,msg,resultStream))
>> >> >>    {
>> >> >>    return 1;
>> >> >>    }
>> >> >>
>> >> >> which becomes,
>> >> >>
>> >> >> if (vtkSIVectorPropertyCommand(arlu, op,method,msg,resultStream))
>> >> >>    {
>> >> >>    return 1;
>> >> >>    }
>> >> >>
>> >> >> when the commit is reverted locally. Is this a special case we need
>> >> >> to
>> >> >> add to the ParaView code?
>> >> >>
>> >> >> Thanks,
>> >> >>
>> >> >> Marcus
>> >> _______________________________________________
>> >> Powered by www.kitware.com
>> >>
>> >> Visit other Kitware open-source projects at
>> >> http://www.kitware.com/opensource/opensource.html
>> >>
>> >> Follow this link to subscribe/unsubscribe:
>> >> http://www.vtk.org/mailman/listinfo/vtk-developers
>> >>
>> >
>
>



More information about the vtk-developers mailing list