Support for static array in HDF5

This commit is contained in:
Guilhem Lavaux 2015-02-13 15:45:17 +01:00
parent 5395097fa7
commit 2164198f82

View File

@ -238,6 +238,31 @@ namespace CosmoTool { \
}; \
};
#define CTOOL_ARRAY_TYPE(ARRAY_TYPE, DIM, TNAME) \
namespace CosmoTool { \
class TNAME { \
public: \
H5::ArrayType *type; \
\
TNAME() \
{ \
hsize_t dims[1] = { DIM }; \
type = new H5::ArrayType(get_hdf5_data_type<ARRAY_TYPE>::type(), 1, dims); \
} \
~TNAME() { delete type; } \
\
static const TNAME *ctype() \
{ \
static TNAME singleton; \
return &singleton; \
} \
}; \
\
template<> struct get_hdf5_data_type< ARRAY_TYPE[DIM] > { \
static H5::DataType type() { return *(TNAME::ctype()->type); }; \
}; \
};
};
#endif