VTK
vtkVariantCreate.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVariantCreate.h
5 
6 -------------------------------------------------------------------------
7  Copyright 2008 Sandia Corporation.
8  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9  the U.S. Government retains certain rights in this software.
10 -------------------------------------------------------------------------
11 
12  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
13  All rights reserved.
14  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
15 
16  This software is distributed WITHOUT ANY WARRANTY; without even
17  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18  PURPOSE. See the above copyright notice for more information.
19 
20 =========================================================================*/
21 
34 #ifndef vtkVariantCreate_h
35 #define vtkVariantCreate_h
36 
37 #include <typeinfo> // for warnings
38 
39 template<typename T>
41 {
42  vtkGenericWarningMacro(
43  << "Cannot convert unsupported type [" << typeid(T).name() << "] to vtkVariant. "
44  << "Create a vtkVariantCreate<> specialization to eliminate this warning."
45  );
46 
47  return vtkVariant();
48 }
49 
50 template<>
52 {
53  return value;
54 }
55 
56 template<>
57 inline vtkVariant vtkVariantCreate<unsigned char>(const unsigned char& value)
58 {
59  return value;
60 }
61 
62 template<>
64 {
65  return value;
66 }
67 
68 template<>
69 inline vtkVariant vtkVariantCreate<unsigned short>(const unsigned short& value)
70 {
71  return value;
72 }
73 
74 template<>
76 {
77  return value;
78 }
79 
80 template<>
81 inline vtkVariant vtkVariantCreate<unsigned int>(const unsigned int& value)
82 {
83  return value;
84 }
85 
86 template<>
88 {
89  return value;
90 }
91 
92 template<>
93 inline vtkVariant vtkVariantCreate<unsigned long>(const unsigned long& value)
94 {
95  return value;
96 }
97 
98 #ifdef VTK_TYPE_USE___INT64
99 
100 template<>
101 inline vtkVariant vtkVariantCreate<__int64>(const __int64& value)
102 {
103  return value;
104 }
105 
106 template<>
107 inline vtkVariant vtkVariantCreate<unsigned __int64>(const unsigned __int64& value)
108 {
109  return value;
110 }
111 
112 #endif
113 
114 
115 #ifdef VTK_TYPE_USE_LONG_LONG
116 
117 template<>
118 inline vtkVariant vtkVariantCreate<long long>(const long long& value)
119 {
120  return value;
121 }
122 
123 template<>
124 inline vtkVariant vtkVariantCreate<unsigned long long>(const unsigned long long& value)
125 {
126  return value;
127 }
128 
129 #endif
130 
131 template<>
133 {
134  return value;
135 }
136 
137 template<>
139 {
140  return value;
141 }
142 
143 template<>
145 {
146  return value;
147 }
148 
149 template<>
151 {
152  return value;
153 }
154 
155 template<>
157 {
158  return value;
159 }
160 
161 #endif
162 
163 // VTK-HeaderTest-Exclude: vtkVariantCreate.h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:46
vtkVariant vtkVariantCreate(const T &)
A atomic type representing the union of many types.
Definition: vtkVariant.h:78
String class that stores Unicode text.