Motorcortex Core  version: 2.7.6
type_name.h
1 /*
2  * Developer : Alexey Zakharov (alexey.zakharov@vectioneer.com)
3  * All rights reserved. Copyright (c) 2020 VECTIONEER.
4  */
5 
6 #ifndef MOTORCORTEX_CORE_TYPE_NAME_H
7 #define MOTORCORTEX_CORE_TYPE_NAME_H
8 
9 #include <typeinfo>
10 #include <cstdint>
11 
12 template<typename T>
13 struct TypeName {
14  static const char* get() {
15  return typeid(T).name();
16  }
17 };
18 
19 template<>
20 struct TypeName<uint8_t> {
21  static const char* get() {
22  return "uint8_t";
23  }
24 };
25 
26 template<>
27 struct TypeName<uint16_t> {
28  static const char* get() {
29  return "uint16_t";
30  }
31 };
32 
33 template<>
34 struct TypeName<uint32_t> {
35  static const char* get() {
36  return "uint32_t";
37  }
38 };
39 
40 template<>
41 struct TypeName<uint64_t> {
42  static const char* get() {
43  return "uint64_t";
44  }
45 };
46 
47 template<>
48 struct TypeName<int8_t> {
49  static const char* get() {
50  return "int8_t";
51  }
52 };
53 
54 template<>
55 struct TypeName<int16_t> {
56  static const char* get() {
57  return "int16_t";
58  }
59 };
60 
61 template<>
62 struct TypeName<int32_t> {
63  static const char* get() {
64  return "int32_t";
65  }
66 };
67 
68 template<>
69 struct TypeName<int64_t> {
70  static const char* get() {
71  return "int64_t";
72  }
73 };
74 
75 #endif //MOTORCORTEX_CORE_TYPE_NAME_H
TypeName
Definition: type_name.h:13