NeuralEngine
A Game Engine with embeded Machine Learning algorithms based on Gaussian Processes.
NeTypetraits.h
1
11#pragma once
12
13#include <string>
14#include <vector>
15#include <typeinfo>
16#include <opencv2/core/core.hpp>
17
18namespace NeuralEngine
19{
20 class MatlabIOContainer;
21
22 enum {
23 MAT_INT8 = 1,
24 MAT_UINT8 = 2,
25 MAT_INT16 = 3,
26 MAT_UINT16 = 4,
27 MAT_INT32 = 5,
28 MAT_UINT32 = 6,
29 MAT_FLOAT = 7,
30 MAT_DOUBLE = 9,
31 MAT_INT64 = 12,
32 MAT_UINT64 = 13,
33 MAT_MATRIX = 14,
34 MAT_COMPRESSED = 15,
35 MAT_UTF8 = 16,
36 MAT_UTF16 = 17,
37 MAT_UTF32 = 18
38 };
39
40 enum {
41 MAT_CELL_CLASS = 1,
42 MAT_STRUCT_CLASS = 2,
43 MAT_OBJECT_CLASS = 3,
44 MAT_CHAR_CLASS = 4,
45 MAT_SPARSE_CLASS = 5,
46 MAT_DOUBLE_CLASS = 6,
47 MAT_FLOAT_CLASS = 7,
48 MAT_INT8_CLASS = 8,
49 MAT_UINT8_CLASS = 9,
50 MAT_INT16_CLASS = 10,
51 MAT_UINT16_CLASS = 11,
52 MAT_INT32_CLASS = 12,
53 MAT_UINT32_CLASS = 13,
54 MAT_INT64_CLASS = 14,
55 MAT_UINT64_CLASS = 15
56 };
57
58 // default implementation
59 template <typename T>
60 struct TypeName {
61 static const std::string toString() { return typeid(T).name(); }
62 };
63
64 // specialisations
65 template <>
66 struct TypeName<int8_t> {
67 static const std::string toString() { return "int8_t"; }
68 };
69
70 template <>
71 struct TypeName<uint8_t> {
72 static const std::string toString() { return "uint8_t"; }
73 };
74
75 template <>
76 struct TypeName<int16_t> {
77 static const std::string toString() { return "int16_t"; }
78 };
79
80 template <>
81 struct TypeName<uint16_t> {
82 static const std::string toString() { return "uint16_t"; }
83 };
84
85 template <>
86 struct TypeName<int32_t> {
87 static const std::string toString() { return "int32_t"; }
88 };
89
90 template <>
91 struct TypeName<uint32_t> {
92 static const std::string toString() { return "uint32_t"; }
93 };
94
95 template <>
96 struct TypeName<int64_t> {
97 static const std::string toString() { return "int64_t"; }
98 };
99
100 template <>
101 struct TypeName<uint64_t> {
102 static const std::string toString() { return "uint64_t"; }
103 };
104
105 template <>
106 struct TypeName<float> {
107 static const std::string toString() { return "float"; }
108 };
109
110 template <>
111 struct TypeName<double> {
112 static const std::string toString() { return "double"; }
113 };
114
115 template <>
116 struct TypeName<char> {
117 static const std::string toString() { return "string"; }
118 };
119
120 template <>
121 struct TypeName<bool> {
122 static const std::string toString() { return "logical"; }
123 };
124
125 template <>
126 struct TypeName<cv::Mat> {
127 static const std::string toString() { return "Mat"; }
128 };
129
130 template <>
132 static const std::string toString() { return "MatlabIOContainer"; }
133 };
134
135 template <>
136 struct TypeName<std::vector<MatlabIOContainer> > {
137 static const std::string toString() { return "vector<MatlabIOContainer>"; }
138 };
139
140 template <>
141 struct TypeName<std::vector<std::vector<MatlabIOContainer> > > {
142 static const std::string toString() { return "vector<vector<MatlabIOContainer>>"; }
143 };
144
145 template <>
146 struct TypeName<std::vector<cv::Mat> > {
147 static const std::string toString() { return "vector<Mat>"; }
148 };
149
150 template <>
151 struct TypeName<void> {
152 static const std::string toString() { return "No stored value"; }
153 };
154}
A container class for storing type agnostic variables.