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 template<typename T>
39 {
40  vtkGenericWarningMacro(
41  << "Cannot convert unsupported type [" << typeid(T).name() << "] to vtkVariant. "
42  << "Create a vtkVariantCreate<> specialization to eliminate this warning."
43  );
44 
45  return vtkVariant();
46 }
47 
48 template<>
50 {
51  return value;
52 }
53 
54 template<>
55 inline vtkVariant vtkVariantCreate<unsigned char>(const unsigned char& value)
56 {
57  return value;
58 }
59 
60 template<>
62 {
63  return value;
64 }
65 
66 template<>
67 inline vtkVariant vtkVariantCreate<unsigned short>(const unsigned short& value)
68 {
69  return value;
70 }
71 
72 template<>
74 {
75  return value;
76 }
77 
78 template<>
79 inline vtkVariant vtkVariantCreate<unsigned int>(const unsigned int& value)
80 {
81  return value;
82 }
83 
84 template<>
86 {
87  return value;
88 }
89 
90 template<>
91 inline vtkVariant vtkVariantCreate<unsigned long>(const unsigned long& value)
92 {
93  return value;
94 }
95 
96 #ifdef VTK_TYPE_USE___INT64
97 
98 template<>
99 inline vtkVariant vtkVariantCreate<__int64>(const __int64& value)
100 {
101  return value;
102 }
103 
104 template<>
105 inline vtkVariant vtkVariantCreate<unsigned __int64>(const unsigned __int64& value)
106 {
107  return value;
108 }
109 
110 #endif
111 
112 
113 #ifdef VTK_TYPE_USE_LONG_LONG
114 
115 template<>
116 inline vtkVariant vtkVariantCreate<long long>(const long long& value)
117 {
118  return value;
119 }
120 
121 template<>
122 inline vtkVariant vtkVariantCreate<unsigned long long>(const unsigned long long& value)
123 {
124  return value;
125 }
126 
127 #endif
128 
129 template<>
131 {
132  return value;
133 }
134 
135 template<>
137 {
138  return value;
139 }
140 
141 template<>
143 {
144  return value;
145 }
146 
147 template<>
149 {
150  return value;
151 }
152 
153 template<>
155 {
156  return value;
157 }
158 
159 #endif
160 
161 // VTK-HeaderTest-Exclude: vtkVariantCreate.h