Skip to content
Snippets Groups Projects
Commit c90fed78 authored by Alexy Pellegrini's avatar Alexy Pellegrini
Browse files

Add support of VTK_BIT type in vtkAbstractArray::GetVariantValue

parent d236d27d
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@
#include "vtkNew.h"
#include <array>
#include <bitset>
#include <string>
......@@ -77,5 +78,27 @@ int TestBitArray(int, char*[])
return EXIT_FAILURE;
}
// Test GetVariantValue accessor
array->Resize(4);
array->SetValue(0, 0);
array->SetValue(1, 1);
array->SetValue(2, 1);
array->SetValue(3, 0);
std::array<int, 4> variantValues = {
array->GetVariantValue(0).ToInt(),
array->GetVariantValue(1).ToInt(),
array->GetVariantValue(2).ToInt(),
array->GetVariantValue(3).ToInt(),
};
if (variantValues != std::array<int, 4>{ 0, 1, 1, 0 })
{
std::cerr << "GetVariantValue return invalid data \"{" << variantValues[0] << ", "
<< variantValues[1] << ", " << variantValues[2] << ", " << variantValues[3]
<< "}\", it should be \"{0, 1, 1, 0}\"" << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
......@@ -528,6 +528,8 @@ vtkVariant vtkAbstractArray::GetVariantValue(vtkIdType valueIdx)
{
vtkExtraExtendedTemplateMacro(val = vtkAbstractArrayGetVariantValue(
static_cast<VTK_TT*>(this->GetVoidPointer(0)), valueIdx));
vtkTemplateMacroCase(
VTK_BIT, int, val = static_cast<VTK_TT>(static_cast<vtkBitArray*>(this)->GetValue(valueIdx)));
}
return val;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment