libSplash
ColTypeDimArray.hpp
1 
24 #ifndef COLTYPEDIMARRAY_H
25 #define COLTYPEDIMARRAY_H
26 
27 #include "splash/CollectionType.hpp"
28 #include "splash/Dimensions.hpp"
29 #include <string>
30 
31 namespace splash
32 {
34  {
35  public:
36 
38  {
39  const hsize_t dim[] = {DSP_DIM_MAX};
40  this->type = H5Tarray_create(H5T_NATIVE_HSIZE, 1, dim);
41  }
42 
44  {
45  H5Tclose(this->type);
46  }
47 
48  size_t getSize() const
49  {
50  return sizeof (hsize_t) * 3;
51  }
52 
53  static CollectionType* genType(hid_t datatype_id)
54  {
55  bool found = false;
56  H5T_class_t h5_class = H5Tget_class(datatype_id);
57  if(h5_class == H5T_ARRAY)
58  {
59  hid_t base = H5Tget_super(datatype_id);
60  if(H5Tequal(base, H5T_NATIVE_HSIZE) == 1)
61  {
62  if(H5Tget_array_ndims(datatype_id) == 1)
63  {
64  hsize_t adims_out[1];
65  H5Tget_array_dims(datatype_id, adims_out);
66  if(adims_out[0] == 3)
67  found = true;
68  }
69  }
70  H5Tclose(base);
71  }
72  if(found)
73  return new ColTypeDimArray;
74  else
75  return NULL;
76  }
77 
78  std::string toString() const
79  {
80  return "DimArray";
81  }
82  };
83 
84 }
85 
86 #endif /* COLTYPEDIMARRAY_H */
std::string toString() const