summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2002-05-16 14:03:53 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2002-05-16 14:03:53 (GMT)
commit97a2a55cf4a27e6fc15a43f3ffaba9f90dc42be4 (patch)
tree8553c85814efb7b33f0e5289f83a7bc55eeae5b8
parentde3af15daf44ae1de2474e1c75ba971640741cb6 (diff)
downloadhdf5-97a2a55cf4a27e6fc15a43f3ffaba9f90dc42be4.zip
hdf5-97a2a55cf4a27e6fc15a43f3ffaba9f90dc42be4.tar.gz
hdf5-97a2a55cf4a27e6fc15a43f3ffaba9f90dc42be4.tar.bz2
[svn-r5427] Purpose:
New Feature - per library change Description: Added new member function DataSet::fillMemBuf for the new C API H5Dfill. Quincey's description of H5Dfill is as followed: Added new H5Dfill() routine to fill the elements in a selection for a memory buffer with a fill value. This is a user API wrapper around some internal routines which were needed for the fill-value modifications from Raymond as well as Pedro's code for reducing the size of a chunked dataset. Platforms: SunOS 5.7 (arabica) Linux 6.2 (eirene)
-rw-r--r--c++/src/H5DataSet.cpp41
-rw-r--r--c++/src/H5DataSet.h10
2 files changed, 48 insertions, 3 deletions
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 9817b17..615252d 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -180,6 +180,47 @@ void DataSet::extend( const hsize_t* size ) const
}
}
+/*--------------------------------------------------------------------------
+ NAME
+ fillMemBuf
+ PURPOSE
+ Fills a selection in memory with a value
+ USAGE
+ fillMemBuf(fill, fill_type, buf, buf_type, space)
+ fillMemBuf(buf, buf_type, space)
+ void *buf; IN/OUT: Memory buffer to fill selection within
+ DataType& buf_type; IN: Datatype of the elements in buffer
+ DataSpace& space; IN: Dataspace describing memory buffer &
+ containing selection to use.
+ const void *fill; IN: Pointer to fill value to use - default NULL
+ DataType& fill_type; IN: Datatype of the fill value
+ DESCRIPTION
+ Use the selection in the dataspace to fill elements in a memory buffer.
+ COMMENTS, BUGS, ASSUMPTIONS
+ Second usage uses all zeros as fill value
+--------------------------------------------------------------------------*/
+void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space)
+{
+ hid_t fill_type_id = fill_type.getId();
+ hid_t buf_type_id = buf_type.getId();
+ hid_t space_id = space.getId();
+ herr_t ret_value = H5Dfill(fill, fill_type_id, buf, buf_type_id, space_id);
+ if( ret_value < 0 )
+ {
+ throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed");
+ }
+}
+void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
+{
+ hid_t buf_type_id = buf_type.getId();
+ hid_t space_id = space.getId();
+ herr_t ret_value = H5Dfill(NULL, buf_type_id, buf, buf_type_id, space_id);
+ if( ret_value < 0 )
+ {
+ throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed");
+ }
+}
+
// This private function calls the C API H5Dclose to close this dataset.
// Used by IdComponent::reset
void DataSet::p_close() const
diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h
index c860d3f..dba39b0 100644
--- a/c++/src/H5DataSet.h
+++ b/c++/src/H5DataSet.h
@@ -39,10 +39,14 @@ class __DLLCPP__ DataSet : public AbstractDs {
// Extends the dataset with unlimited dimension.
void extend( const hsize_t* size ) const;
+ // Fills a selection in memory with a value
+ void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space);
+ // Fills a selection in memory with zero
+ void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space);
+
// Creates a copy of an existing DataSet using its id
- // (used only by template functions in FGtemplates.h
- // to return a DataSet, will not be published; Note: should use
- // friend template function)
+ // Note: used by CommonFG to return a DataSet; should be modified
+ // to use friend template function instead)
DataSet( const hid_t dataset_id );
// Used by the API to appropriately close a dataset