TypeName.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstdint> // TODO
4 #include <string>
5 #include <typeinfo>
6 
7 namespace armarx::aron
8 {
9  // default implementation
10  template <typename T>
11  struct TypeName
12  {
13  static const char*
14  Get()
15  {
16  return typeid(T).name();
17  }
18  };
19 
20  template <>
21  struct TypeName<unsigned char>
22  {
23  static const char*
24  Get()
25  {
26  return "unsigned char";
27  }
28  };
29 
30  template <>
31  struct TypeName<unsigned short>
32  {
33  static const char*
34  Get()
35  {
36  return "unsigned short";
37  }
38  };
39 
40  template <>
41  struct TypeName<unsigned int>
42  {
43  static const char*
44  Get()
45  {
46  return "unsigned int";
47  }
48  };
49 
50  template <>
51  struct TypeName<short>
52  {
53  static const char*
54  Get()
55  {
56  return "short";
57  }
58  };
59 
60  template <>
61  struct TypeName<int>
62  {
63  static const char*
64  Get()
65  {
66  return "int";
67  }
68  };
69 
70  template <>
71  struct TypeName<float>
72  {
73  static const char*
74  Get()
75  {
76  return "float";
77  }
78  };
79 
80  template <>
81  struct TypeName<long>
82  {
83  static const char*
84  Get()
85  {
86  return "long";
87  }
88  };
89 
90  template <>
91  struct TypeName<double>
92  {
93  static const char*
94  Get()
95  {
96  return "double";
97  }
98  };
99 
100  template <>
101  struct TypeName<std::string>
102  {
103  static const char*
104  Get()
105  {
106  return "string";
107  }
108  };
109 
110  template <>
111  struct TypeName<bool>
112  {
113  static const char*
114  Get()
115  {
116  return "bool";
117  }
118  };
119 } // namespace armarx::aron
armarx::aron::TypeName
Definition: TypeName.h:11
armarx::aron::TypeName< std::string >::Get
static const char * Get()
Definition: TypeName.h:104
armarx::aron::TypeName< long >::Get
static const char * Get()
Definition: TypeName.h:84
armarx::aron::TypeName< short >::Get
static const char * Get()
Definition: TypeName.h:54
armarx::aron::TypeName< unsigned short >::Get
static const char * Get()
Definition: TypeName.h:34
armarx::aron::TypeName< float >::Get
static const char * Get()
Definition: TypeName.h:74
armarx::aron
Definition: DataDisplayVisitor.cpp:5
armarx::aron::TypeName< unsigned char >::Get
static const char * Get()
Definition: TypeName.h:24
armarx::aron::TypeName< int >::Get
static const char * Get()
Definition: TypeName.h:64
armarx::aron::TypeName< double >::Get
static const char * Get()
Definition: TypeName.h:94
float
#define float
Definition: 16_Level.h:22
std
Definition: Application.h:66
armarx::aron::TypeName< bool >::Get
static const char * Get()
Definition: TypeName.h:114
T
float T
Definition: UnscentedKalmanFilterTest.cpp:35
armarx::aron::TypeName< unsigned int >::Get
static const char * Get()
Definition: TypeName.h:44
armarx::aron::TypeName::Get
static const char * Get()
Definition: TypeName.h:14