fw4spl
TypeInfoKeyTypeMapping.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2015.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #include "fwTools/TypeInfoKeyTypeMapping.hpp"
8 #include <typeinfo>
9 
10 
11 namespace fwTools
12 {
13 
17 template<class T>
18 bool isMappingTypeInfoCommon(const std::type_info &key)
19 {
20  return key == typeid( T );
21 }
22 // warning specialization from a partial specialization is not possible
23 
24 
25 
26 // FIX UNSIGNED
27 template<>
28 bool isMapping<unsigned char>(const std::type_info &key)
29 {
30  return isMappingTypeInfoCommon< unsigned char >(key);
31 }
32 template<>
33 bool isMapping<unsigned short>(const std::type_info &key)
34 {
35  return isMappingTypeInfoCommon< unsigned short >(key);
36 }
37 template<>
38 bool isMapping<unsigned int>(const std::type_info &key)
39 {
40  return isMappingTypeInfoCommon< unsigned int >(key);
41 }
42 template<>
43 bool isMapping<unsigned long>(const std::type_info &key)
44 {
45  return isMappingTypeInfoCommon< unsigned long >(key);
46 }
47 
48 // FIXED PRECISION SIGNED
49 template<>
50 bool isMapping<signed char>(const std::type_info &key)
51 {
52  return isMappingTypeInfoCommon< signed char >(key);
53 }
54 template<>
55 bool isMapping<signed short>(const std::type_info &key)
56 {
57  return isMappingTypeInfoCommon< signed short >(key);
58 }
59 template<>
60 bool isMapping<signed int>(const std::type_info &key)
61 {
62  return isMappingTypeInfoCommon< signed int >(key);
63 }
64 
65 template<>
66 bool isMapping<signed long>(const std::type_info &key)
67 {
68  return isMappingTypeInfoCommon< signed long >(key);
69 }
70 
71 
72 // FLOATING PRECISION
73 template<>
74 bool isMapping<float>(const std::type_info &key)
75 {
76  return isMappingTypeInfoCommon< float >(key);
77 }
78 template<>
79 bool isMapping<double>(const std::type_info &key)
80 {
81  return isMappingTypeInfoCommon< double >(key);
82 }
83 
84 // MISC
85 template<>
86 bool isMapping< std::string >(const std::type_info &key)
87 {
88  return isMappingTypeInfoCommon< std::string >(key);
89 }
90 
91 
92 } // end namespace fwTools {
FWTOOLS_API bool isMapping< std::string >(const DynamicType &key)
Template specialization for defining KeyType mapping ( here DynamicType) with their value...
FWTOOLS_API bool isMapping< float >(const DynamicType &key)
Template specialization for defining KeyType mapping ( here DynamicType) with their value...
bool isMappingTypeInfoCommon(const std::type_info &key)
template specialization for defining KeyType mapping ( here std::type_info) with their value ...
FWTOOLS_API bool isMapping< unsigned char >(const DynamicType &key)
Template specialization for defining KeyType mapping ( here DynamicType) with their value...
The namespace fwTools contains several tools like UUID, factory, dispatche, stringizer, macros, helper.
FWTOOLS_API bool isMapping< signed char >(const DynamicType &key)
Template specialization for defining KeyType mapping ( here DynamicType) with their value...
FWTOOLS_API bool isMapping< unsigned int >(const DynamicType &key)
Template specialization for defining KeyType mapping ( here DynamicType) with their value...
FWTOOLS_API bool isMapping< signed long >(const DynamicType &key)
Template specialization for defining KeyType mapping ( here DynamicType) with their value...
FWTOOLS_API bool isMapping< double >(const DynamicType &key)
Template specialization for defining KeyType mapping ( here DynamicType) with their value...
FWTOOLS_API bool isMapping< signed int >(const DynamicType &key)
Template specialization for defining KeyType mapping ( here DynamicType) with their value...
FWTOOLS_API bool isMapping< signed short >(const DynamicType &key)
Template specialization for defining KeyType mapping ( here DynamicType) with their value...
FWTOOLS_API bool isMapping< unsigned long >(const DynamicType &key)
Template specialization for defining KeyType mapping ( here DynamicType) with their value...
FWTOOLS_API bool isMapping< unsigned short >(const DynamicType &key)
Template specialization for defining KeyType mapping ( here DynamicType) with their value...