From 2164198f82497be494d09b5a81d767d800f8c921 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Fri, 13 Feb 2015 15:45:17 +0100 Subject: [PATCH] Support for static array in HDF5 --- src/hdf5_array.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/hdf5_array.hpp b/src/hdf5_array.hpp index abcdc79..a2ad596 100644 --- a/src/hdf5_array.hpp +++ b/src/hdf5_array.hpp @@ -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::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