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 template<typename T> 00038 vtkVariant vtkVariantCreate(const T&) 00039 { 00040 vtkGenericWarningMacro( 00041 << "Cannot convert unsupported type [" << typeid(T).name() << "] to vtkVariant. " 00042 << "Create a vtkVariantCreate<> specialization to eliminate this warning." 00043 ); 00044 00045 return vtkVariant(); 00046 } 00047 00048 template<> 00049 inline vtkVariant vtkVariantCreate<char>(const char& value) 00050 { 00051 return value; 00052 } 00053 00054 template<> 00055 inline vtkVariant vtkVariantCreate<unsigned char>(const unsigned char& value) 00056 { 00057 return value; 00058 } 00059 00060 template<> 00061 inline vtkVariant vtkVariantCreate<short>(const short& value) 00062 { 00063 return value; 00064 } 00065 00066 template<> 00067 inline vtkVariant vtkVariantCreate<unsigned short>(const unsigned short& value) 00068 { 00069 return value; 00070 } 00071 00072 template<> 00073 inline vtkVariant vtkVariantCreate<int>(const int& value) 00074 { 00075 return value; 00076 } 00077 00078 template<> 00079 inline vtkVariant vtkVariantCreate<unsigned int>(const unsigned int& value) 00080 { 00081 return value; 00082 } 00083 00084 template<> 00085 inline vtkVariant vtkVariantCreate<long>(const long& value) 00086 { 00087 return value; 00088 } 00089 00090 template<> 00091 inline vtkVariant vtkVariantCreate<unsigned long>(const unsigned long& value) 00092 { 00093 return value; 00094 } 00095 00096 #ifdef VTK_TYPE_USE___INT64 00097 00098 template<> 00099 inline vtkVariant vtkVariantCreate<__int64>(const __int64& value) 00100 { 00101 return value; 00102 } 00103 00104 template<> 00105 inline vtkVariant vtkVariantCreate<unsigned __int64>(const unsigned __int64& value) 00106 { 00107 return value; 00108 } 00109 00110 #endif 00111 00112 00113 #ifdef VTK_TYPE_USE_LONG_LONG 00114 00115 template<> 00116 inline vtkVariant vtkVariantCreate<long long>(const long long& value) 00117 { 00118 return value; 00119 } 00120 00121 template<> 00122 inline vtkVariant vtkVariantCreate<unsigned long long>(const unsigned long long& value) 00123 { 00124 return value; 00125 } 00126 00127 #endif 00128 00129 template<> 00130 inline vtkVariant vtkVariantCreate<float>(const float& value) 00131 { 00132 return value; 00133 } 00134 00135 template<> 00136 inline vtkVariant vtkVariantCreate<double>(const double& value) 00137 { 00138 return value; 00139 } 00140 00141 template<> 00142 inline vtkVariant vtkVariantCreate<vtkStdString>(const vtkStdString& value) 00143 { 00144 return value; 00145 } 00146 00147 template<> 00148 inline vtkVariant vtkVariantCreate<vtkUnicodeString>(const vtkUnicodeString& value) 00149 { 00150 return value; 00151 } 00152 00153 template<> 00154 inline vtkVariant vtkVariantCreate<vtkVariant>(const vtkVariant& value) 00155 { 00156 return value; 00157 } 00158 00159 #endif 00160