Newer
Older
Atkins, Charles Vernon
committed
/*
* Distributed under the OSI-approved Apache License, Version 2.0. See
* accompanying file Copyright.txt for details.
*
* ADIOSMacros.h
* This contains a set of helper macros used internally
*/
#ifndef ADIOS2_ADIOSMACROS_H
#define ADIOS2_ADIOSMACROS_H
Atkins, Charles Vernon
committed
Atkins, Charles Vernon
committed
// The ADIOS_FOREACH_TYPE_1ARG macro assumes the given argument is a macro which
// takes a single argument that is a type and then inserts the given MACRO for
// each of the known primitive types
//
// An example of this might be to instantiate a template function for each
// known type. For example:
//
// template<typename T> int foo() { /* some implementation of foo */ }
//
// #define instantiate_foo(T) template int foo<T>();
// ADIOS_FOREACH_TYPE_1ARG(instantiate_foo)
// #undef instantiate_foo
//
#define ADIOS2_FOREACH_TYPE_1ARG(MACRO) \
Atkins, Charles Vernon
committed
MACRO(char) \
Atkins, Charles Vernon
committed
MACRO(unsigned char) \
MACRO(short) \
MACRO(unsigned short) \
MACRO(int) \
MACRO(unsigned int) \
MACRO(long int) \
MACRO(long long int) \
Atkins, Charles Vernon
committed
MACRO(unsigned long long int) \
MACRO(float) \
MACRO(double) \
MACRO(long double) \
MACRO(std::complex<float>) \
MACRO(std::complex<double>) \
MACRO(std::complex<long double>)
#define ADIOS2_FOREACH_PRIMITIVE_TYPE_1ARG(MACRO) \
MACRO(char) \
MACRO(unsigned char) \
MACRO(short) \
MACRO(unsigned short) \
MACRO(int) \
MACRO(unsigned int) \
MACRO(long int) \
MACRO(unsigned long int) \
MACRO(long long int) \
MACRO(unsigned long long int) \
MACRO(float) \
#define ADIOS2_FOREACH_COMPLEX_TYPE_1ARG(MACRO) \
MACRO(float) \
#define ADIOS2_FOREACH_ZFP_TYPE_1ARG(MACRO) \
MACRO(int32_t) \
MACRO(int64_t) \
MACRO(float) \
MACRO(double)
#define ADIOS2_FOREACH_ATTRIBUTE_TYPE_1ARG(MACRO) \
MACRO(std::string) \
MACRO(char) \
MACRO(unsigned char) \
MACRO(short) \
MACRO(unsigned short) \
MACRO(int) \
MACRO(unsigned int) \
MACRO(long int) \
MACRO(unsigned long int) \
MACRO(long long int) \
MACRO(unsigned long long int) \
MACRO(float) \
MACRO(double) \
MACRO(long double)
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// The ADIOS_FOREACH_TYPE_2ARGS macro assumes the given argument is a macro
// which takes two arguments, the first being a type, and the second being a
// label for that type, i.e. std::complex<float> and CFloat.
//
// An example of this might be to define a virtual method for each known
// type, and since the method is virtual then it cannot be a template.
// For example:
//
// #define declare_foo(T,L) virtual const T& foo ## L (std::string bar);
// ADIOS_FOREACH_TYPE_2ARGS(declare_foo)
// #undef declare_foo
//
// is equivalent to:
//
// virtual char& foo_Char(std::string bar);
// virtual unsigned char& foo_UChar(std::string bar);
// virtual short& foo_Short(std::string bar);
// virtual unsigned short& foo_UShort(std::string bar);
// ...
// virtual std::complex<long double>& foo_CLDouble(std::string bar);
//
#define ADIOS2_FOREACH_TYPE_2ARGS(MACRO) \
MACRO(char, Char) \
MACRO(unsigned char, UChar) \
MACRO(short, Short) \
MACRO(unsigned short, UShort) \
MACRO(int, Int) \
MACRO(unsigned int, UInt) \
MACRO(long int, LInt) \
MACRO(long long int, LLInt) \
MACRO(unsigned long int, ULInt) \
MACRO(unsigned long long int, ULLInt) \
MACRO(float, Float) \
MACRO(double, Double) \
MACRO(long double, LDouble) \
MACRO(std::complex<float>, CFloat) \
MACRO(std::complex<double>, CDouble) \
MACRO(std::complex<long double>, CLDouble)
#define ADIOS2_FOREACH_PRIMITIVE_TYPE_2ARGS(MACRO) \
MACRO(char, Char) \
MACRO(unsigned char, UChar) \
MACRO(short, Short) \
MACRO(unsigned short, UShort) \
MACRO(int, Int) \
MACRO(unsigned int, UInt) \
MACRO(long int, LInt) \
MACRO(long long int, LLInt) \
MACRO(unsigned long int, ULInt) \
MACRO(unsigned long long int, ULLInt) \
MACRO(float, Float) \
MACRO(double, Double)
#define ADIOS2_FOREACH_COMPLEX_TYPE_2ARGS(MACRO) \
MACRO(std::complex<float>, CFloat) \
MACRO(std::complex<double>, CDouble)
#endif /* ADIOS2_ADIOSMACROS_H */