libSplash
DCDataSet.hpp
1 
23 #ifndef DCDATASET_HPP
24 #define DCDATASET_HPP
25 
26 #include <stdint.h>
27 #include <string>
28 #include <hdf5.h>
29 
30 #include "splash/DCException.hpp"
31 #include "splash/Dimensions.hpp"
32 #include "splash/Selection.hpp"
33 #include "splash/CollectionType.hpp"
34 #include "splash/basetypes/ColTypeDim.hpp"
35 
36 namespace splash
37 {
42  {
43  DCDT_UNKNOWN,
44  DCDT_FLOAT32,
45  DCDT_FLOAT64,
46  DCDT_INT32,
47  DCDT_INT64,
48  DCDT_UINT32,
49  DCDT_UINT64
50  };
51 
55  class DCDataSet
56  {
57  public:
63  DCDataSet(const std::string name);
64 
68  virtual ~DCDataSet();
69 
76  bool open(hid_t group) throw (DCException);
77 
81  void close() throw (DCException);
82 
93  void create(const CollectionType& colType, hid_t group, const Dimensions size,
94  uint32_t ndims, bool compression, bool extensible) throw (DCException);
95 
102  void createReference(hid_t refGroup, hid_t srcGroup, DCDataSet &srcDataSet)
103  throw (DCException);
104 
114  void createReference(hid_t refGroup, hid_t srcGroup, DCDataSet &srcDataSet,
115  Dimensions count,
116  Dimensions offset,
117  Dimensions stride) throw (DCException);
118 
126  void write(Selection srcSelect, Dimensions dstOffset, const void* data) throw (DCException);
127 
137  void read(Dimensions dstBuffer,
138  Dimensions dstOffset,
139  Dimensions &sizeRead,
140  uint32_t& srcNDims,
141  void* dst) throw (DCException);
142 
154  void read(Dimensions dstBuffer,
155  Dimensions dstOffset,
156  Dimensions srcSize,
157  Dimensions srcOffset,
158  Dimensions& sizeRead,
159  uint32_t& srcNDims,
160  void* dst) throw (DCException);
161 
172  void append(size_t count,
173  size_t offset,
174  size_t stride,
175  const void* data) throw (DCException);
176 
182  size_t getNDims();
183 
191  hid_t getDataSpace() throw (DCException);
192 
198  Dimensions getSize() const;
199 
207  DCDataType getDCDataType() throw (DCException);
208 
209 
214  size_t getDataTypeSize() throw (DCException);
215 
221  std::string getName();
222 
223  static void splitPath(const std::string fullName, std::string &path, std::string &name);
224 
225  static void getFullDataPath(const std::string fullUserName, const std::string pathBase,
226  uint32_t id, std::string &path, std::string &name);
227 
228  protected:
229  void setChunking(size_t typeSize) throw (DCException);
230  void setCompression() throw (DCException);
231 
232  Dimensions& getLogicalSize();
233  Dimensions getPhysicalSize();
234 
235  hid_t dataset;
236  hid_t datatype;
237  hid_t dataspace;
238  hdset_reg_ref_t regionRef;
239  Dimensions logicalSize;
240  size_t ndims;
241  std::string name;
242  bool opened;
243  bool isReference;
244  bool checkExistence;
245 
246  // property lists
247  hid_t dsetProperties;
248  hid_t dsetWriteProperties;
249  hid_t dsetReadProperties;
250 
251  bool compression;
252  private:
253  std::string getExceptionString(std::string msg);
254 
255  ColTypeDim dimType;
256  };
261 }
262 
263 #endif /* DCDATASET_HPP */