summaryrefslogtreecommitdiffstats
path: root/c++/src/H5DataSet.cpp
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2017-07-06 19:16:57 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2017-07-06 19:16:57 (GMT)
commit23a702e7bad93fc4f14eab07678c75d276e2d0ad (patch)
treeafb57ddaeca17021342fa09b8999c15569630e71 /c++/src/H5DataSet.cpp
parent03dbcb75918b2cbf39800d9edf5665d3471a1fee (diff)
parentc15238a38fdb3692466bc1218de4c5aeb420fdcc (diff)
downloadhdf5-23a702e7bad93fc4f14eab07678c75d276e2d0ad.zip
hdf5-23a702e7bad93fc4f14eab07678c75d276e2d0ad.tar.gz
hdf5-23a702e7bad93fc4f14eab07678c75d276e2d0ad.tar.bz2
Merge pull request #593 in HDFFV/hdf5 from hdf5_1_8_19 to 1.8/masterhdf5-1_8_19
* commit 'c15238a38fdb3692466bc1218de4c5aeb420fdcc': (153 commits) Commit changes to release version strings in README.txt and RELEASE.txt from release. Put back link targets for dynamically loaded libraries in Makefile.ams that avoid linking with libhdf5 dependencies. Some configurations failed unnecessarily to find and link with lz and lsz when these targets were removed. Update URL for obtaining source inINSTALL file. Disable building of libdynlib* dynamically loaded plugin test libraries on CYGWIN. Added known problem entry to RELEASE.txt. Set version for 1.8.19 release. Barbara updated contents of README.txt file. Moved libdynlib* plugin test libraries to noist_LT_LIBRARIES with added flag '-rpath /nowhere' to stop them being installed while keeping them from linking with libhdf5, etc. Incremented version to 1.8.19-pre1 and ran bin/release to create tar and zip files for testing. HDF5 1.8.19-pre1 released. Add RELEASE.txt entry for H5Dget_chunk_size. Remove test entries Ran bin/reconfigure after so number change. Update hl lib .so numbers: new function was added. Update RELEASE.txt: move H5DOread_chunks entry to new features, clarify entry for HDFFV-10051. Updated notes for test fixes and added bug fix for h5diff help text. Update h5vers and release scripts for 1.8.19 branch, set version to 1.8.19-pre1. Make script name consistent across product versions Update version to 1.8.19-pre1. Propagate .so number changes to Makefile.ins with bin/reconfigure. Add toolset option Update so version numbers according to the interface compatibility report. Update supported Platforms section. Remove empty sub-sections of New Features and Bugs Fixed sections. Add entries for HDFFV-10051 and HDFFV-9934 to RELEASE.txt. Correct spelling ...
Diffstat (limited to 'c++/src/H5DataSet.cpp')
-rw-r--r--c++/src/H5DataSet.cpp843
1 files changed, 419 insertions, 424 deletions
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 608ec5f..ded483b 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -5,12 +5,10 @@
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
- * the files COPYING and Copyright.html. COPYING can be found at the root *
- * of the source code distribution tree; Copyright.html can be found at the *
- * root level of an installed copy of the electronic HDF5 document set and *
- * is linked from the top-level documents page. It can also be found at *
- * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
- * access to either file, you may request a copy from help@hdfgroup.org. *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifdef OLD_HEADER_FILENAME
@@ -20,25 +18,22 @@
#endif
#include <string>
+#include "H5private.h" // for HDfree and HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5LaccProp.h"
+#include "H5Location.h"
#include "H5Object.h"
-#include "H5PropList.h"
#include "H5OcreatProp.h"
#include "H5DxferProp.h"
#include "H5DcreatProp.h"
-#include "H5FaccProp.h"
-#include "H5FcreatProp.h"
-#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
-#include "H5File.h"
#include "H5Attribute.h"
#include "H5DataSet.h"
-#include "H5private.h" // for HDfree
namespace H5 {
#ifndef H5_NO_STD
@@ -47,23 +42,23 @@ namespace H5 {
#endif // H5_NO_STD
//--------------------------------------------------------------------------
-// Function: DataSet default constructor
-///\brief Default constructor: creates a stub DataSet.
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet default constructor
+///\brief Default constructor: creates a stub DataSet.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSet::DataSet() : H5Object(), AbstractDs(), id(H5I_INVALID_HID) {}
//--------------------------------------------------------------------------
-// Function: DataSet overloaded constructor
-///\brief Creates an DataSet object using the id of an existing dataset.
-///\param existing_id - IN: Id of an existing dataset
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet overloaded constructor
+///\brief Creates an DataSet object using the id of an existing dataset.
+///\param existing_id - IN: Id of an existing dataset
+// Programmer Binh-Minh Ribler - 2000
// Description
-// incRefCount() is needed here to prevent the id from being closed
-// prematurely. That is, when application uses the id of an
-// existing DataSet object to create another DataSet object. So,
-// when one of those objects is deleted, the id will be closed if
-// the reference counter is only 1.
+// incRefCount() is needed here to prevent the id from being closed
+// prematurely. That is, when application uses the id of an
+// existing DataSet object to create another DataSet object. So,
+// when one of those objects is deleted, the id will be closed if
+// the reference counter is only 1.
//--------------------------------------------------------------------------
DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs(), id(existing_id)
{
@@ -71,10 +66,10 @@ DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs(), id(existin
}
//--------------------------------------------------------------------------
-// Function: DataSet copy constructor
-///\brief Copy constructor: makes a copy of the original DataSet object.
-///\param original - IN: DataSet instance to copy
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet copy constructor
+///\brief Copy constructor: makes a copy of the original DataSet object.
+///\param original - IN: DataSet instance to copy
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSet::DataSet(const DataSet& original) : H5Object(), AbstractDs(), id(original.id)
{
@@ -82,21 +77,21 @@ DataSet::DataSet(const DataSet& original) : H5Object(), AbstractDs(), id(origina
}
//--------------------------------------------------------------------------
-// Function: DataSet overload constructor - dereference
-///\brief Given a reference, ref, to an hdf5 location, creates a
-/// DataSet object
-///\param loc - IN: Dataset reference object is in or location of
-/// object that the dataset is located within.
-///\param ref - IN: Reference pointer
-///\param ref_type - IN: Reference type - default to H5R_OBJECT
-///\exception H5::DataSetIException
+// Function: DataSet overload constructor - dereference
+///\brief Given a reference, ref, to an hdf5 location, creates a
+/// DataSet object
+///\param loc - IN: Dataset reference object is in or location of
+/// object that the dataset is located within.
+///\param ref - IN: Reference pointer
+///\param ref_type - IN: Reference type - default to H5R_OBJECT
+///\exception H5::DataSetIException
///\par Description
-/// \c loc can be DataSet, Group, H5File, or named DataType, that
-/// is a datatype that has been named by DataType::commit.
-// Programmer Binh-Minh Ribler - Oct, 2006
+/// \c loc can be DataSet, Group, H5File, or named DataType, that
+/// is a datatype that has been named by DataType::commit.
+// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
-// Jul, 2008
-// Added for application convenience.
+// Jul, 2008
+// Added for application convenience.
//--------------------------------------------------------------------------
DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object(), id(H5I_INVALID_HID)
{
@@ -104,17 +99,17 @@ DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type) :
}
//--------------------------------------------------------------------------
-// Function: DataSet overload constructor - dereference
-///\brief Given a reference, ref, to an hdf5 attribute, creates a
-/// DataSet object
-///\param attr - IN: Specifying location where the referenced object is in
-///\param ref - IN: Reference pointer
-///\param ref_type - IN: Reference type - default to H5R_OBJECT
-///\exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
+// Function: DataSet overload constructor - dereference
+///\brief Given a reference, ref, to an hdf5 attribute, creates a
+/// DataSet object
+///\param attr - IN: Specifying location where the referenced object is in
+///\param ref - IN: Reference pointer
+///\param ref_type - IN: Reference type - default to H5R_OBJECT
+///\exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
-// Jul, 2008
-// Added for application convenience.
+// Jul, 2008
+// Added for application convenience.
//--------------------------------------------------------------------------
DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object(), id(H5I_INVALID_HID)
{
@@ -122,26 +117,26 @@ DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type) :
}
//--------------------------------------------------------------------------
-// Function: DataSet::getSpace
-///\brief Gets a copy of the dataspace of this dataset.
-///\return DataSpace instance
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet::getSpace
+///\brief Gets a copy of the dataspace of this dataset.
+///\return DataSpace instance
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSpace DataSet::getSpace() const
{
- // Calls C function H5Dget_space to get the id of the dataspace
- hid_t dataspace_id = H5Dget_space( id );
-
- // If the dataspace id is invalid, throw an exception
- if( dataspace_id < 0 )
- {
- throw DataSetIException("DataSet::getSpace", "H5Dget_space failed");
- }
- //create dataspace object using the existing id then return the object
- DataSpace data_space;
- f_DataSpace_setId(&data_space, dataspace_id);
- return( data_space );
+ // Calls C function H5Dget_space to get the id of the dataspace
+ hid_t dataspace_id = H5Dget_space(id);
+
+ // If the dataspace id is invalid, throw an exception
+ if(dataspace_id < 0)
+ {
+ throw DataSetIException("DataSet::getSpace", "H5Dget_space failed");
+ }
+ //create dataspace object using the existing id then return the object
+ DataSpace data_space;
+ f_DataSpace_setId(&data_space, dataspace_id);
+ return(data_space);
}
// This private member function calls the C API to get the identifier
@@ -149,57 +144,57 @@ DataSpace DataSet::getSpace() const
// by the various AbstractDs functions to get the specific datatype.
hid_t DataSet::p_get_type() const
{
- hid_t type_id = H5Dget_type( id );
- if( type_id > 0 )
- return( type_id );
- else
- {
- throw DataSetIException("", "H5Dget_type failed");
- }
+ hid_t type_id = H5Dget_type(id);
+ if(type_id > 0)
+ return(type_id);
+ else
+ {
+ throw DataSetIException("", "H5Dget_type failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSet::getCreatePlist
-///\brief Gets the dataset creation property list.
-///\return DSetCreatPropList instance
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet::getCreatePlist
+///\brief Gets the dataset creation property list.
+///\return DSetCreatPropList instance
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetCreatPropList DataSet::getCreatePlist() const
{
- hid_t create_plist_id = H5Dget_create_plist( id );
- if( create_plist_id < 0 )
- {
- throw DataSetIException("DataSet::getCreatePlist", "H5Dget_create_plist failed");
- }
-
- // create and return the DSetCreatPropList object
- DSetCreatPropList create_plist;
- f_PropList_setId(&create_plist, create_plist_id);
- return(create_plist);
+ hid_t create_plist_id = H5Dget_create_plist(id);
+ if(create_plist_id < 0)
+ {
+ throw DataSetIException("DataSet::getCreatePlist", "H5Dget_create_plist failed");
+ }
+
+ // create and return the DSetCreatPropList object
+ DSetCreatPropList create_plist;
+ f_PropList_setId(&create_plist, create_plist_id);
+ return(create_plist);
}
//--------------------------------------------------------------------------
-// Function: DataSet::getStorageSize
-///\brief Returns the amount of storage required for a dataset.
-///\return Size of the storage or 0, for no data
-///\exception H5::DataSetIException
-// Note: H5Dget_storage_size returns 0 when there is no data. This
-// function should have no failure. (from SLU)
-// Programmer Binh-Minh Ribler - Mar, 2005
+// Function: DataSet::getStorageSize
+///\brief Returns the amount of storage required for a dataset.
+///\return Size of the storage or 0, for no data
+///\exception H5::DataSetIException
+// Note: H5Dget_storage_size returns 0 when there is no data. This
+// function should have no failure. (from SLU)
+// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
hsize_t DataSet::getStorageSize() const
{
- hsize_t storage_size = H5Dget_storage_size(id);
- return(storage_size);
+ hsize_t storage_size = H5Dget_storage_size(id);
+ return(storage_size);
}
//--------------------------------------------------------------------------
-// Function: DataSet::getInMemDataSize
-///\brief Gets the size in memory of the dataset's data.
-///\return Size of data (in memory)
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - Apr 2009
+// Function: DataSet::getInMemDataSize
+///\brief Gets the size in memory of the dataset's data.
+///\return Size of data (in memory)
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - Apr 2009
//--------------------------------------------------------------------------
size_t DataSet::getInMemDataSize() const
{
@@ -207,9 +202,9 @@ size_t DataSet::getInMemDataSize() const
// Get the data type of this dataset
hid_t mem_type_id = H5Dget_type(id);
- if( mem_type_id < 0 )
+ if(mem_type_id < 0)
{
- throw DataSetIException(func, "H5Dget_type failed");
+ throw DataSetIException(func, "H5Dget_type failed");
}
// Get the data type's size by first getting its native type then getting
@@ -217,22 +212,22 @@ size_t DataSet::getInMemDataSize() const
hid_t native_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT);
if (native_type < 0)
{
- throw DataSetIException(func, "H5Tget_native_type failed");
+ throw DataSetIException(func, "H5Tget_native_type failed");
}
size_t type_size = H5Tget_size(native_type);
if (type_size == 0)
{
- throw DataSetIException(func, "H5Tget_size failed");
+ throw DataSetIException(func, "H5Tget_size failed");
}
// Close the native type and the datatype of this dataset.
if (H5Tclose(native_type) < 0)
{
- throw DataSetIException(func, "H5Tclose(native_type) failed");
+ throw DataSetIException(func, "H5Tclose(native_type) failed");
}
if (H5Tclose(mem_type_id) < 0)
{
- throw DataSetIException(func, "H5Tclose(mem_type_id) failed");
+ throw DataSetIException(func, "H5Tclose(mem_type_id) failed");
}
// Get number of elements of the dataset by first getting its dataspace,
@@ -240,18 +235,18 @@ size_t DataSet::getInMemDataSize() const
hid_t space_id = H5Dget_space(id);
if (space_id < 0)
{
- throw DataSetIException(func, "H5Dget_space failed");
+ throw DataSetIException(func, "H5Dget_space failed");
}
hssize_t num_elements = H5Sget_simple_extent_npoints(space_id);
if (num_elements < 0)
{
- throw DataSetIException(func, "H5Sget_simple_extent_npoints failed");
+ throw DataSetIException(func, "H5Sget_simple_extent_npoints failed");
}
// Close the dataspace
if (H5Sclose(space_id) < 0)
{
- throw DataSetIException(func, "H5Sclose failed");
+ throw DataSetIException(func, "H5Sclose failed");
}
// Calculate and return the size of the data
@@ -260,186 +255,186 @@ size_t DataSet::getInMemDataSize() const
}
//--------------------------------------------------------------------------
-// Function: DataSet::getOffset
-///\brief Returns the address of this dataset in the file.
-///\return Address of dataset
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet::getOffset
+///\brief Returns the address of this dataset in the file.
+///\return Address of dataset
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
haddr_t DataSet::getOffset() const
{
- haddr_t ds_addr; // for address of dataset
-
- ds_addr = H5Dget_offset(id);
- if( ds_addr == HADDR_UNDEF )
- {
- throw DataSetIException("DataSet::getOffset", "H5Dget_offset returned HADDR_UNDEF");
- }
- return(ds_addr);
+ haddr_t ds_addr; // for address of dataset
+
+ ds_addr = H5Dget_offset(id);
+ if(ds_addr == HADDR_UNDEF)
+ {
+ throw DataSetIException("DataSet::getOffset", "H5Dget_offset returned HADDR_UNDEF");
+ }
+ return(ds_addr);
}
//--------------------------------------------------------------------------
-// Function: DataSet::getSpaceStatus
-///\brief Determines whether space has been allocated for a dataset.
-///\param status - OUT: Space allocation status
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet::getSpaceStatus
+///\brief Determines whether space has been allocated for a dataset.
+///\param status - OUT: Space allocation status
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSet::getSpaceStatus(H5D_space_status_t& status) const
{
- herr_t ret_value = H5Dget_space_status(id, &status);
- if( ret_value < 0 )
- {
- throw DataSetIException("DataSet::getSpaceStatus", "H5Dget_space_status failed");
- }
+ herr_t ret_value = H5Dget_space_status(id, &status);
+ if(ret_value < 0)
+ {
+ throw DataSetIException("DataSet::getSpaceStatus", "H5Dget_space_status failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSet::getVlenBufSize
-///\brief Returns the number of bytes required to store VL data.
-///\param type - IN: Datatype, which is the datatype for the buffer
-///\param space - IN: Selection for the memory buffer
-///\return Amount of storage
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet::getVlenBufSize
+///\brief Returns the number of bytes required to store VL data.
+///\param type - IN: Datatype, which is the datatype for the buffer
+///\param space - IN: Selection for the memory buffer
+///\return Amount of storage
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// Replaced the version without const parameter - Apr, 2014
+// Replaced the version without const parameter - Apr, 2014
//--------------------------------------------------------------------------
-hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space ) const
+hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space) const
{
- // Obtain identifiers for C API
- hid_t type_id = type.getId();
- hid_t space_id = space.getId();
-
- hsize_t size; // for amount of storage
-
- herr_t ret_value = H5Dvlen_get_buf_size( id, type_id, space_id, &size );
- if( ret_value < 0 )
- {
- throw DataSetIException("DataSet::getVlenBufSize", "H5Dvlen_get_buf_size failed");
- }
- return( size );
+ // Obtain identifiers for C API
+ hid_t type_id = type.getId();
+ hid_t space_id = space.getId();
+
+ hsize_t size; // for amount of storage
+
+ herr_t ret_value = H5Dvlen_get_buf_size(id, type_id, space_id, &size);
+ if(ret_value < 0)
+ {
+ throw DataSetIException("DataSet::getVlenBufSize", "H5Dvlen_get_buf_size failed");
+ }
+ return(size);
}
//--------------------------------------------------------------------------
-// Function: DataSet::getVlenBufSize
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const's. This wrapper will be removed in future release.
-// Return Amount of storage
-// Exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet::getVlenBufSize
+// Purpose This is an overloaded member function, kept for backward
+// compatibility. It differs from the above function in that it
+// misses const's. This wrapper will be removed in future release.
+// Return Amount of storage
+// Exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
-// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
+// Modified to call its replacement. -BMR, 2014/04/16
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
-//hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const
+//hsize_t DataSet::getVlenBufSize(DataType& type, DataSpace& space) const
//{
-// return(getVlenBufSize(type, space));
+// return(getVlenBufSize(type, space));
//}
//--------------------------------------------------------------------------
-// Function: DataSet::vlenReclaim
-///\brief Reclaims VL datatype memory buffers.
-///\param type - IN: Datatype, which is the datatype stored in the buffer
-///\param space - IN: Selection for the memory buffer to free the
-/// VL datatypes within
-///\param xfer_plist - IN: Property list used to create the buffer
-///\param buf - IN: Pointer to the buffer to be reclaimed
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet::vlenReclaim
+///\brief Reclaims VL datatype memory buffers.
+///\param type - IN: Datatype, which is the datatype stored in the buffer
+///\param space - IN: Selection for the memory buffer to free the
+/// VL datatypes within
+///\param xfer_plist - IN: Property list used to create the buffer
+///\param buf - IN: Pointer to the buffer to be reclaimed
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf )
+void DataSet::vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf)
{
- // Obtain identifiers for C API
- hid_t type_id = type.getId();
- hid_t space_id = space.getId();
- hid_t xfer_plist_id = xfer_plist.getId();
-
- herr_t ret_value = H5Dvlen_reclaim( type_id, space_id, xfer_plist_id, buf );
- if( ret_value < 0 )
- {
- throw DataSetIException("DataSet::vlenReclaim", "H5Dvlen_reclaim failed");
- }
+ // Obtain identifiers for C API
+ hid_t type_id = type.getId();
+ hid_t space_id = space.getId();
+ hid_t xfer_plist_id = xfer_plist.getId();
+
+ herr_t ret_value = H5Dvlen_reclaim(type_id, space_id, xfer_plist_id, buf);
+ if(ret_value < 0)
+ {
+ throw DataSetIException("DataSet::vlenReclaim", "H5Dvlen_reclaim failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSet::vlenReclaim
-///\brief Reclaims VL datatype memory buffers.
-///\param type - IN: Datatype, which is the datatype stored in the buffer
-///\param space - IN: Selection for the memory buffer to free the
-/// VL datatypes within
-///\param xfer_plist - IN: Property list used to create the buffer
-///\param buf - IN: Pointer to the buffer to be reclaimed
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet::vlenReclaim
+///\brief Reclaims VL datatype memory buffers.
+///\param type - IN: Datatype, which is the datatype stored in the buffer
+///\param space - IN: Selection for the memory buffer to free the
+/// VL datatypes within
+///\param xfer_plist - IN: Property list used to create the buffer
+///\param buf - IN: Pointer to the buffer to be reclaimed
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
//\parDescription
-// This function has better prototype for the users than the
-// other, which might be removed at some point. BMR - 2006/12/20
+// This function has better prototype for the users than the
+// other, which might be removed at some point. BMR - 2006/12/20
//--------------------------------------------------------------------------
void DataSet::vlenReclaim(void* buf, const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist)
{
- // Obtain identifiers for C API
- hid_t type_id = type.getId();
- hid_t space_id = space.getId();
- hid_t xfer_plist_id = xfer_plist.getId();
-
- herr_t ret_value = H5Dvlen_reclaim(type_id, space_id, xfer_plist_id, buf);
- if (ret_value < 0)
- {
- throw DataSetIException("DataSet::vlenReclaim", "H5Dvlen_reclaim failed");
- }
+ // Obtain identifiers for C API
+ hid_t type_id = type.getId();
+ hid_t space_id = space.getId();
+ hid_t xfer_plist_id = xfer_plist.getId();
+
+ herr_t ret_value = H5Dvlen_reclaim(type_id, space_id, xfer_plist_id, buf);
+ if (ret_value < 0)
+ {
+ throw DataSetIException("DataSet::vlenReclaim", "H5Dvlen_reclaim failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSet::read
-///\brief Reads raw data from the specified dataset.
-///\param buf - IN: Buffer for read data
-///\param mem_type - IN: Memory datatype
-///\param mem_space - IN: Memory dataspace
-///\param file_space - IN: Dataset's dataspace in the file
-///\param xfer_plist - IN: Transfer property list for this I/O operation
-///\exception H5::DataSetIException
+// Function: DataSet::read
+///\brief Reads raw data from the specified dataset.
+///\param buf - IN: Buffer for read data
+///\param mem_type - IN: Memory datatype
+///\param mem_space - IN: Memory dataspace
+///\param file_space - IN: Dataset's dataspace in the file
+///\param xfer_plist - IN: Transfer property list for this I/O operation
+///\exception H5::DataSetIException
///\par Description
-/// This function reads raw data from this dataset into the
-/// buffer \a buf, converting from file datatype and dataspace
-/// to memory datatype \a mem_type and dataspace \a mem_space.
-// Programmer Binh-Minh Ribler - 2000
+/// This function reads raw data from this dataset into the
+/// buffer \a buf, converting from file datatype and dataspace
+/// to memory datatype \a mem_type and dataspace \a mem_space.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::read( void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const
+void DataSet::read(void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const
{
- // Obtain identifiers for C API
- hid_t mem_type_id = mem_type.getId();
- hid_t mem_space_id = mem_space.getId();
- hid_t file_space_id = file_space.getId();
- hid_t xfer_plist_id = xfer_plist.getId();
-
- herr_t ret_value = H5Dread( id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf );
- if( ret_value < 0 )
- {
- throw DataSetIException("DataSet::read", "H5Dread failed");
- }
+ // Obtain identifiers for C API
+ hid_t mem_type_id = mem_type.getId();
+ hid_t mem_space_id = mem_space.getId();
+ hid_t file_space_id = file_space.getId();
+ hid_t xfer_plist_id = xfer_plist.getId();
+
+ herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf);
+ if(ret_value < 0)
+ {
+ throw DataSetIException("DataSet::read", "H5Dread failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSet::read
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes a reference to a \c H5std_string for the buffer.
-///\param strg - IN: Buffer for read data string
-///\param mem_type - IN: Memory datatype
-///\param mem_space - IN: Memory dataspace
-///\param file_space - IN: Dataset's dataspace in the file
-///\param xfer_plist - IN: Transfer property list for this I/O operation
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet::read
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes a reference to a \c H5std_string for the buffer.
+///\param strg - IN: Buffer for read data string
+///\param mem_type - IN: Memory datatype
+///\param mem_space - IN: Memory dataspace
+///\param file_space - IN: Dataset's dataspace in the file
+///\param xfer_plist - IN: Transfer property list for this I/O operation
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// Jul 2009
-// Follow the change to Attribute::read and use the following
-// private functions to read datasets with fixed- and
-// variable-length string:
-// DataSet::p_read_fixed_len and
-// DataSet::p_read_variable_len
+// Jul 2009
+// Follow the change to Attribute::read and use the following
+// private functions to read datasets with fixed- and
+// variable-length string:
+// DataSet::p_read_fixed_len and
+// DataSet::p_read_variable_len
//--------------------------------------------------------------------------
void DataSet::read(H5std_string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const
{
@@ -468,47 +463,47 @@ void DataSet::read(H5std_string& strg, const DataType& mem_type, const DataSpace
}
//--------------------------------------------------------------------------
-// Function: DataSet::write
-///\brief Writes raw data from an application buffer to a dataset.
-///\param buf - IN: Buffer containing data to be written
-///\param mem_type - IN: Memory datatype
-///\param mem_space - IN: Memory dataspace
-///\param file_space - IN: Dataset's dataspace in the file
-///\param xfer_plist - IN: Transfer property list for this I/O operation
-///\exception H5::DataSetIException
+// Function: DataSet::write
+///\brief Writes raw data from an application buffer to a dataset.
+///\param buf - IN: Buffer containing data to be written
+///\param mem_type - IN: Memory datatype
+///\param mem_space - IN: Memory dataspace
+///\param file_space - IN: Dataset's dataspace in the file
+///\param xfer_plist - IN: Transfer property list for this I/O operation
+///\exception H5::DataSetIException
///\par Description
-/// This function writes raw data from an application buffer
-/// \a buf to a dataset, converting from memory datatype
-/// \a mem_type and dataspace \a mem_space to file datatype
-/// and dataspace.
-// Programmer Binh-Minh Ribler - 2000
+/// This function writes raw data from an application buffer
+/// \a buf to a dataset, converting from memory datatype
+/// \a mem_type and dataspace \a mem_space to file datatype
+/// and dataspace.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::write( const void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const
+void DataSet::write(const void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const
{
- // Obtain identifiers for C API
- hid_t mem_type_id = mem_type.getId();
- hid_t mem_space_id = mem_space.getId();
- hid_t file_space_id = file_space.getId();
- hid_t xfer_plist_id = xfer_plist.getId();
-
- herr_t ret_value = H5Dwrite( id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf );
- if( ret_value < 0 )
- {
- throw DataSetIException("DataSet::write", "H5Dwrite failed");
- }
+ // Obtain identifiers for C API
+ hid_t mem_type_id = mem_type.getId();
+ hid_t mem_space_id = mem_space.getId();
+ hid_t file_space_id = file_space.getId();
+ hid_t xfer_plist_id = xfer_plist.getId();
+
+ herr_t ret_value = H5Dwrite(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf);
+ if(ret_value < 0)
+ {
+ throw DataSetIException("DataSet::write", "H5Dwrite failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSet::write
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes a reference to a \c H5std_string for the buffer.
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet::write
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes a reference to a \c H5std_string for the buffer.
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// Jul 2009
-// Modified to pass the buffer into H5Dwrite properly depending
-// whether the dataset has variable- or fixed-length string.
+// Jul 2009
+// Modified to pass the buffer into H5Dwrite properly depending
+// whether the dataset has variable- or fixed-length string.
//--------------------------------------------------------------------------
-void DataSet::write( const H5std_string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const
+void DataSet::write(const H5std_string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const
{
// Check if this attribute has variable-len string or fixed-len string and
// proceed appropriately.
@@ -518,11 +513,11 @@ void DataSet::write( const H5std_string& strg, const DataType& mem_type, const D
throw DataSetIException("DataSet::write", "H5Tis_variable_str failed");
}
- // Obtain identifiers for C API
- hid_t mem_type_id = mem_type.getId();
- hid_t mem_space_id = mem_space.getId();
- hid_t file_space_id = file_space.getId();
- hid_t xfer_plist_id = xfer_plist.getId();
+ // Obtain identifiers for C API
+ hid_t mem_type_id = mem_type.getId();
+ hid_t mem_space_id = mem_space.getId();
+ hid_t file_space_id = file_space.getId();
+ hid_t xfer_plist_id = xfer_plist.getId();
// Convert string to C-string
const char* strg_C;
@@ -532,12 +527,12 @@ void DataSet::write( const H5std_string& strg, const DataType& mem_type, const D
// Pass string in differently depends on variable or fixed length
if (!is_variable_len)
{
- ret_value = H5Dwrite( id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C );
+ ret_value = H5Dwrite(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C);
}
else
{
// passing string argument by address
- ret_value = H5Dwrite( id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, &strg_C );
+ ret_value = H5Dwrite(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, &strg_C);
}
if (ret_value < 0)
{
@@ -546,65 +541,65 @@ void DataSet::write( const H5std_string& strg, const DataType& mem_type, const D
}
//--------------------------------------------------------------------------
-// Function: DataSet::iterateElems
-///\brief Iterates over all selected elements in a dataspace.
-///\param buf - IN/OUT: Pointer to the buffer in memory containing the
-/// elements to iterate over
-///\param type - IN: Datatype for the elements stored in \a buf
-///\param space - IN: Dataspace for \a buf. Also contains the selection
-/// to iterate over.
-///\param op - IN: Function pointer to the routine to be called for
-/// each element in \a buf iterated over
-///\param op_data - IN/OUT: Pointer to any user-defined data associated
-/// with the operation
-///\exception H5::DataSetIException
-///\note This function may not work correctly yet - it's still
-/// under development.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-int DataSet::iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data )
+// Function: DataSet::iterateElems
+///\brief Iterates over all selected elements in a dataspace.
+///\param buf - IN/OUT: Pointer to the buffer in memory containing the
+/// elements to iterate over
+///\param type - IN: Datatype for the elements stored in \a buf
+///\param space - IN: Dataspace for \a buf. Also contains the selection
+/// to iterate over.
+///\param op - IN: Function pointer to the routine to be called for
+/// each element in \a buf iterated over
+///\param op_data - IN/OUT: Pointer to any user-defined data associated
+/// with the operation
+///\exception H5::DataSetIException
+///\note This function may not work correctly yet - it's still
+/// under development.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+int DataSet::iterateElems(void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data)
{
- // Obtain identifiers for C API
- hid_t type_id = type.getId();
- hid_t space_id = space.getId();
- herr_t ret_value = H5Diterate( buf, type_id, space_id, op, op_data );
- if( ret_value >= 0 )
- return( ret_value );
- else // raise exception when H5Diterate returns a negative value
- {
- throw DataSetIException("DataSet::iterateElems", "H5Diterate failed");
- }
+ // Obtain identifiers for C API
+ hid_t type_id = type.getId();
+ hid_t space_id = space.getId();
+ herr_t ret_value = H5Diterate(buf, type_id, space_id, op, op_data);
+ if(ret_value >= 0)
+ return(ret_value);
+ else // raise exception when H5Diterate returns a negative value
+ {
+ throw DataSetIException("DataSet::iterateElems", "H5Diterate failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSet::extend
-///\brief Extends a dataset with unlimited dimension.
-///\param size - IN: Array containing the new magnitude of each dimension
-///\exception H5::DataSetIException
+// Function: DataSet::extend
+///\brief Extends a dataset with unlimited dimension.
+///\param size - IN: Array containing the new magnitude of each dimension
+///\exception H5::DataSetIException
///\par Description
-/// For more information, please see the Description section in
-/// C layer Reference Manual at:
+/// For more information, please see the Description section in
+/// C layer Reference Manual at:
///\par
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Extend
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSet::extend( const hsize_t* size ) const
+void DataSet::extend(const hsize_t* size) const
{
- herr_t ret_value = H5Dset_extent( id, size );
- if( ret_value < 0 ) // raise exception when H5Dset_extent returns a neg value
- throw DataSetIException("DataSet::extend", "H5Dset_extent failed");
+ herr_t ret_value = H5Dset_extent(id, size);
+ if(ret_value < 0) // raise exception when H5Dset_extent returns a neg value
+ throw DataSetIException("DataSet::extend", "H5Dset_extent failed");
}
//--------------------------------------------------------------------------
-// Function: DataSet::fillMemBuf
-///\brief Fills a selection in memory with a value.
-///\param fill - IN: Pointer to fill value to use - default NULL
-///\param fill_type - IN: Datatype of the fill value
-///\param buf - IN/OUT: Memory buffer to fill selection within
-///\param buf_type - IN: Datatype of the elements in buffer
-///\param space - IN: Dataspace describing memory buffer & containing selection to use
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2014
+// Function: DataSet::fillMemBuf
+///\brief Fills a selection in memory with a value.
+///\param fill - IN: Pointer to fill value to use - default NULL
+///\param fill_type - IN: Datatype of the fill value
+///\param buf - IN/OUT: Memory buffer to fill selection within
+///\param buf_type - IN: Datatype of the elements in buffer
+///\param space - IN: Dataspace describing memory buffer & containing selection to use
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2014
// Modification
//--------------------------------------------------------------------------
void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const
@@ -613,28 +608,28 @@ void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf,
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 )
+ if(ret_value < 0)
{
- throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed");
+ throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed");
}
}
//--------------------------------------------------------------------------
-// Function: DataSet::fillMemBuf
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const's. This wrapper will be removed in future release.
-// Param fill - IN: Pointer to fill value to use - default NULL
-// Param fill_type - IN: Datatype of the fill value
-// Param buf - IN/OUT: Memory buffer to fill selection within
-// Param buf_type - IN: Datatype of the elements in buffer
-// Param space - IN: Dataspace describing memory buffer & containing selection to use
-// Exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet::fillMemBuf
+// Purpose This is an overloaded member function, kept for backward
+// compatibility. It differs from the above function in that it
+// misses const's. This wrapper will be removed in future release.
+// Param fill - IN: Pointer to fill value to use - default NULL
+// Param fill_type - IN: Datatype of the fill value
+// Param buf - IN/OUT: Memory buffer to fill selection within
+// Param buf_type - IN: Datatype of the elements in buffer
+// Param space - IN: Dataspace describing memory buffer & containing selection to use
+// Exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
-// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
+// Modified to call its replacement. -BMR, 2014/04/16
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
//void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space)
//{
@@ -642,41 +637,41 @@ void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf,
//}
//--------------------------------------------------------------------------
-// Function: DataSet::fillMemBuf
-///\brief Fills a selection in memory with 0.
-///\param buf - IN/OUT: Memory buffer to fill selection within
-///\param buf_type - IN: Datatype of the elements in buffer
-///\param space - IN: Dataspace describing memory buffer & containing selection to use
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet::fillMemBuf
+///\brief Fills a selection in memory with 0.
+///\param buf - IN/OUT: Memory buffer to fill selection within
+///\param buf_type - IN: Datatype of the elements in buffer
+///\param space - IN: Dataspace describing memory buffer & containing selection to use
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// Replaced the version without const parameter - Apr, 2014
+// Replaced the version without const parameter - Apr, 2014
//--------------------------------------------------------------------------
void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& space) const
{
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 )
+ if(ret_value < 0)
{
- throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed");
+ throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSet::fillMemBuf
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const's. This wrapper will be removed in future release.
+// Purpose This is an overloaded member function, kept for backward
+// compatibility. It differs from the above function in that it
+// misses const's. This wrapper will be removed in future release.
// Param buf - IN/OUT: Memory buffer to fill selection within
// Param buf_type - IN: Datatype of the elements in buffer
// Param space - IN: Dataspace describing memory buffer & containing selection to use
-// Exception H5::DataSetIException
+// Exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
// Modification
-// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
-// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
+// Modified to call its replacement. -BMR, 2014/04/16
+// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
+// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
//--------------------------------------------------------------------------
//void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
//{
@@ -685,8 +680,8 @@ void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& s
//--------------------------------------------------------------------------
// Function: DataSet::getId
-///\brief Get the id of this dataset.
-///\return DataSet identifier
+///\brief Get the id of this dataset.
+///\return DataSet identifier
// Description:
// Class hierarchy is revised to address bugzilla 1068. Class
// AbstractDs and Attribute are moved out of H5Object. In
@@ -696,19 +691,19 @@ void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& s
//--------------------------------------------------------------------------
hid_t DataSet::getId() const
{
- return(id);
+ return(id);
}
//--------------------------------------------------------------------------
-// Function: DataSet::p_read_fixed_len (private)
-// brief Reads a fixed length \a H5std_string from a dataset.
-// param mem_type - IN: DataSet datatype (in memory)
-// param strg - IN: Buffer for read string
-// exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - Jul, 2009
+// Function: DataSet::p_read_fixed_len (private)
+// brief Reads a fixed length \a H5std_string from a dataset.
+// param mem_type - IN: DataSet datatype (in memory)
+// param strg - IN: Buffer for read string
+// exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - Jul, 2009
// Modification
-// Jul 2009
-// Added in follow to the change in Attribute::read
+// Jul 2009
+// Added in follow to the change in Attribute::read
//--------------------------------------------------------------------------
void DataSet::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
{
@@ -720,33 +715,33 @@ void DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id
// If there is data, allocate buffer and read it.
if (data_size > 0)
{
- char *strg_C = new char [data_size+1];
- HDmemset(strg_C, 0, data_size+1); // clear buffer
+ char *strg_C = new char [data_size+1];
+ HDmemset(strg_C, 0, data_size+1); // clear buffer
- herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C);
+ herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C);
- if( ret_value < 0 )
- {
- delete []strg_C; // de-allocate for fixed-len string
- throw DataSetIException("DataSet::read", "H5Dread failed for fixed length string");
- }
+ if(ret_value < 0)
+ {
+ delete []strg_C; // de-allocate for fixed-len string
+ throw DataSetIException("DataSet::read", "H5Dread failed for fixed length string");
+ }
- // Get string from the C char* and release resource allocated locally
- strg = strg_C;
- delete []strg_C;
+ // Get string from the C char* and release resource allocated locally
+ strg = strg_C;
+ delete []strg_C;
}
}
//--------------------------------------------------------------------------
-// Function: DataSet::p_read_variable_len (private)
-// brief Reads a variable length \a H5std_string from an dataset.
-// param mem_type - IN: DataSet datatype (in memory)
-// param strg - IN: Buffer for read string
-// exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - Jul, 2009
+// Function: DataSet::p_read_variable_len (private)
+// brief Reads a variable length \a H5std_string from an dataset.
+// param mem_type - IN: DataSet datatype (in memory)
+// param strg - IN: Buffer for read string
+// exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - Jul, 2009
// Modification
-// Jul 2009
-// Added in follow to the change in Attribute::read
+// Jul 2009
+// Added in follow to the change in Attribute::read
//--------------------------------------------------------------------------
void DataSet::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
{
@@ -756,9 +751,9 @@ void DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space
// Read dataset, no allocation for variable-len string; C library will
herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, &strg_C);
- if( ret_value < 0 )
+ if(ret_value < 0)
{
- throw DataSetIException("DataSet::read", "H5Dread failed for variable length string");
+ throw DataSetIException("DataSet::read", "H5Dread failed for variable length string");
}
// Get string from the C char* and release resource allocated by C API
@@ -788,8 +783,8 @@ void DataSet::p_setId(const hid_t new_id)
catch (Exception& close_error) {
throw DataSetIException(inMemFunc("p_setId"), close_error.getDetailMsg());
}
- // reset object's id to the given id
- id = new_id;
+ // reset object's id to the given id
+ id = new_id;
}
//--------------------------------------------------------------------------
@@ -810,43 +805,43 @@ void f_PropList_setId(PropList* plist, hid_t new_id)
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: DataSet::close
-///\brief Closes this dataset.
+// Function: DataSet::close
+///\brief Closes this dataset.
///
-///\exception H5::DataSetIException
-// Programmer Binh-Minh Ribler - Mar 9, 2005
+///\exception H5::DataSetIException
+// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
void DataSet::close()
{
if (p_valid_id(id))
{
- herr_t ret_value = H5Dclose( id );
- if( ret_value < 0 )
- {
- throw DataSetIException("DataSet::close", "H5Dclose failed");
- }
- // reset the id
- id = H5I_INVALID_HID;
+ herr_t ret_value = H5Dclose(id);
+ if(ret_value < 0)
+ {
+ throw DataSetIException("DataSet::close", "H5Dclose failed");
+ }
+ // reset the id
+ id = H5I_INVALID_HID;
}
}
//--------------------------------------------------------------------------
-// Function: DataSet destructor
-///\brief Properly terminates access to this dataset.
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSet destructor
+///\brief Properly terminates access to this dataset.
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// - Replaced resetIdComponent() with decRefCount() to use C
-// library ID reference counting mechanism - BMR, Jun 1, 2004
-// - Replaced decRefCount with close() to let the C library
-// handle the reference counting - BMR, Jun 1, 2006
+// - Replaced resetIdComponent() with decRefCount() to use C
+// library ID reference counting mechanism - BMR, Jun 1, 2004
+// - Replaced decRefCount with close() to let the C library
+// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
DataSet::~DataSet()
{
try {
- close();
+ close();
}
catch (Exception& close_error) {
- cerr << "DataSet::~DataSet - " << close_error.getDetailMsg() << endl;
+ cerr << "DataSet::~DataSet - " << close_error.getDetailMsg() << endl;
}
}
} // end namespace