My Project  1.12.2
H5DataSpace.h
1 // C++ informative line for the emacs editor: -*- C++ -*-
2 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3  * Copyright by The HDF Group. *
4  * Copyright by the Board of Trustees of the University of Illinois. *
5  * All rights reserved. *
6  * *
7  * This file is part of HDF5. The full HDF5 copyright notice, including *
8  * terms governing use, modification, and redistribution, is contained in *
9  * the COPYING file, which can be found at the root of the source code *
10  * distribution tree, or in https://www.hdfgroup.org/licenses. *
11  * If you do not have access to either file, you may request a copy from *
12  * help@hdfgroup.org. *
13  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
14 
15 #ifndef H5DataSpace_H
16 #define H5DataSpace_H
17 
18 namespace H5 {
19 
24 // Inheritance: IdComponent
25 class H5_DLLCPP DataSpace : public IdComponent {
26  public:
28  static const DataSpace &ALL;
29 
30  // Creates a dataspace object given the space type
31  DataSpace(H5S_class_t type = H5S_SCALAR);
32 
33  // Creates a simple dataspace
34  DataSpace(int rank, const hsize_t *dims, const hsize_t *maxdims = NULL);
35 
36  // Creates a DataSpace object using an existing dataspace id.
37  DataSpace(const hid_t space_id);
38 
39  // Copy constructor - same as the original DataSpace.
40  DataSpace(const DataSpace &original);
41 
42  // Assignment operator
43  DataSpace &operator=(const DataSpace &rhs);
44 
45  // Closes this dataspace.
46  virtual void close() H5_OVERRIDE;
47 
48  // Makes copy of an existing dataspace.
49  void copy(const DataSpace &like_space);
50 
51  // Copies the extent of this dataspace.
52  void extentCopy(const DataSpace &dest_space) const;
53  // removed from 1.8.18 and 1.10.1
54  // void extentCopy(DataSpace& dest_space) const;
55 
56  // Gets the bounding box containing the current selection.
57  void getSelectBounds(hsize_t *start, hsize_t *end) const;
58 
59  // Gets the number of element points in the current selection.
60  hssize_t getSelectElemNpoints() const;
61 
62  // Retrieves the list of element points currently selected.
63  void getSelectElemPointlist(hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const;
64 
65  // Gets the list of hyperslab blocks currently selected.
66  void getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const;
67 
68  // Get number of hyperslab blocks.
69  hssize_t getSelectHyperNblocks() const;
70 
71  // Gets the number of elements in this dataspace selection.
72  hssize_t getSelectNpoints() const;
73 
74  // Retrieves dataspace dimension size and maximum size.
75  int getSimpleExtentDims(hsize_t *dims, hsize_t *maxdims = NULL) const;
76 
77  // Gets the dimensionality of this dataspace.
78  int getSimpleExtentNdims() const;
79 
80  // Gets the number of elements in this dataspace.
81  // 12/05/00 - changed return type to hssize_t from hsize_t - C API
82  hssize_t getSimpleExtentNpoints() const;
83 
84  // Gets the current class of this dataspace.
85  H5S_class_t getSimpleExtentType() const;
86 
87  // Determines if this dataspace is a simple one.
88  bool isSimple() const;
89 
90  // Sets the offset of this simple dataspace.
91  void offsetSimple(const hssize_t *offset) const;
92 
93  // Selects the entire dataspace.
94  void selectAll() const;
95 
96  // Selects array elements to be included in the selection for
97  // this dataspace.
98  void selectElements(H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const;
99 
100  // Selects a hyperslab region to add to the current selected region.
101  void selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start,
102  const hsize_t *stride = NULL, const hsize_t *block = NULL) const;
103 
104  // Resets the selection region to include no elements.
105  void selectNone() const;
106 
107  // Verifies that the selection is within the extent of the dataspace.
108  bool selectValid() const;
109 
110  // Removes the extent from this dataspace.
111  void setExtentNone() const;
112 
113  // Sets or resets the size of this dataspace.
114  void setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL) const;
115 
117  virtual H5std_string
118  fromClass() const H5_OVERRIDE
119  {
120  return ("DataSpace");
121  }
122 
123  // Gets the dataspace id.
124  virtual hid_t getId() const H5_OVERRIDE;
125 
126  // Deletes the global constant
127  static void deleteConstants();
128 
129  // Destructor: properly terminates access to this dataspace.
130  virtual ~DataSpace() H5_OVERRIDE;
131 
132 #ifndef DOXYGEN_SHOULD_SKIP_THIS
133 
134  protected:
135  // Sets the dataspace id.
136  virtual void p_setId(const hid_t new_id) H5_OVERRIDE;
137 
138 #endif // DOXYGEN_SHOULD_SKIP_THIS
139 
140  private:
141  hid_t id; // HDF5 dataspace id
142 
143 #ifndef DOXYGEN_SHOULD_SKIP_THIS
144 
145  static DataSpace *ALL_;
146 
147  // Creates the global constant
148  static DataSpace *getConstant();
149 
150  // Friend function to set DataSpace id. For library use only.
151  friend void f_DataSpace_setId(DataSpace *dspace, hid_t new_id);
152 
153 #endif // DOXYGEN_SHOULD_SKIP_THIS
154 
155 }; // end of DataSpace
156 } // namespace H5
157 
158 #endif // H5DataSpace_H
Class DataSpace inherits from IdComponent and provides wrappers for the HDF5's dataspaces.
Definition: H5DataSpace.h:25
static const DataSpace & ALL
Default DataSpace objects.
Definition: H5DataSpace.h:28
Class IdComponent provides wrappers of the C functions that operate on an HDF5 identifier.
Definition: H5IdComponent.h:27
Definition: H5AbstractDs.cpp:34
void f_DataSpace_setId(DataSpace *dspace, hid_t new_id)
Definition: H5Location.cpp:2429


The HDF Group Help Desk:
  Copyright by The HDF Group
and the Board of Trustees of the University of Illinois