Skip to content
Snippets Groups Projects
Commit 700649df authored by Ben Boeckel's avatar Ben Boeckel
Browse files

vtkHDFUtilities: support `char` as unsigned

parent ad3c8e73
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@
#include "vtkLongArray.h"
#include "vtkLongLongArray.h"
#include "vtkShortArray.h"
#include "vtkSignedCharArray.h"
#include "vtkStringArray.h"
#include "vtkUnsignedCharArray.h"
#include "vtkUnsignedIntArray.h"
......@@ -82,6 +83,10 @@ vtkDataArray* NewVtkDataArray()
{
return vtkCharArray::New();
}
else if (std::is_same<T, signed char>::value)
{
return vtkSignedCharArray::New();
}
else if (std::is_same<T, unsigned char>::value)
{
return vtkUnsignedCharArray::New();
......@@ -227,6 +232,7 @@ using TypeReaderMap = std::map<::TypeDescription, ArrayReader*>;
::TypeReaderMap readerMap;
readerMap[::GetTypeDescription(H5T_NATIVE_CHAR)] = &::NewArray<char>;
readerMap[::GetTypeDescription(H5T_NATIVE_SCHAR)] = &::NewArray<signed char>;
readerMap[::GetTypeDescription(H5T_NATIVE_UCHAR)] = &::NewArray<unsigned char>;
readerMap[::GetTypeDescription(H5T_NATIVE_SHORT)] = &::NewArray<short>;
readerMap[::GetTypeDescription(H5T_NATIVE_USHORT)] = &::NewArray<unsigned short>;
......
......@@ -107,6 +107,10 @@ hid_t vtkHDFUtilities::TemplateTypeToHdfNativeType()
{
return H5T_NATIVE_CHAR;
}
if (std::is_same<T, signed char>::value)
{
return H5T_NATIVE_SCHAR;
}
else if (std::is_same<T, unsigned char>::value)
{
return H5T_NATIVE_UCHAR;
......
......@@ -1243,7 +1243,8 @@ hsize_t vtkHDFWriter::Implementation::GetSubfileNumberOf(
std::vector<hsize_t> start{ static_cast<unsigned long>(part) }, count{ 1 }, result{ 0 };
int dimension = 1;
if (this->HdfType == "PolyData" && primitive != (char)0xff)
constexpr char INVALID_PRIMITIVE = 0xff;
if (this->HdfType == "PolyData" && primitive != INVALID_PRIMITIVE)
{
start.emplace_back(static_cast<hsize_t>(primitive));
count.emplace_back(1);
......
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