| 1 | #ifndef PNM_NAME_BUILTIN_TYPES_H |
| 2 | #define PNM_NAME_BUILTIN_TYPES_H |
| 3 | |
| 4 | #include <string> |
| 5 | |
| 6 | namespace CVD |
| 7 | { |
| 8 | namespace PNM |
| 9 | { |
| 10 | template <class T> |
| 11 | struct type_name |
| 12 | { |
| 13 | static const std::string name() { return "unknown"; } |
| 14 | }; |
| 15 | template <> |
| 16 | struct type_name<bool> |
| 17 | { |
| 18 | static const std::string name() { return "bool"; } |
| 19 | }; |
| 20 | template <> |
| 21 | struct type_name<char> |
| 22 | { |
| 23 | static const std::string name() { return "char"; } |
| 24 | }; |
| 25 | template <> |
| 26 | struct type_name<signed char> |
| 27 | { |
| 28 | static const std::string name() { return "signed char"; } |
| 29 | }; |
| 30 | template <> |
| 31 | struct type_name<unsigned char> |
| 32 | { |
| 33 | static const std::string name() { return "unsigned char"; } |
| 34 | }; |
| 35 | template <> |
| 36 | struct type_name<short> |
| 37 | { |
| 38 | static const std::string name() { return "short"; } |
| 39 | }; |
| 40 | template <> |
| 41 | struct type_name<unsigned short> |
| 42 | { |
| 43 | static const std::string name() { return "unsigned short"; } |
| 44 | }; |
| 45 | template <> |
| 46 | struct type_name<int> |
| 47 | { |
| 48 | static const std::string name() { return "int"; } |
| 49 | }; |
| 50 | template <> |
| 51 | struct type_name<unsigned int> |
| 52 | { |
| 53 | static const std::string name() { return "unsigned int"; } |
| 54 | }; |
| 55 | template <> |
| 56 | struct type_name<long> |
| 57 | { |
| 58 | static const std::string name() { return "long"; } |
| 59 | }; |
| 60 | template <> |
| 61 | struct type_name<unsigned long> |
| 62 | { |
| 63 | static const std::string name() { return "unsigned long"; } |
| 64 | }; |
| 65 | template <> |
| 66 | struct type_name<long long> |
| 67 | { |
| 68 | static const std::string name() { return "long long"; } |
| 69 | }; |
| 70 | template <> |
| 71 | struct type_name<unsigned long long> |
| 72 | { |
| 73 | static const std::string name() { return "unsigned long long"; } |
| 74 | }; |
| 75 | template <> |
| 76 | struct type_name<float> |
| 77 | { |
| 78 | static const std::string name() { return "float"; } |
| 79 | }; |
| 80 | template <> |
| 81 | struct type_name<double> |
| 82 | { |
| 83 | static const std::string name() { return "double"; } |
| 84 | }; |
| 85 | template <> |
| 86 | struct type_name<long double> |
| 87 | { |
| 88 | static const std::string name() { return "long double"; } |
| 89 | }; |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | #endif |