[vtk-developers] vtkVector class -- proposed rewrite

David Lonie loniedavid at gmail.com
Mon Aug 8 15:58:37 EDT 2011


On Tue, Aug 2, 2011 at 4:20 PM, David Lonie <loniedavid at gmail.com> wrote:
> On Tue, Aug 2, 2011 at 3:56 PM, Marcus D. Hanwell
> <marcus.hanwell at kitware.com> wrote:
>> On Tue, Aug 2, 2011 at 11:29 AM, David Gobbi <david.gobbi at gmail.com> wrote:
>>> On Tue, Aug 2, 2011 at 8:13 AM, David Lonie <loniedavid at gmail.com> wrote:
>>>> On Mon, Jul 25, 2011 at 3:22 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>>>> On Mon, Jul 25, 2011 at 12:17 PM, David Lonie <loniedavid at gmail.com> wrote:
>>>>>>
>>>>>> Would using a typedef be possible for the wrappers? e.g. "typedef
>>>>>> vtkVector<float, 3> vtkVector3f"? That would eliminate most of the
>>>>>> complexity in this patch.
>>>>>
>>>>> Right now, no, it won't work, but it would be easy to make it work,
>>>>> easier than handling the macro expansion
>>>>
>>>> Could this be added soon? I hope to submit the vtkChemistry patches to
>>>> gerrit soon, and this is a prerequisite. I understand if it will be a
>>>> while before this is added, I just want to know if I need to start
>>>> thinking about other approaches to the vector class in the meantime.
>>>
>>> Finalize your design for vtkVector first, and then I'll see what I can
>>> do to get it wrapped.  Both the macro approach and the typedef
>>> approach are potentially wrappable.  I cannot give a specific timeline
>>> for either of them.  Like most of my voluntary contributions to VTK,
>>> unless there is a specific incentive, it will happen when I feel like
>>> doing it.
>>>
>> If there is no preferred approach from a wrapping point of view then I
>> would suggest we pursue the typedef appraoch as I think that will give
>> us the most maintainable code in the long run.
>
> I agree -- I'll have a new patch ready sometime this week.

I've pushed a new branch, vtkVector-typedef, to my github repo:

http://github.com/dlonie/VTK/commits/vtkVector-typedef

This adds:

vtkVectorBase<typename T, int Size>
vtkVector<typename T, int Size>
typedefs for common vectors (3f, 4d, 2i, etc)

I've also added vtkVectorForwardDeclarations.h for headers that use
the typedefs but don't need the entire implementation.

If there are objections to this approach, or if there are changes that
will make it easier to parse, please let me know.

Thanks,
Dave



More information about the vtk-developers mailing list