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"; }
 
  153 struct DataTypeName<
vtkm::Int64>
 
  155   static const char* Name() { 
return "long"; }
 
  158 struct DataTypeName<
vtkm::UInt64>
 
  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 T, 
typename Functor>
 
  174 inline void SelectVecTypeAndCall(T, 
vtkm::IdComponent numComponents, 
const Functor& functor)
 
  176   switch (numComponents)
 
  194       functor(numComponents, T());
 
  199 template <
typename Functor>
 
  200 inline void SelectTypeAndCall(DataType dtype,
 
  202                               const Functor& functor)
 
  207       SelectVecTypeAndCall(DummyBitType(), numComponents, functor);
 
  209     case DTYPE_UNSIGNED_CHAR:
 
  210       SelectVecTypeAndCall(
vtkm::UInt8(), numComponents, functor);
 
  213       SelectVecTypeAndCall(
vtkm::Int8(), numComponents, functor);
 
  215     case DTYPE_UNSIGNED_SHORT:
 
  216       SelectVecTypeAndCall(
vtkm::UInt16(), numComponents, functor);
 
  219       SelectVecTypeAndCall(
vtkm::Int16(), numComponents, functor);
 
  221     case DTYPE_UNSIGNED_INT:
 
  222       SelectVecTypeAndCall(
vtkm::UInt32(), numComponents, functor);
 
  225       SelectVecTypeAndCall(
vtkm::Int32(), numComponents, functor);
 
  227     case DTYPE_UNSIGNED_LONG:
 
  228     case DTYPE_UNSIGNED_LONG_LONG:
 
  229       SelectVecTypeAndCall(vtkm::UInt64(), numComponents, functor);
 
  232     case DTYPE_LONG_LONG:
 
  233       SelectVecTypeAndCall(vtkm::Int64(), numComponents, functor);
 
  236       SelectVecTypeAndCall(
vtkm::Float32(), numComponents, functor);
 
  239       SelectVecTypeAndCall(
vtkm::Float64(), numComponents, functor);
 
  252 #endif // vtk_m_io_internal_VTKDataSetTypes_h