-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypeHelper.h
58 lines (40 loc) · 1.05 KB
/
typeHelper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#ifndef TYPEHELPER_H_INCLUDED
#define TYPEHELPER_H_INCLUDED
#include <typeinfo>
#include <string>
#include <stdexcept>
#include <exception>
#include <iostream>
#include <cstdint>
namespace MW {
// These are the original header files from the MathWorks.
#include "mat.h"
#include "matrix.h"
};
template<typename T>
MW::mxClassID typeHelper() {
throw(std::logic_error("Unknown class of type" + std::string(typeid(T).name())));
return (MW::mxUNKNOWN_CLASS); //Obviously can't reach this...
}
template <>
MW::mxClassID typeHelper<std::uint8_t>();
template <>
MW::mxClassID typeHelper<std::int8_t>();
template <>
MW::mxClassID typeHelper<std::uint16_t>();
template <>
MW::mxClassID typeHelper<std::int16_t>();
template <>
MW::mxClassID typeHelper<std::uint32_t>();
template <>
MW::mxClassID typeHelper<std::int32_t>();
template <>
MW::mxClassID typeHelper<std::uint64_t>();
template <>
MW::mxClassID typeHelper<std::int64_t>();
template <>
MW::mxClassID typeHelper<float>();
template <>
MW::mxClassID typeHelper<double>();
#endif