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


The HDF Group Help Desk:
  Copyright by The HDF Group