HDF5 C++ API  1.8.18
 All Classes Namespaces Functions Variables Typedefs Friends Pages
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 files COPYING and Copyright.html. COPYING can be found at the root *
10  * of the source code distribution tree; Copyright.html can be found at the *
11  * root level of an installed copy of the electronic HDF5 document set and *
12  * is linked from the top-level documents page. It can also be found at *
13  * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
14  * access to either file, you may request a copy from help@hdfgroup.org. *
15  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
16 
17 #ifndef __H5DataSpace_H
18 #define __H5DataSpace_H
19 
20 namespace H5 {
21 
23 class H5_DLLCPP DataSpace : public IdComponent {
24  public:
26  static const DataSpace& ALL;
27 
28  // Creates a dataspace object given the space type
29  DataSpace(H5S_class_t type = H5S_SCALAR);
30 
31  // Creates a simple dataspace
32  DataSpace(int rank, const hsize_t * dims, const hsize_t * maxdims = NULL);
33 
34  // Creates a DataSpace object using an existing dataspace id.
35  DataSpace(const hid_t space_id);
36 
37  // Copy constructor: makes a copy of the original DataSpace object.
38  DataSpace(const DataSpace& original);
39 
40  // Assignment operator
41  DataSpace& operator=( const DataSpace& rhs );
42 
43  // Closes this dataspace.
44  virtual void close();
45 
46  // Makes copy of an existing dataspace.
47  void copy(const DataSpace& like_space);
48 
49  // Copies the extent of this dataspace.
50  void extentCopy(const DataSpace& dest_space) const;
51  // removed from 1.8.18 and 1.10.1
52  //void extentCopy(DataSpace& dest_space) const;
53 
54  // Gets the bounding box containing the current selection.
55  void getSelectBounds( hsize_t* start, hsize_t* end ) const;
56 
57  // Gets the number of element points in the current selection.
58  hssize_t getSelectElemNpoints() const;
59 
60  // Retrieves the list of element points currently selected.
61  void getSelectElemPointlist( hsize_t startpoint, hsize_t numpoints, hsize_t *buf ) const;
62 
63  // Gets the list of hyperslab blocks currently selected.
64  void getSelectHyperBlocklist( hsize_t startblock, hsize_t numblocks, hsize_t *buf ) const;
65 
66  // Get number of hyperslab blocks.
67  hssize_t getSelectHyperNblocks() const;
68 
69  // Gets the number of elements in this dataspace selection.
70  hssize_t getSelectNpoints() const;
71 
72  // Retrieves dataspace dimension size and maximum size.
73  int getSimpleExtentDims( hsize_t *dims, hsize_t *maxdims = NULL ) const;
74 
75  // Gets the dimensionality of this dataspace.
76  int getSimpleExtentNdims() const;
77 
78  // Gets the number of elements in this dataspace.
79  // 12/05/00 - changed return type to hssize_t from hsize_t - C API
80  hssize_t getSimpleExtentNpoints() const;
81 
82  // Gets the current class of this dataspace.
83  H5S_class_t getSimpleExtentType() const;
84 
85  // Determines if this dataspace is a simple one.
86  bool isSimple() const;
87 
88  // Sets the offset of this simple dataspace.
89  void offsetSimple( const hssize_t* offset ) const;
90 
91  // Selects the entire dataspace.
92  void selectAll() const;
93 
94  // Selects array elements to be included in the selection for
95  // this dataspace.
96  void selectElements( H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const;
97 
98  // Selects a hyperslab region to add to the current selected region.
99  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;
100 
101  // Resets the selection region to include no elements.
102  void selectNone() const;
103 
104  // Verifies that the selection is within the extent of the dataspace.
105  bool selectValid() const;
106 
107  // Removes the extent from this dataspace.
108  void setExtentNone() const;
109 
110  // Sets or resets the size of this dataspace.
111  void setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL ) const;
112 
114  virtual H5std_string fromClass () const { return("DataSpace"); }
115 
116  // Gets the dataspace id.
117  virtual hid_t getId() const;
118 
119  // Deletes the global constant
120  static void deleteConstants();
121 
122  // Destructor: properly terminates access to this dataspace.
123  virtual ~DataSpace();
124 
125 #ifndef DOXYGEN_SHOULD_SKIP_THIS
126 
127  protected:
128  // Sets the dataspace id.
129  virtual void p_setId(const hid_t new_id);
130 
131 #endif // DOXYGEN_SHOULD_SKIP_THIS
132 
133  private:
134  hid_t id; // HDF5 dataspace id
135 
136 #ifndef DOXYGEN_SHOULD_SKIP_THIS
137 
138  static DataSpace* ALL_;
139 
140  // Creates the global constant
141  static DataSpace* getConstant();
142 
143  // Friend function to set DataSpace id. For library use only.
144  friend void f_DataSpace_setId(DataSpace *dspace, hid_t new_id);
145 
146 #endif // DOXYGEN_SHOULD_SKIP_THIS
147 };
148 }
149 #endif // __H5DataSpace_H
Class IdComponent provides wrappers of the C functions that operate on an HDF5 identifier.
Definition: H5IdComponent.h:32
Class DataSpace operates on HDF5 dataspaces.
Definition: H5DataSpace.h:23
virtual H5std_string fromClass() const
Returns this class name.
Definition: H5DataSpace.h:114
static const DataSpace & ALL
Default DataSpace objects.
Definition: H5DataSpace.h:26
void f_DataSpace_setId(DataSpace *dspace, hid_t new_id)
Definition: H5Location.cpp:955


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