Skip to content
Snippets Groups Projects
Commit 84b126f9 authored by T.J. Corona's avatar T.J. Corona Committed by Kitware Robot
Browse files

Merge topic 'data-array-update-lookup'


c7ebe5bc vtkDataArrayTemplate: Add a safe method to change an element with vtkVariant.

Acked-by: default avatarKitware Robot <kwrobot@kitware.com>
Acked-by: default avatarBrad King <brad.king@kitware.com>
Acked-by: default avatarBen Boeckel <ben.boeckel@kitware.com>
Reviewed-by: default avatarBerk Geveci <berk.geveci@kitware.com>
Merge-request: !526
parents 98b27baf c7ebe5bc
Branches
Tags
No related merge requests found
......@@ -212,6 +212,10 @@ public:
// Set a value in the array from a vtkVariant.
void SetVariantValue(vtkIdType id, vtkVariant value);
// Description:
// Insert a value in the array from a vtkVariant.
void InsertVariantValue(vtkIdType id, vtkVariant value);
// Description:
// Insert data at the end of the array. Return its location in the array.
vtkIdType InsertNextValue(T f);
......
......@@ -979,6 +979,22 @@ void vtkDataArrayTemplate<T>::SetVariantValue(vtkIdType id, vtkVariant value)
}
}
//----------------------------------------------------------------------------
template <class T>
void vtkDataArrayTemplate<T>::InsertVariantValue(vtkIdType id, vtkVariant value)
{
bool valid;
T toInsert = vtkVariantCast<T>(value, &valid);
if (valid)
{
this->InsertValue(id, toInsert);
}
else
{
vtkErrorMacro("unable to set value of type " << value.GetType());
}
}
//----------------------------------------------------------------------------
template <class T>
vtkIdType vtkDataArrayTemplate<T>::InsertNextValue(T f)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment