[vtk-developers] About the vtkDataArray::InsertTuple() method
Sean McBride
sean at rogue-research.com
Thu Mar 24 11:53:19 EDT 2016
On Thu, 24 Mar 2016 08:11:40 -0600, David Gobbi said:
>On Thu, Mar 24, 2016 at 8:03 AM, Sean McBride <sean at rogue-research.com>
>wrote:
>
>> On Wed, 23 Mar 2016 22:09:55 -0600, David Gobbi said:
>>
>> >Also related to data arrays: I'd love to see the deprecation of
>> >InsertValue() and InsertTuple(). The problems with them are:
>> >
>> >1) They are redundant. As far as I'm concerned, their usage can
>> >always be replaced with SetTuple() or InsertNextTuple() and the
>> >resulting code will become easier to read.
>> >
>> >2) They don't actually "insert" tuples except at the end of the
>> >array, and we have InsertNextTuple() or that purpose. Anywhere
>> >else in the array, they perform a replacement operation.
>> >
>> >Any thoughts? Are these methods widely used anywhere except
>> >for VTK's own source tree?
>>
>> No opinion per se, but as to your last question: it's impossible for us to
>> know, and polling this list is too small a sample size. I just grepped our
>> codebase and found 2 uses of InsertValue().
>>
>
>Yes, I prefer to get the opinions of other developers before opening it up
>to everyone :)
>
>But since you took the time to answer: for those two uses you found, was
>the usage of InsertValue() easy to understand, and was it a good match for
>the intent of the code?
In my 2 cases, it's always appending to the end of the data array. I guess I could use InsertNextValue() instead, if I understand it correctly.
I think your point #2 is quite valid. Since it's not *inserting*, but rather *replacing*, then the API name is very confusing. A deprecate and rename is in order IMHO.
Cheers,
--
____________________________________________________________
Sean McBride, B. Eng sean at rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
More information about the vtk-developers
mailing list