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 | // Class DataSet inherits from AbstractDs and provides accesses to a dataset. |
---|
18 | |
---|
19 | #ifndef _H5DataSet_H |
---|
20 | #define _H5DataSet_H |
---|
21 | |
---|
22 | #ifndef H5_NO_NAMESPACE |
---|
23 | namespace H5 { |
---|
24 | #endif |
---|
25 | |
---|
26 | class H5_DLLCPP DataSet : public H5Object, public AbstractDs { |
---|
27 | public: |
---|
28 | // Close this dataset. |
---|
29 | virtual void close(); |
---|
30 | |
---|
31 | // Extends the dataset with unlimited dimension. |
---|
32 | void extend( const hsize_t* size ) const; |
---|
33 | |
---|
34 | // Fills a selection in memory with a value |
---|
35 | void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space); |
---|
36 | // Fills a selection in memory with zero |
---|
37 | void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); |
---|
38 | |
---|
39 | // Gets the creation property list of this dataset. |
---|
40 | DSetCreatPropList getCreatePlist() const; |
---|
41 | |
---|
42 | // Returns the address of this dataset in the file. |
---|
43 | haddr_t getOffset() const; |
---|
44 | |
---|
45 | // Gets the dataspace of this dataset. |
---|
46 | virtual DataSpace getSpace() const; |
---|
47 | |
---|
48 | // Determines whether space has been allocated for a dataset. |
---|
49 | void getSpaceStatus(H5D_space_status_t& status) const; |
---|
50 | |
---|
51 | // Returns the amount of storage size required for this dataset. |
---|
52 | hsize_t getStorageSize() const; |
---|
53 | |
---|
54 | // Returns the number of bytes required to store VL data. |
---|
55 | hsize_t getVlenBufSize( DataType& type, DataSpace& space ) const; |
---|
56 | |
---|
57 | // Reclaims VL datatype memory buffers. |
---|
58 | static void vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf ); |
---|
59 | static void vlenReclaim(void *buf, const DataType& type, const DataSpace& space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT); |
---|
60 | |
---|
61 | // Reads the data of this dataset and stores it in the provided buffer. |
---|
62 | // The memory and file dataspaces and the transferring property list |
---|
63 | // can be defaults. |
---|
64 | 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; |
---|
65 | 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; |
---|
66 | |
---|
67 | // Writes the buffered data to this dataset. |
---|
68 | // The memory and file dataspaces and the transferring property list |
---|
69 | // can be defaults. |
---|
70 | 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; |
---|
71 | 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; |
---|
72 | |
---|
73 | // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet |
---|
74 | int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL ); |
---|
75 | |
---|
76 | #ifndef H5_NO_DEPRECATED_SYMBOLS |
---|
77 | // Retrieves the type of object that an object reference points to. |
---|
78 | H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; |
---|
79 | #endif /* H5_NO_DEPRECATED_SYMBOLS */ |
---|
80 | |
---|
81 | // Retrieves a dataspace with the region pointed to selected. |
---|
82 | DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; |
---|
83 | |
---|
84 | // Returns this class name |
---|
85 | virtual H5std_string fromClass () const { return("DataSet"); } |
---|
86 | |
---|
87 | // Creates a dataset by way of dereference. |
---|
88 | DataSet(H5Object& obj, void* ref); |
---|
89 | DataSet(H5File& file, void* ref); |
---|
90 | |
---|
91 | // Default constructor. |
---|
92 | DataSet(); |
---|
93 | |
---|
94 | // Copy constructor. |
---|
95 | DataSet( const DataSet& original ); |
---|
96 | |
---|
97 | // Creates a copy of an existing DataSet using its id. |
---|
98 | DataSet(const hid_t existing_id); |
---|
99 | |
---|
100 | // Gets the dataset id. |
---|
101 | virtual hid_t getId() const; |
---|
102 | virtual void setId(const hid_t new_id); |
---|
103 | |
---|
104 | // Destructor: properly terminates access to this dataset. |
---|
105 | virtual ~DataSet(); |
---|
106 | |
---|
107 | private: |
---|
108 | hid_t id; // HDF5 dataset id |
---|
109 | |
---|
110 | // This function contains the common code that is used by |
---|
111 | // getTypeClass and various API functions getXxxType |
---|
112 | // defined in AbstractDs for generic datatype and specific |
---|
113 | // sub-types |
---|
114 | virtual hid_t p_get_type() const; |
---|
115 | }; |
---|
116 | #ifndef H5_NO_NAMESPACE |
---|
117 | } |
---|
118 | #endif |
---|
119 | #endif |
---|