24 #ifndef BASETYPES_ARRAY_HPP 25 #define BASETYPES_ARRAY_HPP 30 #include "splash/CollectionType.hpp" 35 #define TYPE_ARRAY(_name, _h5_type, _real_type, _size) \ 36 class ColType##_name##Array : public CollectionType \ 40 ColType##_name##Array() \ 42 const hsize_t dim[] = {_size}; \ 43 this->type = H5Tarray_create(_h5_type, 1, dim); \ 46 ~ColType##_name##Array() \ 47 { H5Tclose(this->type); } \ 49 size_t getSize() const \ 50 { return sizeof (_real_type) * _size; } \ 52 static CollectionType* genType(hid_t datatype_id) \ 55 H5T_class_t h5_class = H5Tget_class(datatype_id); \ 56 if(h5_class == H5T_ARRAY) \ 58 hid_t base = H5Tget_super(datatype_id); \ 59 if(H5Tequal(base, _h5_type) == 1) \ 61 if(H5Tget_array_ndims(datatype_id) == 1) \ 63 hsize_t adims_out[1]; \ 64 H5Tget_array_dims(datatype_id, adims_out); \ 65 if(adims_out[0] == _size) \ 72 return new ColType##_name##Array; \ 77 std::string toString() const \ 79 return #_name"Array"; \ 83 TYPE_ARRAY(Float2, H5T_NATIVE_FLOAT,
float, 2);
84 TYPE_ARRAY(Float3, H5T_NATIVE_FLOAT,
float, 3);
85 TYPE_ARRAY(Float4, H5T_NATIVE_FLOAT,
float, 4);
87 TYPE_ARRAY(Double2, H5T_NATIVE_DOUBLE,
double, 2);
88 TYPE_ARRAY(Double3, H5T_NATIVE_DOUBLE,
double, 3);
89 TYPE_ARRAY(Double4, H5T_NATIVE_DOUBLE,
double, 4);
91 TYPE_ARRAY(Int2, H5T_NATIVE_INT,
int, 2);
92 TYPE_ARRAY(Int3, H5T_NATIVE_INT,
int, 3);
93 TYPE_ARRAY(Int4, H5T_NATIVE_INT,
int, 4);