echelon  0.8.0
dataspace.hpp
1 // Copyright (c) 2012-2014 Christopher Hinz
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #ifndef ECHELON_HDF5_PRECURSOR_DATASPACE_HPP
7 #define ECHELON_HDF5_PRECURSOR_DATASPACE_HPP
8 
9 #include <hdf5.h>
10 #include <vector>
11 
12 namespace echelon
13 {
14 namespace hdf5
15 {
16 namespace precursor
17 {
18 
19 constexpr auto unlimited = H5S_UNLIMITED;
20 
21 class hyperslab_block
22 {
23 public:
24  hyperslab_block(std::vector<hsize_t> start_, std::vector<hsize_t> opposite_);
25 
26  const std::vector<hsize_t>& start() const;
27  const std::vector<hsize_t>& dims() const;
28 
29 private:
30  std::vector<hsize_t> start_;
31  std::vector<hsize_t> dims_;
32 };
33 
34 class dataspace
35 {
36 public:
37  dataspace();
38  explicit dataspace(hid_t dataspace_id_);
39  explicit dataspace(const std::vector<hsize_t>& dims);
40  dataspace(const std::vector<hsize_t>& dims, const std::vector<hsize_t>& max_dims);
41  ~dataspace();
42 
43  dataspace(const dataspace& other);
44  dataspace(dataspace&& other);
45 
46  dataspace& operator=(const dataspace& other);
47  dataspace& operator=(dataspace&& other);
48 
49  hssize_t select_npoints() const;
50 
51  void select_elements(H5S_seloper_t op, std::size_t num_elements,
52  const std::vector<hsize_t>& coord);
53  void select_hyperslab(H5S_seloper_t op, const std::vector<hsize_t>& start,
54  const std::vector<hsize_t>& stride, const std::vector<hsize_t>& count,
55  const std::vector<hsize_t>& block);
56 
57  void select_hyperslab(H5S_seloper_t op, const std::vector<hsize_t>& start,
58  const std::vector<hsize_t>& stride, const std::vector<hsize_t>& count);
59 
60  void select_hyperslab(H5S_seloper_t op, const std::vector<hsize_t>& start,
61  const std::vector<hsize_t>& count);
62 
63  hssize_t get_select_hyperslab_nblocks() const;
64  std::vector<hyperslab_block> get_select_hyperslab_blocks() const;
65 
66  std::vector<hsize_t> get_simple_extent_dims() const;
67  std::size_t get_simple_extent_ndims() const;
68 
69  hid_t id() const;
70 
71 private:
72  hid_t dataspace_id_;
73 };
74 }
75 }
76 }
77 
78 #endif
echelon&#39;s core namespace
Definition: attribute.cpp:10