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<short>
22  {
23  static const char*
24  Get()
25  {
26  return "short";
27  }
28  };
29 
30  template <>
31  struct TypeName<int>
32  {
33  static const char*
34  Get()
35  {
36  return "int";
37  }
38  };
39 
40  template <>
41  struct TypeName<float>
42  {
43  static const char*
44  Get()
45  {
46  return "float";
47  }
48  };
49 
50  template <>
51  struct TypeName<long>
52  {
53  static const char*
54  Get()
55  {
56  return "long";
57  }
58  };
59 
60  template <>
61  struct TypeName<double>
62  {
63  static const char*
64  Get()
65  {
66  return "double";
67  }
68  };
69 
70  template <>
71  struct TypeName<std::string>
72  {
73  static const char*
74  Get()
75  {
76  return "string";
77  }
78  };
79 
80  template <>
81  struct TypeName<bool>
82  {
83  static const char*
84  Get()
85  {
86  return "bool";
87  }
88  };
89 } // namespace armarx::aron
armarx::aron::TypeName
Definition: TypeName.h:11
armarx::aron::TypeName< std::string >::Get
static const char * Get()
Definition: TypeName.h:74
armarx::aron::TypeName< long >::Get
static const char * Get()
Definition: TypeName.h:54
armarx::aron::TypeName< short >::Get
static const char * Get()
Definition: TypeName.h:24
armarx::aron::TypeName< float >::Get
static const char * Get()
Definition: TypeName.h:44
armarx::aron
Definition: DataDisplayVisitor.cpp:5
armarx::aron::TypeName< int >::Get
static const char * Get()
Definition: TypeName.h:34
armarx::aron::TypeName< double >::Get
static const char * Get()
Definition: TypeName.h:64
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:84
T
float T
Definition: UnscentedKalmanFilterTest.cpp:35
armarx::aron::TypeName::Get
static const char * Get()
Definition: TypeName.h:14