My Project
typedescr.hh
Go to the documentation of this file.
1/* -*- mia-c++ -*-
2 *
3 * This file is part of MIA - a toolbox for medical image analysis
4 * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
5 *
6 * MIA is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with MIA; if not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#ifndef mia_core_typedescr_hh
22#define mia_core_typedescr_hh
23
24
25#include <cstdint>
26#include <mia/core/defines.hh>
27#include <string>
28#include <vector>
29
31
33
38struct EXPORT_CORE timestep_type {
40 static const char *type_descr;
41};
42
51template <typename T>
52struct __type_descr {
53 static const char *const value;
54};
55
59#define DECLARE_TYPE_DESCR(type) \
60 template <> \
61 struct EXPORT_CORE __type_descr<type> { \
62 static const char * const value; \
63 }
69#define DEFINE_TYPE_DESCR(type) const char * const __type_descr<type>::value = #type;
70
77#define DEFINE_TYPE_DESCR2(type, name) const char * const __type_descr<type>::value = name;
78
79
81
83
84DECLARE_TYPE_DESCR(int8_t);
85DECLARE_TYPE_DESCR(uint8_t);
86DECLARE_TYPE_DESCR(int16_t);
87DECLARE_TYPE_DESCR(int32_t);
88DECLARE_TYPE_DESCR(int64_t);
89DECLARE_TYPE_DESCR(uint16_t);
90DECLARE_TYPE_DESCR(uint32_t);
91DECLARE_TYPE_DESCR(uint64_t);
92DECLARE_TYPE_DESCR(float);
93DECLARE_TYPE_DESCR(double);
94DECLARE_TYPE_DESCR(bool);
95DECLARE_TYPE_DESCR(std::string);
96
97
98DECLARE_TYPE_DESCR(std::vector<int16_t>);
99DECLARE_TYPE_DESCR(std::vector<int32_t>);
100DECLARE_TYPE_DESCR(std::vector<int64_t>);
101DECLARE_TYPE_DESCR(std::vector<uint32_t>);
102DECLARE_TYPE_DESCR(std::vector<uint16_t>);
103DECLARE_TYPE_DESCR(std::vector<uint64_t>);
104DECLARE_TYPE_DESCR(std::vector<float>);
105DECLARE_TYPE_DESCR(std::vector<double>);
106DECLARE_TYPE_DESCR(std::vector<bool>);
107DECLARE_TYPE_DESCR(std::vector<std::string>);
108
110
112
113#endif
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition defines.hh:33
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition defines.hh:101
#define NS_MIA_END
conveniance define to end the mia namespace
Definition defines.hh:36