MISR Toolkit  1.5.1
H5DataSet.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 COPYING file, which can be found at the root of the source code *
10  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
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 
18 namespace H5 {
19 
27 // Inheritance: multiple H5Object/AbstractDs -> H5Location -> IdComponent
28 class 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, const DataSpace& space) const;
38  //void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
39 
40  // Fills a selection in memory with zero
41  void fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& space) const;
42  //void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
43 
44  // Gets the creation property list of this dataset.
45  DSetCreatPropList getCreatePlist() const;
46 
47  // Returns the address of this dataset in the file.
48  haddr_t getOffset() const;
49 
50  // Gets the dataspace of this dataset.
51  virtual DataSpace getSpace() const;
52 
53  // Determines whether space has been allocated for a dataset.
54  void getSpaceStatus(H5D_space_status_t& status) const;
55 
56  // Returns the amount of storage size required for this dataset.
57  virtual hsize_t getStorageSize() const;
58 
59  // Returns the in memory size of this attribute's data.
60  virtual size_t getInMemDataSize() const;
61 
62  // Returns the number of bytes required to store VL data.
63  hsize_t getVlenBufSize(const DataType& type, const DataSpace& space) const;
64  //hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // removed from 1.8.18 and 1.10.1
65 
66  // Reclaims VL datatype memory buffers.
67  static void vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf);
68  static void vlenReclaim(void *buf, const DataType& type, const DataSpace& space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT);
69 
70  // Reads the data of this dataset and stores it in the provided buffer.
71  // The memory and file dataspaces and the transferring property list
72  // can be defaults.
73  void read(void* buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const;
74  void read(H5std_string& buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const;
75 
76  // Writes the buffered data to this dataset.
77  // The memory and file dataspaces and the transferring property list
78  // can be defaults.
79  void write(const void* buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const;
80  void write(const H5std_string& buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT) const;
81 
82  // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet
83  int iterateElems(void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL);
84 
86  virtual H5std_string fromClass () const { return("DataSet"); }
87 
88  // Throw DataSetIException.
89  virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
90 
91  // Creates a dataset by way of dereference.
92  DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
93  DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
94 
95  // Default constructor.
96  DataSet();
97 
98  // Copy constructor.
99  DataSet(const DataSet& original);
100 
101  // Creates a copy of an existing DataSet using its id.
102  DataSet(const hid_t existing_id);
103 
104  // Gets the dataset id.
105  virtual hid_t getId() const;
106 
107  // Destructor: properly terminates access to this dataset.
108  virtual ~DataSet();
109 
110  protected:
111 #ifndef DOXYGEN_SHOULD_SKIP_THIS
112  // Sets the dataset id.
113  virtual void p_setId(const hid_t new_id);
114 #endif // DOXYGEN_SHOULD_SKIP_THIS
115 
116  private:
117  hid_t id; // HDF5 dataset id
118 
119  // This function contains the common code that is used by
120  // getTypeClass and various API functions getXxxType
121  // defined in AbstractDs for generic datatype and specific
122  // sub-types
123  virtual hid_t p_get_type() const;
124 
125  // Reads variable or fixed len strings from this dataset.
126  void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const;
127  void p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const;
128 
129  // Friend function to set DataSet id. For library use only.
130  friend void f_DataSet_setId(DataSet* dset, hid_t new_id);
131 
132 }; // end of DataSet
133 } // namespace H5
134 
135 #endif // __H5DataSet_H
#define H5_DLLCPP
Definition: H5api_adpt.h:262
virtual H5std_string fromClass() const
Returns this class name.
Definition: H5DataSet.h:86
Class DataSpace inherits from IdComponent and provides wrappers for the HDF5's dataspaces.
Definition: H5DataSpace.h:25
Class Attribute operates on HDF5 attributes.
Definition: H5Attribute.h:29
Class DSetCreatPropList inherits from ObjCreatPropList and provides wrappers for the HDF5 dataset cre...
Definition: H5DcreatProp.h:28
Class DataType provides generic operations on HDF5 datatypes.
Definition: H5DataType.h:28
Class H5Object is a bridge between H5Location and DataSet, DataType, and Group.
Definition: H5Object.h:37
unsigned long long hsize_t
Definition: H5public.h:169
H5Location is an abstract base class, providing a collection of wrappers of the C functions that take...
Definition: H5Location.h:42
AbstractDs is an abstract base class, inherited by Attribute and DataSet.
Definition: H5AbstractDs.h:38
uint64_t haddr_t
Definition: H5public.h:182
Class DataSet operates on HDF5 datasets.
Definition: H5DataSet.h:28
Class DSetCreatPropList inherits from PropList and provides wrappers for the HDF5 dataset memory and ...
Definition: H5DxferProp.h:25
HDFFCLIBAPI intf intf * ref
H5D_space_status_t
Definition: H5Dpublic.h:75
#define H5std_string
Definition: H5Exception.h:25
static const DSetMemXferPropList & DEFAULT
Default dataset memory and transfer property list.
Definition: H5DxferProp.h:28
HDFFCLIBAPI intf * size
int hid_t
Definition: H5Ipublic.h:54
H5R_type_t
Definition: H5Rpublic.h:28
static const DataSpace & ALL
Default DataSpace objects.
Definition: H5DataSpace.h:28
hid_t id
Definition: H5DataSet.h:117
HDFFCLIBAPI intf intf intf * type
herr_t(* H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data)
Definition: H5Dpublic.h:110
HDFFCLIBAPI intf * buf

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:52