My Project 1.10.8
H5DataSet.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 H5DataSet_H
16#define H5DataSet_H
17
18namespace H5 {
19
27// Inheritance: multiple H5Object/AbstractDs -> H5Location -> IdComponent
28class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
29 public:
30 // Close this dataset.
31 virtual void close();
32
33 // Extends the dataset with unlimited dimension.
34 void extend(const hsize_t *size) const;
35
36 // Fills a selection in memory with a value
37 void fillMemBuf(const void *fill, const DataType &fill_type, void *buf, const DataType &buf_type,
38 const DataSpace &space) const;
39 // void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace&
40 // space); // removed from 1.8.18 and 1.10.1
41
42 // Fills a selection in memory with zero
43 void fillMemBuf(void *buf, const DataType &buf_type, const DataSpace &space) const;
44 // void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
45
46 // Gets the creation property list of this dataset.
47 DSetCreatPropList getCreatePlist() const;
48
49 // Gets the access property list of this dataset.
50 DSetAccPropList getAccessPlist() const;
51
52 // Returns the address of this dataset in the file.
53 haddr_t getOffset() const;
54
55 // Gets the dataspace of this dataset.
56 virtual DataSpace getSpace() const;
57
58 // Determines whether space has been allocated for a dataset.
59 void getSpaceStatus(H5D_space_status_t &status) const;
60
61 // Returns the amount of storage size required for this dataset.
62 virtual hsize_t getStorageSize() const;
63
64 // Returns the in memory size of this attribute's data.
65 virtual size_t getInMemDataSize() const;
66
67 // Returns the number of bytes required to store VL data.
68 hsize_t getVlenBufSize(const DataType &type, const DataSpace &space) const;
69 // hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // removed from 1.8.18 and 1.10.1
70
71 // Reclaims VL datatype memory buffers.
72 static void vlenReclaim(const DataType &type, const DataSpace &space,
73 const DSetMemXferPropList &xfer_plist, void *buf);
74 static void vlenReclaim(void *buf, const DataType &type, const DataSpace &space = DataSpace::ALL,
76
77 // Reads the data of this dataset and stores it in the provided buffer.
78 // The memory and file dataspaces and the transferring property list
79 // can be defaults.
80 void read(void *buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL,
81 const DataSpace & file_space = DataSpace::ALL,
82 const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const;
83 void read(H5std_string &buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL,
84 const DataSpace & file_space = DataSpace::ALL,
85 const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const;
86
87 // Writes the buffered data to this dataset.
88 // The memory and file dataspaces and the transferring property list
89 // can be defaults.
90 void write(const void *buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL,
91 const DataSpace & file_space = DataSpace::ALL,
92 const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const;
93 void write(const H5std_string &buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL,
94 const DataSpace & file_space = DataSpace::ALL,
95 const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const;
96
97 // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet
98 int iterateElems(void *buf, const DataType &type, const DataSpace &space, H5D_operator_t op,
99 void *op_data = NULL);
100
102 virtual H5std_string
103 fromClass() const
104 {
105 return ("DataSet");
106 }
107
108 // Creates a dataset by way of dereference.
109 DataSet(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT,
110 const PropList &plist = PropList::DEFAULT);
111 DataSet(const Attribute &attr, const void *ref, H5R_type_t ref_type = H5R_OBJECT,
112 const PropList &plist = PropList::DEFAULT);
113
114 // Default constructor.
115 DataSet();
116
117 // Copy constructor - same as the original DataSet.
118 DataSet(const DataSet &original);
119
120 // Assignment operator
121 DataSet &operator=(const DataSet &original);
122
123 // Creates a copy of an existing DataSet using its id.
124 DataSet(const hid_t existing_id);
125
126 // Gets the dataset id.
127 virtual hid_t getId() const;
128
129 // Destructor: properly terminates access to this dataset.
130 virtual ~DataSet();
131
132 protected:
133#ifndef DOXYGEN_SHOULD_SKIP_THIS
134 // Sets the dataset id.
135 virtual void p_setId(const hid_t new_id);
136#endif // DOXYGEN_SHOULD_SKIP_THIS
137
138 private:
139 hid_t id; // HDF5 dataset id
140
141 // This function contains the common code that is used by
142 // getTypeClass and various API functions getXxxType
143 // defined in AbstractDs for generic datatype and specific
144 // sub-types
145 virtual hid_t p_get_type() const;
146
147 // Reads variable or fixed len strings from this dataset.
148 void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id,
149 const hid_t xfer_plist_id, H5std_string &strg) const;
150 void p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id,
151 const hid_t xfer_plist_id, H5std_string &strg) const;
152
153 // Friend function to set DataSet id. For library use only.
154 friend void f_DataSet_setId(DataSet *dset, hid_t new_id);
155
156}; // end of DataSet
157} // namespace H5
158
159#endif // H5DataSet_H
AbstractDs is an abstract base class, inherited by Attribute and DataSet.
Definition: H5AbstractDs.h:36
Class Attribute operates on HDF5 attributes.
Definition: H5Attribute.h:29
Class DSetAccPropList inherits from LinkAccPropList and provides wrappers for the HDF5 dataset access...
Definition: H5DaccProp.h:25
Class DSetCreatPropList inherits from ObjCreatPropList and provides wrappers for the HDF5 dataset cre...
Definition: H5DcreatProp.h:29
Class DSetCreatPropList inherits from PropList and provides wrappers for the HDF5 dataset memory and ...
Definition: H5DxferProp.h:25
static const DSetMemXferPropList & DEFAULT
Default dataset memory and transfer property list.
Definition: H5DxferProp.h:28
Class DataSet operates on HDF5 datasets.
Definition: H5DataSet.h:28
virtual H5std_string fromClass() const
Returns this class name.
Definition: H5DataSet.h:103
friend void f_DataSet_setId(DataSet *dset, hid_t new_id)
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 DataType provides generic operations on HDF5 datatypes.
Definition: H5DataType.h:28
H5Location is an abstract base class, added in version 1.8.12.
Definition: H5Location.h:31
Class H5Object is a bridge between H5Location and DataSet, DataType, and Group.
Definition: H5Object.h:65
Class PropList inherits from IdComponent and provides wrappers for the HDF5 generic property list.
Definition: H5PropList.h:25
static const PropList & DEFAULT
Default property list.
Definition: H5PropList.h:28
Definition: H5AbstractDs.cpp:34


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