Attempt to solve the HDF5 auto typing long standing problem. Must be tested on several architecture

This commit is contained in:
Guilhem Lavaux 2016-11-03 08:10:15 +01:00
parent ecc20e9764
commit 22f2310f44

View File

@ -69,26 +69,36 @@ namespace CosmoTool {
}
};
//, typename boost::enable_if<boost::is_same<T, tl> >::type> \
//
#define HDF5_TYPE(tl, thdf5) \
template<typename T> struct get_hdf5_data_type<T, typename boost::enable_if<boost::is_same<T, tl> >::type> \
template<typename T> struct get_hdf5_data_type<T, typename boost::enable_if<boost::is_same<T,tl> >::type > \
{ static H5::DataType type() { return H5::PredType::thdf5; }; }
#define HDF5_SAFE_TYPE(tl, othertl, thdf5) \
template<typename T> struct get_hdf5_data_type<T, \
typename boost::enable_if< \
boost::integral_constant<bool, \
boost::is_same<T, tl>::value \
&& !boost::is_same<T,othertl>::value > \
>::type \
> \
{ static H5::DataType type() { return H5::PredType::thdf5; }; }
HDF5_SAFE_TYPE(long, int , NATIVE_LONG);
HDF5_SAFE_TYPE(unsigned long, unsigned int , NATIVE_ULONG);
HDF5_SAFE_TYPE(long long, long , NATIVE_LLONG);
HDF5_SAFE_TYPE(unsigned long long, unsigned long, NATIVE_ULLONG);
HDF5_TYPE(char , NATIVE_CHAR);
HDF5_TYPE(long long , NATIVE_LLONG);
HDF5_TYPE(unsigned long long, NATIVE_ULLONG);
HDF5_TYPE(int8_t , NATIVE_INT8);
HDF5_TYPE(uint8_t , NATIVE_UINT8);
HDF5_TYPE(int16_t , NATIVE_INT16);
HDF5_TYPE(uint16_t , NATIVE_UINT16);
HDF5_TYPE(int32_t , NATIVE_INT32);
HDF5_TYPE(uint32_t , NATIVE_UINT32);
HDF5_TYPE(int64_t , NATIVE_INT64);
HDF5_TYPE(uint64_t , NATIVE_UINT64);
HDF5_TYPE(unsigned char , NATIVE_UCHAR);
HDF5_TYPE(int , NATIVE_INT);
HDF5_TYPE(unsigned int , NATIVE_UINT);
HDF5_TYPE(float , NATIVE_FLOAT);
HDF5_TYPE(double , NATIVE_DOUBLE);
HDF5_TYPE(long double , NATIVE_LDOUBLE);
#undef HDF5_TYPE
#undef HDF5_SAFE_TYPE
// Extent generator
template<std::size_t r>