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