HDF5 C++ API  1.8.12
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
H5DataSpace.h
Go to the documentation of this file.
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 #ifndef H5_NO_NAMESPACE
21 namespace H5 {
22 #endif
23 
25 class H5_DLLCPP DataSpace : public IdComponent {
26  public:
27  // Default DataSpace objects
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  // Assignment operator
37  DataSpace& operator=( const DataSpace& rhs );
38 
39  // Closes this dataspace.
40  virtual void close();
41 
42  // Makes copy of an existing dataspace.
43  void copy(const DataSpace& like_space);
44 
45  // Copies the extent of this dataspace.
46  void extentCopy( DataSpace& dest_space ) const;
47 
48  // Gets the bounding box containing the current selection.
49  void getSelectBounds( hsize_t* start, hsize_t* end ) const;
50 
51  // Gets the number of element points in the current selection.
52  hssize_t getSelectElemNpoints() const;
53 
54  // Retrieves the list of element points currently selected.
55  void getSelectElemPointlist( hsize_t startpoint, hsize_t numpoints, hsize_t *buf ) const;
56 
57  // Gets the list of hyperslab blocks currently selected.
58  void getSelectHyperBlocklist( hsize_t startblock, hsize_t numblocks, hsize_t *buf ) const;
59 
60  // Get number of hyperslab blocks.
61  hssize_t getSelectHyperNblocks() const;
62 
63  // Gets the number of elements in this dataspace selection.
64  hssize_t getSelectNpoints() const;
65 
66  // Retrieves dataspace dimension size and maximum size.
67  int getSimpleExtentDims( hsize_t *dims, hsize_t *maxdims = NULL ) const;
68 
69  // Gets the dimensionality of this dataspace.
70  int getSimpleExtentNdims() const;
71 
72  // Gets the number of elements in this dataspace.
73  // 12/05/00 - changed return type to hssize_t from hsize_t - C API
74  hssize_t getSimpleExtentNpoints() const;
75 
76  // Gets the current class of this dataspace.
77  H5S_class_t getSimpleExtentType() const;
78 
79  // Determines if this dataspace is a simple one.
80  bool isSimple() const;
81 
82  // Sets the offset of this simple dataspace.
83  void offsetSimple( const hssize_t* offset ) const;
84 
85  // Selects the entire dataspace.
86  void selectAll() const;
87 
88  // Selects array elements to be included in the selection for
89  // this dataspace.
90  void selectElements( H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const;
91 
92  // Selects a hyperslab region to add to the current selected region.
93  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;
94 
95  // Resets the selection region to include no elements.
96  void selectNone() const;
97 
98  // Verifies that the selection is within the extent of the dataspace.
99  bool selectValid() const;
100 
101  // Removes the extent from this dataspace.
102  void setExtentNone() const;
103 
104  // Sets or resets the size of this dataspace.
105  void setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL ) const;
106 
108  virtual H5std_string fromClass () const { return("DataSpace"); }
109 
110  // Creates a DataSpace object using an existing dataspace id.
111  DataSpace(const hid_t space_id);
112 
113  // Copy constructor: makes a copy of the original DataSpace object.
114  DataSpace(const DataSpace& original);
115 
116  // Gets the dataspace id.
117  virtual hid_t getId() const;
118 
119  // Destructor: properly terminates access to this dataspace.
120  virtual ~DataSpace();
121 
122  private:
123  hid_t id; // HDF5 dataspace id
124 
125  protected:
126 #ifndef DOXYGEN_SHOULD_SKIP_THIS
127  // Sets the dataspace id.
128  virtual void p_setId(const hid_t new_id);
129 #endif // DOXYGEN_SHOULD_SKIP_THIS
130 
131 };
132 #ifndef H5_NO_NAMESPACE
133 }
134 #endif
135 #endif // __H5DataSpace_H
Class DataSpace operates on HDF5 dataspaces.
Definition: H5DataSpace.h:25
virtual H5std_string fromClass() const
Returns this class name.
Definition: H5DataSpace.h:108
static const DataSpace ALL
Constant for default dataspace.
Definition: H5DataSpace.h:28
Class IdComponent provides wrappers of the C functions that operate on an HDF5 identifier.
Definition: H5IdComponent.h:34
#define H5std_string
Definition: H5Exception.h:29