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 template<>
100 {
101  return value;
102 }
103 
104 template<>
105 inline vtkVariant vtkVariantCreate<unsigned long long>(const unsigned long long& value)
106 {
107  return value;
108 }
109 
110 template<>
112 {
113  return value;
114 }
115 
116 template<>
118 {
119  return value;
120 }
121 
122 template<>
124 {
125  return value;
126 }
127 
128 template<>
130 {
131  return value;
132 }
133 
134 template<>
136 {
137  return value;
138 }
139 
140 #endif
141 
142 // 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.