VTK  9.0.2
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 
32 #ifndef vtkVariantCreate_h
33 #define vtkVariantCreate_h
34 
35 #include <typeinfo> // for warnings
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  return vtkVariant();
45 }
46 
47 template <>
49 {
50  return value;
51 }
52 
53 template <>
54 inline vtkVariant vtkVariantCreate<unsigned char>(const unsigned char& value)
55 {
56  return value;
57 }
58 
59 template <>
61 {
62  return value;
63 }
64 
65 template <>
66 inline vtkVariant vtkVariantCreate<unsigned short>(const unsigned short& value)
67 {
68  return value;
69 }
70 
71 template <>
73 {
74  return value;
75 }
76 
77 template <>
78 inline vtkVariant vtkVariantCreate<unsigned int>(const unsigned int& value)
79 {
80  return value;
81 }
82 
83 template <>
85 {
86  return value;
87 }
88 
89 template <>
90 inline vtkVariant vtkVariantCreate<unsigned long>(const unsigned long& value)
91 {
92  return value;
93 }
94 
95 template <>
97 {
98  return value;
99 }
100 
101 template <>
102 inline vtkVariant vtkVariantCreate<unsigned long long>(const unsigned long long& value)
103 {
104  return value;
105 }
106 
107 template <>
109 {
110  return value;
111 }
112 
113 template <>
115 {
116  return value;
117 }
118 
119 template <>
121 {
122  return value;
123 }
124 
125 template <>
127 {
128  return value;
129 }
130 
131 template <>
133 {
134  return value;
135 }
136 
137 #endif
138 
139 // VTK-HeaderTest-Exclude: vtkVariantCreate.h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:35
String class that stores Unicode text.
A atomic type representing the union of many types.
Definition: vtkVariant.h:66
@ value
Definition: vtkX3D.h:226
@ name
Definition: vtkX3D.h:225
vtkVariant vtkVariantCreate< vtkStdString >(const vtkStdString &value)
vtkVariant vtkVariantCreate< vtkUnicodeString >(const vtkUnicodeString &value)
vtkVariant vtkVariantCreate(const T &)
vtkVariant vtkVariantCreate< unsigned long >(const unsigned long &value)
vtkVariant vtkVariantCreate< float >(const float &value)
vtkVariant vtkVariantCreate< int >(const int &value)
vtkVariant vtkVariantCreate< unsigned short >(const unsigned short &value)
vtkVariant vtkVariantCreate< unsigned char >(const unsigned char &value)
vtkVariant vtkVariantCreate< unsigned int >(const unsigned int &value)
vtkVariant vtkVariantCreate< long >(const long &value)
vtkVariant vtkVariantCreate< double >(const double &value)
vtkVariant vtkVariantCreate< unsigned long long >(const unsigned long long &value)
vtkVariant vtkVariantCreate< short >(const short &value)
vtkVariant vtkVariantCreate< vtkVariant >(const vtkVariant &value)
vtkVariant vtkVariantCreate< long long >(const long long &value)
vtkVariant vtkVariantCreate< char >(const char &value)