[vtk-developers] Any objection to vtkAbstractArray::SetVariantValue()?

Wilson, Andrew T atwilso at sandia.gov
Mon Aug 2 00:37:47 EDT 2010


The array classes already have InsertVariantValue(vtkIdType where,
vtkVariant value).  I would like to add SetVariantValue() as an analogue to
SetValue().  For one thing, it seems proper.  For another, I've just found a
bug in vtkTable that this will address...

Consider vtkTable::InsertNextRow(vtkVariantArray *).  If the array is
numeric, we get to a line that says

column->SetValue(id, variantValue.ToDouble())

This corrupts data when we have a number (such as a 64-bit int) that has too
many bits to be exactly represented by a double.  This drove me NUTS when I
was using vtkRowQueryToTable to read 64-bit values from a database and found
them corrupted when I got the table output.

Any comments or suggestions?  SetVariantValue() turns out to be very simple.

-- Andy





More information about the vtk-developers mailing list