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 <mia/core/defines.hh>
26 #include <string>
27 #include <vector>
28 
30 
32 
37 struct EXPORT_CORE timestep_type {
39  static const char *type_descr;
40 };
41 
50 template <typename T>
51 struct __type_descr {
52  static const char * const value;
53 };
54 
58 #define DECLARE_TYPE_DESCR(type) \
59  template <> \
60  struct EXPORT_CORE __type_descr<type> { \
61  static const char * const value; \
62  }
63 
68 #define DEFINE_TYPE_DESCR(type) const char * const __type_descr<type>::value = #type;
69 
76 #define DEFINE_TYPE_DESCR2(type, name) const char * const __type_descr<type>::value = name;
77 
78 
80 
82 
83 DECLARE_TYPE_DESCR(int8_t);
84 DECLARE_TYPE_DESCR(uint8_t);
85 DECLARE_TYPE_DESCR(int16_t);
86 DECLARE_TYPE_DESCR(int32_t);
87 DECLARE_TYPE_DESCR(int64_t);
88 DECLARE_TYPE_DESCR(uint16_t);
89 DECLARE_TYPE_DESCR(uint32_t);
90 DECLARE_TYPE_DESCR(uint64_t);
91 DECLARE_TYPE_DESCR(float);
92 DECLARE_TYPE_DESCR(double);
93 DECLARE_TYPE_DESCR(bool);
94 DECLARE_TYPE_DESCR(std::string);
95 
96 
97 DECLARE_TYPE_DESCR(std::vector<int16_t>);
98 DECLARE_TYPE_DESCR(std::vector<int32_t>);
99 DECLARE_TYPE_DESCR(std::vector<int64_t>);
100 DECLARE_TYPE_DESCR(std::vector<uint32_t>);
101 DECLARE_TYPE_DESCR(std::vector<uint16_t>);
102 DECLARE_TYPE_DESCR(std::vector<uint64_t>);
103 DECLARE_TYPE_DESCR(std::vector<float>);
104 DECLARE_TYPE_DESCR(std::vector<double>);
105 DECLARE_TYPE_DESCR(std::vector<bool>);
106 DECLARE_TYPE_DESCR(std::vector<std::string>);
107 
109 
111 
112 #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