-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1169 from germasch/c_bindings
C bindings fixes / updates
- Loading branch information
Showing
14 changed files
with
206 additions
and
410 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
/* | ||
* Distributed under the OSI-approved Apache License, Version 2.0. See | ||
* accompanying file Copyright.txt for details. | ||
* | ||
* adios2_c_internal.h | ||
* | ||
* Created on: Feb 9, 2019 | ||
* Author: Kai Germaschewski <[email protected]> | ||
*/ | ||
|
||
#ifndef ADIOS2_BINDINGS_C_C_ADIOS2_C_INTERNAL_H_ | ||
#define ADIOS2_BINDINGS_C_C_ADIOS2_C_INTERNAL_H_ | ||
|
||
#include "adios2_c_types.h" | ||
|
||
namespace | ||
{ | ||
/** | ||
* MapAdios2Type | ||
* maps the C adios2_type enum to the actual C/C++ type, | ||
* except string, which needs to be handled separately | ||
*/ | ||
template <int adios2_type> | ||
struct MapAdios2Type; | ||
|
||
} // anonymous namespace | ||
|
||
#include "adios2_c_internal.inl" | ||
|
||
#define ADIOS2_FOREACH_C_TYPE_1ARG(MACRO) \ | ||
MACRO(adios2_type_int8_t) \ | ||
MACRO(adios2_type_int16_t) \ | ||
MACRO(adios2_type_int32_t) \ | ||
MACRO(adios2_type_int64_t) \ | ||
MACRO(adios2_type_uint8_t) \ | ||
MACRO(adios2_type_uint16_t) \ | ||
MACRO(adios2_type_uint32_t) \ | ||
MACRO(adios2_type_uint64_t) \ | ||
MACRO(adios2_type_float) \ | ||
MACRO(adios2_type_double) \ | ||
MACRO(adios2_type_float_complex) \ | ||
MACRO(adios2_type_double_complex) | ||
|
||
// calls MACRO for all adios2_type attribute types except for adios2_type_string | ||
#define ADIOS2_FOREACH_C_ATTRIBUTE_TYPE_1ARG(MACRO) \ | ||
MACRO(adios2_type_int8_t) \ | ||
MACRO(adios2_type_int16_t) \ | ||
MACRO(adios2_type_int32_t) \ | ||
MACRO(adios2_type_int64_t) \ | ||
MACRO(adios2_type_uint8_t) \ | ||
MACRO(adios2_type_uint16_t) \ | ||
MACRO(adios2_type_uint32_t) \ | ||
MACRO(adios2_type_uint64_t) \ | ||
MACRO(adios2_type_float) \ | ||
MACRO(adios2_type_double) | ||
|
||
#endif /* ADIOS2_BINDINGS_C_C_ADIOS2_C_INTERNAL_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
/* | ||
* Distributed under the OSI-approved Apache License, Version 2.0. See | ||
* accompanying file Copyright.txt for details. | ||
* | ||
* adios2_c_internal.inl | ||
* | ||
* Created on: Feb 9, 2019 | ||
* Author: Kai Germaschewski <[email protected]> | ||
*/ | ||
|
||
#ifndef ADIOS2_BINDINGS_C_C_ADIOS2_C_INTERNAL_INL_ | ||
#define ADIOS2_BINDINGS_C_C_ADIOS2_C_INTERNAL_INL_ | ||
#ifndef ADIOS2_BINDINGS_C_C_ADIOS2_C_INTERNAL_H_ | ||
#error "Inline file should only be included from its header, never on its own" | ||
#endif | ||
|
||
namespace | ||
{ | ||
|
||
// no default implementation, so only type below are | ||
// supported | ||
|
||
#define make_MapAdios2Type(adios2_type, T) \ | ||
template <> \ | ||
struct MapAdios2Type<adios2_type> \ | ||
{ \ | ||
using Type = T; \ | ||
}; | ||
/* clang-format off */ | ||
make_MapAdios2Type(adios2_type_int8_t, int8_t) | ||
make_MapAdios2Type(adios2_type_int16_t, int16_t) | ||
make_MapAdios2Type(adios2_type_int32_t, int32_t) | ||
make_MapAdios2Type(adios2_type_int64_t, int64_t) | ||
make_MapAdios2Type(adios2_type_uint8_t, uint8_t) | ||
make_MapAdios2Type(adios2_type_uint16_t, uint16_t) | ||
make_MapAdios2Type(adios2_type_uint32_t, uint32_t) | ||
make_MapAdios2Type(adios2_type_uint64_t, uint64_t) | ||
make_MapAdios2Type(adios2_type_float, float) | ||
make_MapAdios2Type(adios2_type_double, double) | ||
make_MapAdios2Type(adios2_type_float_complex, std::complex<float>) | ||
make_MapAdios2Type(adios2_type_double_complex, std::complex<double>) | ||
/* clang-format on */ | ||
#undef make_MapAdios2Type | ||
|
||
} // namespace | ||
|
||
#endif /* ADIOS2_BINDINGS_C_C_ADIOS2_C_INTERNAL_INL_ */ |
Oops, something went wrong.