MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
type_traits.hpp
1 /*
2  Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; see the file COPYING. If not, write to the
15  Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
16  MA 02110-1301 USA.
17 */
18 
19 /* type_traits defines fundamental types
20  * see discussion in C++ Templates, $19.1
21 */
22 
23 
24 #ifndef TAO_CRYPT_TYPE_TRAITS_HPP
25 #define TAO_CRYPT_TYPE_TRAITS_HPP
26 
27 #include "types.hpp"
28 
29 namespace TaoCrypt {
30 
31 
32 // primary template: in general T is not a fundamental type
33 
34 template <typename T>
36  public:
37  enum { Yes = 0, No = 1 };
38 };
39 
40 
41 // macro to specialize for fundamental types
42 #define MK_FUNDAMENTAL_TYPE(T) \
43  template<> class IsFundamentalType<T> { \
44  public: \
45  enum { Yes = 1, No = 0 }; \
46  };
47 
48 
49 MK_FUNDAMENTAL_TYPE(void)
50 
51 MK_FUNDAMENTAL_TYPE(bool)
52 MK_FUNDAMENTAL_TYPE( char)
53 MK_FUNDAMENTAL_TYPE(signed char)
54 MK_FUNDAMENTAL_TYPE(unsigned char)
55 
56 MK_FUNDAMENTAL_TYPE(signed short)
57 MK_FUNDAMENTAL_TYPE(unsigned short)
58 MK_FUNDAMENTAL_TYPE(signed int)
59 MK_FUNDAMENTAL_TYPE(unsigned int)
60 MK_FUNDAMENTAL_TYPE(signed long)
61 MK_FUNDAMENTAL_TYPE(unsigned long)
62 
63 MK_FUNDAMENTAL_TYPE(float)
64 MK_FUNDAMENTAL_TYPE( double)
65 MK_FUNDAMENTAL_TYPE(long double)
66 
67 #if defined(WORD64_AVAILABLE) && defined(WORD64_IS_DISTINCT_TYPE)
68  MK_FUNDAMENTAL_TYPE(word64)
69 #endif
70 
71 
72 #undef MK_FUNDAMENTAL_TYPE
73 
74 
75 } // namespace
76 
77 #endif // TAO_CRYPT_TYPE_TRAITS_HPP