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 
35 #ifndef vtkVariantCreate_h
36 #define vtkVariantCreate_h
37 
38 #include <typeinfo> // for warnings
39 
40 template<typename T>
42 {
43  vtkGenericWarningMacro(
44  << "Cannot convert unsupported type [" << typeid(T).name() << "] to vtkVariant. "
45  << "Create a vtkVariantCreate<> specialization to eliminate this warning."
46  );
47 
48  return vtkVariant();
49 }
50 
51 template<>
53 {
54  return value;
55 }
56 
57 template<>
58 inline vtkVariant vtkVariantCreate<unsigned char>(const unsigned char& value)
59 {
60  return value;
61 }
62 
63 template<>
65 {
66  return value;
67 }
68 
69 template<>
70 inline vtkVariant vtkVariantCreate<unsigned short>(const unsigned short& value)
71 {
72  return value;
73 }
74 
75 template<>
77 {
78  return value;
79 }
80 
81 template<>
82 inline vtkVariant vtkVariantCreate<unsigned int>(const unsigned int& value)
83 {
84  return value;
85 }
86 
87 template<>
89 {
90  return value;
91 }
92 
93 template<>
94 inline vtkVariant vtkVariantCreate<unsigned long>(const unsigned long& value)
95 {
96  return value;
97 }
98 
99 template<>
101 {
102  return value;
103 }
104 
105 template<>
106 inline vtkVariant vtkVariantCreate<unsigned long long>(const unsigned long long& value)
107 {
108  return value;
109 }
110 
111 template<>
113 {
114  return value;
115 }
116 
117 template<>
119 {
120  return value;
121 }
122 
123 template<>
125 {
126  return value;
127 }
128 
129 template<>
131 {
132  return value;
133 }
134 
135 template<>
137 {
138  return value;
139 }
140 
141 #endif
142 
143 // VTK-HeaderTest-Exclude: vtkVariantCreate.h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:40
vtkVariant vtkVariantCreate(const T &)
A atomic type representing the union of many types.
Definition: vtkVariant.h:71
String class that stores Unicode text.
Performs an explicit conversion from an arbitrary type to a vtkVariant.