10 #ifndef vtk_m_io_internal_VTKDataSetTypes_h
11 #define vtk_m_io_internal_VTKDataSetTypes_h
41 DTYPE_UNSIGNED_LONG_LONG,
47 inline const char* DataTypeString(
int id)
49 static const char* strings[] = {
50 "",
"bit",
"unsigned_char",
"char",
"unsigned_short",
51 "short",
"unsigned_int",
"int",
"unsigned_long",
"long",
52 "float",
"double",
"vtktypeuint64",
"vtktypeint64"
57 inline DataType DataTypeId(
const std::string& str)
59 DataType type = DTYPE_UNKNOWN;
60 for (
int id = 1;
id < DTYPE_COUNT; ++id)
62 if (str == DataTypeString(
id))
64 type =
static_cast<DataType
>(id);
74 operator bool()
const {
return false; }
89 : Data(static_cast<
vtkm::
UInt8>(std::min(std::max(val, 1.0f), 0.0f) * 255))
99 inline std::ostream&
operator<<(std::ostream& out,
const ColorChannel8& val)
101 return out << static_cast<vtkm::Float32>(val);
104 inline std::istream& operator>>(std::istream& in, ColorChannel8& val)
108 val = ColorChannel8(fval);
112 template <
typename T>
115 static const char* Name() {
return "unknown"; }
118 struct DataTypeName<DummyBitType>
120 static const char* Name() {
return "bit"; }
125 static const char* Name() {
return "char"; }
130 static const char* Name() {
return "unsigned_char"; }
135 static const char* Name() {
return "short"; }
140 static const char* Name() {
return "unsigned_short"; }
145 static const char* Name() {
return "int"; }
150 static const char* Name() {
return "unsigned_int"; }
155 static const char* Name() {
return "long"; }
160 static const char* Name() {
return "unsigned_long"; }
165 static const char* Name() {
return "float"; }
170 static const char* Name() {
return "double"; }
173 template <
typename Functor>
174 inline void SelectTypeAndCall(DataType dtype, Functor&& functor)
179 functor(DummyBitType());
181 case DTYPE_UNSIGNED_CHAR:
187 case DTYPE_UNSIGNED_SHORT:
193 case DTYPE_UNSIGNED_INT:
199 case DTYPE_UNSIGNED_LONG:
200 case DTYPE_UNSIGNED_LONG_LONG:
204 case DTYPE_LONG_LONG:
222 #endif // vtk_m_io_internal_VTKDataSetTypes_h