openPMD-api
 
Loading...
Searching...
No Matches
DatatypeMacros.hpp
1/* Copyright 2023 Franz Poeschel
2 *
3 * This file is part of openPMD-api.
4 *
5 * openPMD-api is free software: you can redistribute it and/or modify
6 * it under the terms of of either the GNU General Public License or
7 * the GNU Lesser 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 * openPMD-api 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 and the GNU Lesser General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * and the GNU Lesser General Public License along with openPMD-api.
19 * If not, see <http://www.gnu.org/licenses/>.
20 */
21
22// sic!
23// no #pragma once
24// Since the macros can be un-defined with UndefDatatypeMacros.hpp, this header
25// may be included multiple times into one translation unit
26
27#include <array>
28#include <complex>
29#include <vector>
30
31// Need to alias this to avoid the comma
32// Cannot use a namespace, otherwise the macro will work either only within
33// or outside the namespace
34// Defining macros means polluting the global namespace anyway
35using openpmd_array_double_7 = std::array<double, 7>;
36
37#define OPENPMD_FOREACH_DATATYPE(MACRO) \
38 MACRO(char) \
39 MACRO(unsigned char) \
40 MACRO(signed char) \
41 MACRO(short) \
42 MACRO(int) \
43 MACRO(long) \
44 MACRO(long long) \
45 MACRO(unsigned short) \
46 MACRO(unsigned int) \
47 MACRO(unsigned long) \
48 MACRO(unsigned long long) \
49 MACRO(float) \
50 MACRO(double) \
51 MACRO(long double) \
52 MACRO(std::complex<float>) \
53 MACRO(std::complex<double>) \
54 MACRO(std::complex<long double>) \
55 MACRO(std::string) \
56 MACRO(std::vector<char>) \
57 MACRO(std::vector<short>) \
58 MACRO(std::vector<int>) \
59 MACRO(std::vector<long>) \
60 MACRO(std::vector<long long>) \
61 MACRO(std::vector<unsigned char>) \
62 MACRO(std::vector<unsigned short>) \
63 MACRO(std::vector<unsigned int>) \
64 MACRO(std::vector<unsigned long>) \
65 MACRO(std::vector<unsigned long long>) \
66 MACRO(std::vector<float>) \
67 MACRO(std::vector<double>) \
68 MACRO(std::vector<long double>) \
69 MACRO(std::vector<std::complex<float>>) \
70 MACRO(std::vector<std::complex<double>>) \
71 MACRO(std::vector<std::complex<long double>>) \
72 MACRO(std::vector<signed char>) \
73 MACRO(std::vector<std::string>) \
74 MACRO(openpmd_array_double_7) \
75 MACRO(bool)
76
77#define OPENPMD_FOREACH_NONVECTOR_DATATYPE(MACRO) \
78 MACRO(char) \
79 MACRO(unsigned char) \
80 MACRO(signed char) \
81 MACRO(short) \
82 MACRO(int) \
83 MACRO(long) \
84 MACRO(long long) \
85 MACRO(unsigned short) \
86 MACRO(unsigned int) \
87 MACRO(unsigned long) \
88 MACRO(unsigned long long) \
89 MACRO(float) \
90 MACRO(double) \
91 MACRO(long double) \
92 MACRO(std::complex<float>) \
93 MACRO(std::complex<double>) \
94 MACRO(std::complex<long double>) \
95 MACRO(std::string) \
96 MACRO(bool)
97
98#define OPENPMD_FOREACH_VECTOR_DATATYPE(MACRO) \
99 MACRO(std::vector<char>) \
100 MACRO(std::vector<short>) \
101 MACRO(std::vector<int>) \
102 MACRO(std::vector<long>) \
103 MACRO(std::vector<long long>) \
104 MACRO(std::vector<unsigned char>) \
105 MACRO(std::vector<unsigned short>) \
106 MACRO(std::vector<unsigned int>) \
107 MACRO(std::vector<unsigned long>) \
108 MACRO(std::vector<unsigned long long>) \
109 MACRO(std::vector<float>) \
110 MACRO(std::vector<double>) \
111 MACRO(std::vector<long double>) \
112 MACRO(std::vector<std::complex<float>>) \
113 MACRO(std::vector<std::complex<double>>) \
114 MACRO(std::vector<std::complex<long double>>) \
115 MACRO(std::vector<signed char>) \
116 MACRO(std::vector<std::string>) \
117 MACRO(openpmd_array_double_7)
118
119#define OPENPMD_FOREACH_DATASET_DATATYPE(MACRO) \
120 MACRO(char) \
121 MACRO(unsigned char) \
122 MACRO(signed char) \
123 MACRO(short) \
124 MACRO(int) \
125 MACRO(long) \
126 MACRO(long long) \
127 MACRO(unsigned short) \
128 MACRO(unsigned int) \
129 MACRO(unsigned long) \
130 MACRO(unsigned long long) \
131 MACRO(float) \
132 MACRO(double) \
133 MACRO(long double) \
134 MACRO(std::complex<float>) \
135 MACRO(std::complex<double>) \
136 MACRO(std::complex<long double>)