VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkVariantCreate.h 00005 00006 ------------------------------------------------------------------------- 00007 Copyright 2008 Sandia Corporation. 00008 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00009 the U.S. Government retains certain rights in this software. 00010 ------------------------------------------------------------------------- 00011 00012 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00013 All rights reserved. 00014 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00015 00016 This software is distributed WITHOUT ANY WARRANTY; without even 00017 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00018 PURPOSE. See the above copyright notice for more information. 00019 00020 =========================================================================*/ 00021 00034 #ifndef __vtkVariantCreate_h 00035 #define __vtkVariantCreate_h 00036 00037 #include <typeinfo> // for warnings 00038 00039 template<typename T> 00040 vtkVariant vtkVariantCreate(const T&) 00041 { 00042 vtkGenericWarningMacro( 00043 << "Cannot convert unsupported type [" << typeid(T).name() << "] to vtkVariant. " 00044 << "Create a vtkVariantCreate<> specialization to eliminate this warning." 00045 ); 00046 00047 return vtkVariant(); 00048 } 00049 00050 template<> 00051 inline vtkVariant vtkVariantCreate<char>(const char& value) 00052 { 00053 return value; 00054 } 00055 00056 template<> 00057 inline vtkVariant vtkVariantCreate<unsigned char>(const unsigned char& value) 00058 { 00059 return value; 00060 } 00061 00062 template<> 00063 inline vtkVariant vtkVariantCreate<short>(const short& value) 00064 { 00065 return value; 00066 } 00067 00068 template<> 00069 inline vtkVariant vtkVariantCreate<unsigned short>(const unsigned short& value) 00070 { 00071 return value; 00072 } 00073 00074 template<> 00075 inline vtkVariant vtkVariantCreate<int>(const int& value) 00076 { 00077 return value; 00078 } 00079 00080 template<> 00081 inline vtkVariant vtkVariantCreate<unsigned int>(const unsigned int& value) 00082 { 00083 return value; 00084 } 00085 00086 template<> 00087 inline vtkVariant vtkVariantCreate<long>(const long& value) 00088 { 00089 return value; 00090 } 00091 00092 template<> 00093 inline vtkVariant vtkVariantCreate<unsigned long>(const unsigned long& value) 00094 { 00095 return value; 00096 } 00097 00098 #ifdef VTK_TYPE_USE___INT64 00099 00100 template<> 00101 inline vtkVariant vtkVariantCreate<__int64>(const __int64& value) 00102 { 00103 return value; 00104 } 00105 00106 template<> 00107 inline vtkVariant vtkVariantCreate<unsigned __int64>(const unsigned __int64& value) 00108 { 00109 return value; 00110 } 00111 00112 #endif 00113 00114 00115 #ifdef VTK_TYPE_USE_LONG_LONG 00116 00117 template<> 00118 inline vtkVariant vtkVariantCreate<long long>(const long long& value) 00119 { 00120 return value; 00121 } 00122 00123 template<> 00124 inline vtkVariant vtkVariantCreate<unsigned long long>(const unsigned long long& value) 00125 { 00126 return value; 00127 } 00128 00129 #endif 00130 00131 template<> 00132 inline vtkVariant vtkVariantCreate<float>(const float& value) 00133 { 00134 return value; 00135 } 00136 00137 template<> 00138 inline vtkVariant vtkVariantCreate<double>(const double& value) 00139 { 00140 return value; 00141 } 00142 00143 template<> 00144 inline vtkVariant vtkVariantCreate<vtkStdString>(const vtkStdString& value) 00145 { 00146 return value; 00147 } 00148 00149 template<> 00150 inline vtkVariant vtkVariantCreate<vtkUnicodeString>(const vtkUnicodeString& value) 00151 { 00152 return value; 00153 } 00154 00155 template<> 00156 inline vtkVariant vtkVariantCreate<vtkVariant>(const vtkVariant& value) 00157 { 00158 return value; 00159 } 00160 00161 #endif 00162 00163 // VTK-HeaderTest-Exclude: vtkVariantCreate.h