summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2017-03-03 14:45:57 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2017-03-03 14:45:57 (GMT)
commit861a849530df32d9f1a495eb8b82877198dab7de (patch)
tree28d5c4147623d5aee01d7ec693b4c8b8fc95d1cf /c++
parent4fc97f28531bd89640c10389dd36270335e5a971 (diff)
downloadhdf5-861a849530df32d9f1a495eb8b82877198dab7de.zip
hdf5-861a849530df32d9f1a495eb8b82877198dab7de.tar.gz
hdf5-861a849530df32d9f1a495eb8b82877198dab7de.tar.bz2
Description:
Only format changes: mostly tabs vs. spaces Platforms tested: Linux/64 (jelly) - very minor
Diffstat (limited to 'c++')
-rw-r--r--c++/src/H5AbstractDs.cpp436
-rw-r--r--c++/src/H5AbstractDs.h68
-rw-r--r--c++/src/H5ArrayType.cpp142
-rw-r--r--c++/src/H5ArrayType.h48
-rw-r--r--c++/src/H5AtomType.cpp360
-rw-r--r--c++/src/H5AtomType.h60
-rw-r--r--c++/src/H5Attribute.cpp500
-rw-r--r--c++/src/H5Attribute.h94
-rw-r--r--c++/src/H5Classes.h52
-rw-r--r--c++/src/H5CommonFG.cpp413
-rw-r--r--c++/src/H5CommonFG.h68
-rw-r--r--c++/src/H5CompType.cpp582
-rw-r--r--c++/src/H5CompType.h126
-rw-r--r--c++/src/H5CppDoc.h18
-rw-r--r--c++/src/H5DataSet.cpp820
-rw-r--r--c++/src/H5DataSet.h120
-rw-r--r--c++/src/H5DataSpace.cpp793
-rw-r--r--c++/src/H5DataSpace.h152
-rw-r--r--c++/src/H5DataType.cpp928
-rw-r--r--c++/src/H5DataType.h156
-rw-r--r--c++/src/H5DcreatProp.cpp902
-rw-r--r--c++/src/H5DcreatProp.h138
-rw-r--r--c++/src/H5DxferProp.cpp578
-rw-r--r--c++/src/H5DxferProp.h126
-rw-r--r--c++/src/H5EnumType.cpp354
-rw-r--r--c++/src/H5EnumType.h72
-rw-r--r--c++/src/H5Exception.cpp650
-rw-r--r--c++/src/H5Exception.h154
-rw-r--r--c++/src/H5FaccProp.cpp862
-rw-r--r--c++/src/H5FaccProp.h164
-rw-r--r--c++/src/H5FcreatProp.cpp396
-rw-r--r--c++/src/H5FcreatProp.h94
-rw-r--r--c++/src/H5File.cpp662
-rw-r--r--c++/src/H5File.h126
-rw-r--r--c++/src/H5FloatType.cpp402
-rw-r--r--c++/src/H5FloatType.h66
-rw-r--r--c++/src/H5Group.cpp146
-rw-r--r--c++/src/H5Group.h58
-rw-r--r--c++/src/H5IdComponent.cpp408
-rw-r--r--c++/src/H5IdComponent.h112
-rw-r--r--c++/src/H5Include.h4
-rw-r--r--c++/src/H5IntType.cpp168
-rw-r--r--c++/src/H5IntType.h42
-rw-r--r--c++/src/H5LaccProp.cpp34
-rw-r--r--c++/src/H5LaccProp.h26
-rw-r--r--c++/src/H5Library.cpp200
-rw-r--r--c++/src/H5Library.h36
-rw-r--r--c++/src/H5Location.cpp1921
-rw-r--r--c++/src/H5Location.h298
-rw-r--r--c++/src/H5Object.cpp419
-rw-r--r--c++/src/H5Object.h136
-rw-r--r--c++/src/H5OcreatProp.cpp124
-rw-r--r--c++/src/H5OcreatProp.h42
-rw-r--r--c++/src/H5PredType.cpp453
-rw-r--r--c++/src/H5PredType.h328
-rw-r--r--c++/src/H5PropList.cpp769
-rw-r--r--c++/src/H5PropList.h142
-rw-r--r--c++/src/H5StrType.cpp326
-rw-r--r--c++/src/H5StrType.h56
-rw-r--r--c++/src/H5VarLenType.cpp96
-rw-r--r--c++/src/H5VarLenType.h32
-rw-r--r--c++/test/dsets.cpp1668
-rw-r--r--c++/test/h5cpputil.cpp142
-rw-r--r--c++/test/h5cpputil.h70
-rw-r--r--c++/test/tarray.cpp486
-rw-r--r--c++/test/tattr.cpp2062
-rw-r--r--c++/test/tcompound.cpp958
-rw-r--r--c++/test/tdspl.cpp124
-rw-r--r--c++/test/testhdf5.cpp88
-rw-r--r--c++/test/tfile.cpp846
-rw-r--r--c++/test/tfilter.cpp90
-rw-r--r--c++/test/th5s.cpp575
-rw-r--r--c++/test/titerate.cpp370
-rw-r--r--c++/test/tlinks.cpp312
-rw-r--r--c++/test/tobject.cpp500
-rw-r--r--c++/test/trefer.cpp1062
-rw-r--r--c++/test/ttypes.cpp622
-rw-r--r--c++/test/tvlstr.cpp1022
78 files changed, 14522 insertions, 14533 deletions
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp
index 9e76b55..621578e 100644
--- a/c++/src/H5AbstractDs.cpp
+++ b/c++/src/H5AbstractDs.cpp
@@ -34,16 +34,16 @@
namespace H5 {
//--------------------------------------------------------------------------
-// Function: AbstractDs default constructor
-///\brief Default constructor
-// Programmer Binh-Minh Ribler - 2000
+// Function: AbstractDs default constructor
+///\brief Default constructor
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
AbstractDs::AbstractDs(){}
//--------------------------------------------------------------------------
-// Function: AbstractDs default constructor
-///\brief Creates an AbstractDs instance using an existing id.
-// Programmer Binh-Minh Ribler - 2000
+// Function: AbstractDs default constructor
+///\brief Creates an AbstractDs instance using an existing id.
+// Programmer Binh-Minh Ribler - 2000
//
// *** Deprecation warning ***
// This constructor is no longer appropriate because the data member "id" had
@@ -54,275 +54,275 @@ AbstractDs::AbstractDs(){}
// Mar 2016 -BMR, AbstractDs::AbstractDs(const hid_t ds_id){}
//--------------------------------------------------------------------------
-// Function: AbstractDs::getTypeClass
-///\brief Returns the class of the datatype that is used by this
-/// object, which can be a dataset or an attribute.
-///\return Datatype class identifier
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: AbstractDs::getTypeClass
+///\brief Returns the class of the datatype that is used by this
+/// object, which can be a dataset or an attribute.
+///\return Datatype class identifier
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5T_class_t AbstractDs::getTypeClass() const
{
- // Gets the datatype used by this dataset or attribute.
- // p_get_type calls either H5Dget_type or H5Aget_type depending on
- // which object invokes getTypeClass
- hid_t datatype_id;
- try {
- datatype_id = p_get_type(); // returned value is already validated
- }
- catch (DataSetIException& E) {
- throw DataTypeIException("DataSet::getTypeClass", E.getDetailMsg());
- }
- catch (AttributeIException& E) {
- throw DataTypeIException("Attribute::getTypeClass", E.getDetailMsg());
- }
+ // Gets the datatype used by this dataset or attribute.
+ // p_get_type calls either H5Dget_type or H5Aget_type depending on
+ // which object invokes getTypeClass
+ hid_t datatype_id;
+ try {
+ datatype_id = p_get_type(); // returned value is already validated
+ }
+ catch (DataSetIException& E) {
+ throw DataTypeIException("DataSet::getTypeClass", E.getDetailMsg());
+ }
+ catch (AttributeIException& E) {
+ throw DataTypeIException("Attribute::getTypeClass", E.getDetailMsg());
+ }
- // Gets the class of the datatype and validate it before returning
- H5T_class_t type_class = H5Tget_class(datatype_id);
+ // Gets the class of the datatype and validate it before returning
+ H5T_class_t type_class = H5Tget_class(datatype_id);
- // Close temporary datatype_id
- herr_t ret_value = H5Tclose(datatype_id);
- if (ret_value < 0)
- {
- if (fromClass() == "DataSet")
- throw DataTypeIException("DataSet::getTypeClass", "H5Tclose failed");
- else if (fromClass() == "Attribute")
- throw DataTypeIException("Attribute::getTypeClass", "H5Tclose failed");
- }
+ // Close temporary datatype_id
+ herr_t ret_value = H5Tclose(datatype_id);
+ if (ret_value < 0)
+ {
+ if (fromClass() == "DataSet")
+ throw DataTypeIException("DataSet::getTypeClass", "H5Tclose failed");
+ else if (fromClass() == "Attribute")
+ throw DataTypeIException("Attribute::getTypeClass", "H5Tclose failed");
+ }
- // Check on the returned type_class
- if (type_class == H5T_NO_CLASS)
- {
- if (fromClass() == "DataSet")
- throw DataTypeIException("DataSet::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
- else if (fromClass() == "Attribute")
- throw DataTypeIException("Attribute::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
- }
- return(type_class);
+ // Check on the returned type_class
+ if (type_class == H5T_NO_CLASS)
+ {
+ if (fromClass() == "DataSet")
+ throw DataTypeIException("DataSet::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
+ else if (fromClass() == "Attribute")
+ throw DataTypeIException("Attribute::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
+ }
+ return(type_class);
}
//--------------------------------------------------------------------------
-// Function: AbstractDs::getDataType
-///\brief Returns the generic datatype of this abstract dataset, which
-/// can be a dataset or an attribute.
-///\return DataType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: AbstractDs::getDataType
+///\brief Returns the generic datatype of this abstract dataset, which
+/// can be a dataset or an attribute.
+///\return DataType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataType AbstractDs::getDataType() const
{
- // Gets the id of the datatype used by this dataset or attribute using
- // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
- // depending on which object invokes getDataType. Then, create and
- // return the DataType object
- try {
- DataType datatype;
- f_DataType_setId(&datatype, p_get_type());
- return(datatype);
- }
- catch (DataSetIException& E) {
- throw DataTypeIException("DataSet::getDataType", E.getDetailMsg());
- }
- catch (AttributeIException& E) {
- throw DataTypeIException("Attribute::getDataType", E.getDetailMsg());
- }
+ // Gets the id of the datatype used by this dataset or attribute using
+ // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
+ // depending on which object invokes getDataType. Then, create and
+ // return the DataType object
+ try {
+ DataType datatype;
+ f_DataType_setId(&datatype, p_get_type());
+ return(datatype);
+ }
+ catch (DataSetIException& E) {
+ throw DataTypeIException("DataSet::getDataType", E.getDetailMsg());
+ }
+ catch (AttributeIException& E) {
+ throw DataTypeIException("Attribute::getDataType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: AbstractDs::getArrayType
-///\brief Returns the array datatype of this abstract dataset which
-/// can be a dataset or an attribute.
-///\return ArrayType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Jul, 2005
+// Function: AbstractDs::getArrayType
+///\brief Returns the array datatype of this abstract dataset which
+/// can be a dataset or an attribute.
+///\return ArrayType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
ArrayType AbstractDs::getArrayType() const
{
- // Gets the id of the datatype used by this dataset or attribute using
- // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
- // depending on which object invokes getArrayType. Then, create and
- // return the ArrayType object
- try {
- // Create ArrayType and set values this way to work around the
- // problem described in the JIRA issue HDFFV-7947
- ArrayType arraytype;
- f_DataType_setId(&arraytype, p_get_type());
- return(arraytype);
- }
- catch (DataSetIException& E) {
- throw DataTypeIException("DataSet::getArrayType", E.getDetailMsg());
- }
- catch (AttributeIException& E) {
- throw DataTypeIException("Attribute::getArrayType", E.getDetailMsg());
- }
+ // Gets the id of the datatype used by this dataset or attribute using
+ // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
+ // depending on which object invokes getArrayType. Then, create and
+ // return the ArrayType object
+ try {
+ // Create ArrayType and set values this way to work around the
+ // problem described in the JIRA issue HDFFV-7947
+ ArrayType arraytype;
+ f_DataType_setId(&arraytype, p_get_type());
+ return(arraytype);
+ }
+ catch (DataSetIException& E) {
+ throw DataTypeIException("DataSet::getArrayType", E.getDetailMsg());
+ }
+ catch (AttributeIException& E) {
+ throw DataTypeIException("Attribute::getArrayType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: AbstractDs::getCompType
-///\brief Returns the compound datatype of this abstract dataset which
-/// can be a dataset or an attribute.
-///\return CompType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: AbstractDs::getCompType
+///\brief Returns the compound datatype of this abstract dataset which
+/// can be a dataset or an attribute.
+///\return CompType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
CompType AbstractDs::getCompType() const
{
- // Gets the id of the datatype used by this dataset or attribute using
- // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
- // depending on which object invokes getCompType. Then, create and
- // return the CompType object
- try {
- CompType comptype;
- f_DataType_setId(&comptype, p_get_type());
- return(comptype);
- }
- catch (DataSetIException& E) {
- throw DataTypeIException("DataSet::getCompType", E.getDetailMsg());
- }
- catch (AttributeIException& E) {
- throw DataTypeIException("Attribute::getCompType", E.getDetailMsg());
- }
+ // Gets the id of the datatype used by this dataset or attribute using
+ // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
+ // depending on which object invokes getCompType. Then, create and
+ // return the CompType object
+ try {
+ CompType comptype;
+ f_DataType_setId(&comptype, p_get_type());
+ return(comptype);
+ }
+ catch (DataSetIException& E) {
+ throw DataTypeIException("DataSet::getCompType", E.getDetailMsg());
+ }
+ catch (AttributeIException& E) {
+ throw DataTypeIException("Attribute::getCompType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: AbstractDs::getEnumType
-///\brief Returns the enumeration datatype of this abstract dataset which
-/// can be a dataset or an attribute.
-///\return EnumType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: AbstractDs::getEnumType
+///\brief Returns the enumeration datatype of this abstract dataset which
+/// can be a dataset or an attribute.
+///\return EnumType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
EnumType AbstractDs::getEnumType() const
{
- // Gets the id of the datatype used by this dataset or attribute using
- // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
- // depending on which object invokes getEnumType. Then, create and
- // return the EnumType object
- try {
- EnumType enumtype;
- f_DataType_setId(&enumtype, p_get_type());
- return(enumtype);
- }
- catch (DataSetIException& E) {
- throw DataTypeIException("DataSet::getEnumType", E.getDetailMsg());
- }
- catch (AttributeIException& E) {
- throw DataTypeIException("Attribute::getEnumType", E.getDetailMsg());
- }
+ // Gets the id of the datatype used by this dataset or attribute using
+ // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
+ // depending on which object invokes getEnumType. Then, create and
+ // return the EnumType object
+ try {
+ EnumType enumtype;
+ f_DataType_setId(&enumtype, p_get_type());
+ return(enumtype);
+ }
+ catch (DataSetIException& E) {
+ throw DataTypeIException("DataSet::getEnumType", E.getDetailMsg());
+ }
+ catch (AttributeIException& E) {
+ throw DataTypeIException("Attribute::getEnumType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: AbstractDs::getIntType
-///\brief Returns the integer datatype of this abstract dataset which
-/// can be a dataset or an attribute.
-///\return IntType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: AbstractDs::getIntType
+///\brief Returns the integer datatype of this abstract dataset which
+/// can be a dataset or an attribute.
+///\return IntType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
IntType AbstractDs::getIntType() const
{
- // Gets the id of the datatype used by this dataset or attribute using
- // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
- // depending on which object invokes getIntType. Then, create and
- // return the IntType object
- try {
- IntType inttype;
- f_DataType_setId(&inttype, p_get_type());
- return(inttype);
- }
- catch (DataSetIException& E) {
- throw DataTypeIException("DataSet::getIntType", E.getDetailMsg());
- }
- catch (AttributeIException& E) {
- throw DataTypeIException("Attribute::getIntType", E.getDetailMsg());
- }
+ // Gets the id of the datatype used by this dataset or attribute using
+ // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
+ // depending on which object invokes getIntType. Then, create and
+ // return the IntType object
+ try {
+ IntType inttype;
+ f_DataType_setId(&inttype, p_get_type());
+ return(inttype);
+ }
+ catch (DataSetIException& E) {
+ throw DataTypeIException("DataSet::getIntType", E.getDetailMsg());
+ }
+ catch (AttributeIException& E) {
+ throw DataTypeIException("Attribute::getIntType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: AbstractDs::getFloatType
-///\brief Returns the floating-point datatype of this abstract dataset,
-/// which can be a dataset or an attribute.
-///\return FloatType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: AbstractDs::getFloatType
+///\brief Returns the floating-point datatype of this abstract dataset,
+/// which can be a dataset or an attribute.
+///\return FloatType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
FloatType AbstractDs::getFloatType() const
{
- // Gets the id of the datatype used by this dataset or attribute using
- // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
- // depending on which object invokes getFloatType. Then, create and
- // return the FloatType object
- try {
- FloatType floatype;
- f_DataType_setId(&floatype, p_get_type());
- return(floatype);
- }
- catch (DataSetIException& E) {
- throw DataTypeIException("DataSet::getFloatType", E.getDetailMsg());
- }
- catch (AttributeIException& E) {
- throw DataTypeIException("Attribute::getFloatType", E.getDetailMsg());
- }
+ // Gets the id of the datatype used by this dataset or attribute using
+ // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
+ // depending on which object invokes getFloatType. Then, create and
+ // return the FloatType object
+ try {
+ FloatType floatype;
+ f_DataType_setId(&floatype, p_get_type());
+ return(floatype);
+ }
+ catch (DataSetIException& E) {
+ throw DataTypeIException("DataSet::getFloatType", E.getDetailMsg());
+ }
+ catch (AttributeIException& E) {
+ throw DataTypeIException("Attribute::getFloatType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: AbstractDs::getStrType
-///\brief Returns the string datatype of this abstract dataset which
-/// can be a dataset or an attribute.
-///\return StrType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: AbstractDs::getStrType
+///\brief Returns the string datatype of this abstract dataset which
+/// can be a dataset or an attribute.
+///\return StrType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
StrType AbstractDs::getStrType() const
{
- // Gets the id of the datatype used by this dataset or attribute using
- // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
- // depending on which object invokes getStrType. Then, create and
- // return the StrType object
- try {
- StrType strtype;
- f_DataType_setId(&strtype, p_get_type());
- return(strtype);
- }
- catch (DataSetIException& E) {
- throw DataTypeIException("DataSet::getStrType", E.getDetailMsg());
- }
- catch (AttributeIException& E) {
- throw DataTypeIException("Attribute::getStrType", E.getDetailMsg());
- }
+ // Gets the id of the datatype used by this dataset or attribute using
+ // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
+ // depending on which object invokes getStrType. Then, create and
+ // return the StrType object
+ try {
+ StrType strtype;
+ f_DataType_setId(&strtype, p_get_type());
+ return(strtype);
+ }
+ catch (DataSetIException& E) {
+ throw DataTypeIException("DataSet::getStrType", E.getDetailMsg());
+ }
+ catch (AttributeIException& E) {
+ throw DataTypeIException("Attribute::getStrType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: AbstractDs::getVarLenType
-///\brief Returns the floating-point datatype of this abstract dataset,
-/// which can be a dataset or an attribute.
-///\return VarLenType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Jul, 2005
+// Function: AbstractDs::getVarLenType
+///\brief Returns the floating-point datatype of this abstract dataset,
+/// which can be a dataset or an attribute.
+///\return VarLenType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
VarLenType AbstractDs::getVarLenType() const
{
- // Gets the id of the datatype used by this dataset or attribute using
- // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
- // depending on which object invokes getVarLenType. Then, create and
- // return the VarLenType object
- try {
- VarLenType varlentype;
- f_DataType_setId(&varlentype, p_get_type());
- return(varlentype);
- }
- catch (DataSetIException& E) {
- throw DataTypeIException("DataSet::getVarLenType", E.getDetailMsg());
- }
- catch (AttributeIException& E) {
- throw DataTypeIException("Attribute::getVarLenType", E.getDetailMsg());
- }
+ // Gets the id of the datatype used by this dataset or attribute using
+ // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
+ // depending on which object invokes getVarLenType. Then, create and
+ // return the VarLenType object
+ try {
+ VarLenType varlentype;
+ f_DataType_setId(&varlentype, p_get_type());
+ return(varlentype);
+ }
+ catch (DataSetIException& E) {
+ throw DataTypeIException("DataSet::getVarLenType", E.getDetailMsg());
+ }
+ catch (AttributeIException& E) {
+ throw DataTypeIException("Attribute::getVarLenType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: AbstractDs destructor
-///\brief Noop destructor.
-// Programmer Binh-Minh Ribler - 2000
+// Function: AbstractDs destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
AbstractDs::~AbstractDs() {}
diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h
index 1b4775c..eaa9d14 100644
--- a/c++/src/H5AbstractDs.h
+++ b/c++/src/H5AbstractDs.h
@@ -37,44 +37,44 @@ class DataSpace;
*/
class H5_DLLCPP AbstractDs {
public:
- // Gets a copy the datatype of that this abstract dataset uses.
- // Note that this datatype is a generic one and can only be accessed
- // via generic member functions, i.e., member functions belong
- // to DataType. To get specific datatype, i.e. EnumType, FloatType,
- // etc..., use the specific functions, that follow, instead.
- DataType getDataType() const;
+ // Gets a copy the datatype of that this abstract dataset uses.
+ // Note that this datatype is a generic one and can only be accessed
+ // via generic member functions, i.e., member functions belong
+ // to DataType. To get specific datatype, i.e. EnumType, FloatType,
+ // etc..., use the specific functions, that follow, instead.
+ DataType getDataType() const;
- // Gets a copy of the specific datatype of this abstract dataset.
- ArrayType getArrayType() const;
- CompType getCompType() const;
- EnumType getEnumType() const;
- IntType getIntType() const;
- FloatType getFloatType() const;
- StrType getStrType() const;
- VarLenType getVarLenType() const;
+ // Gets a copy of the specific datatype of this abstract dataset.
+ ArrayType getArrayType() const;
+ CompType getCompType() const;
+ EnumType getEnumType() const;
+ IntType getIntType() const;
+ FloatType getFloatType() const;
+ StrType getStrType() const;
+ VarLenType getVarLenType() const;
- ///\brief Gets the size in memory of this abstract dataset.
- virtual size_t getInMemDataSize() const = 0;
+ ///\brief Gets the size in memory of this abstract dataset.
+ virtual size_t getInMemDataSize() const = 0;
- ///\brief Gets the dataspace of this abstract dataset - pure virtual.
- virtual DataSpace getSpace() const = 0;
+ ///\brief Gets the dataspace of this abstract dataset - pure virtual.
+ virtual DataSpace getSpace() const = 0;
- // Gets the class of the datatype that is used by this abstract
- // dataset.
- H5T_class_t getTypeClass() const;
+ // Gets the class of the datatype that is used by this abstract
+ // dataset.
+ H5T_class_t getTypeClass() const;
- ///\brief Returns the amount of storage size required - pure virtual.
- virtual hsize_t getStorageSize() const = 0;
+ ///\brief Returns the amount of storage size required - pure virtual.
+ virtual hsize_t getStorageSize() const = 0;
- // Returns this class name - pure virtual.
- virtual H5std_string fromClass() const = 0;
+ // Returns this class name - pure virtual.
+ virtual H5std_string fromClass() const = 0;
- // Destructor
- virtual ~AbstractDs();
+ // Destructor
+ virtual ~AbstractDs();
protected:
- // Default constructor
- AbstractDs();
+ // Default constructor
+ AbstractDs();
// *** Deprecation warning ***
// The following two constructors are no longer appropriate after the
@@ -83,14 +83,14 @@ class H5_DLLCPP AbstractDs {
// other will be removed from 1.10 release, and then from 1.8 if its
// removal does not raise any problems in two 1.10 releases.
- // Mar 2016 -BMR, AbstractDs(const hid_t h5_id);
+ // Mar 2016 -BMR, AbstractDs(const hid_t h5_id);
- // Copy constructor
- // AbstractDs( const AbstractDs& original );
+ // Copy constructor
+ // AbstractDs( const AbstractDs& original );
private:
- // This member function is implemented by DataSet and Attribute - pure virtual.
- virtual hid_t p_get_type() const = 0;
+ // This member function is implemented by DataSet and Attribute - pure virtual.
+ virtual hid_t p_get_type() const = 0;
};
}
#endif // __AbstractDs_H
diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp
index ecce591..3cdcc0a 100644
--- a/c++/src/H5ArrayType.cpp
+++ b/c++/src/H5ArrayType.cpp
@@ -30,95 +30,95 @@
namespace H5 {
//--------------------------------------------------------------------------
-// Function: ArrayType default constructor
-///\brief Default constructor: Creates a stub ArrayType
-// Programmer Binh-Minh Ribler - May 2004
+// Function: ArrayType default constructor
+///\brief Default constructor: Creates a stub ArrayType
+// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
ArrayType::ArrayType() : DataType() {}
//--------------------------------------------------------------------------
-// Function: ArrayType overloaded constructor
-///\brief Creates an ArrayType object using an existing id.
-///\param existing_id - IN: Id of an existing datatype
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - May 2004
+// Function: ArrayType overloaded constructor
+///\brief Creates an ArrayType object using an existing id.
+///\param existing_id - IN: Id of an existing datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
-ArrayType::ArrayType( const hid_t existing_id ) : DataType( existing_id ) {}
+ArrayType::ArrayType(const hid_t existing_id) : DataType(existing_id) {}
//--------------------------------------------------------------------------
-// Function: ArrayType copy constructor
-///\brief Copy constructor: makes a copy of the original ArrayType object.
-// Programmer Binh-Minh Ribler - May 2004
+// Function: ArrayType copy constructor
+///\brief Copy constructor: makes a copy of the original ArrayType object.
+// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
ArrayType::ArrayType(const ArrayType& original) : DataType(original) {}
//--------------------------------------------------------------------------
-// Function: ArrayType overloaded constructor
-///\brief Creates a new array data type based on the specified
-/// \a base_type.
-///\param base_type - IN: Existing datatype
-///\param ndims - IN: Rank of the array, [0..H5S_MAX_RANK]
-///\param dims - IN: Size of each array dimension
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - May 2004
+// Function: ArrayType overloaded constructor
+///\brief Creates a new array data type based on the specified
+/// \a base_type.
+///\param base_type - IN: Existing datatype
+///\param ndims - IN: Rank of the array, [0..H5S_MAX_RANK]
+///\param dims - IN: Size of each array dimension
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims) : DataType()
{
// Call C API to create an array data type
hid_t new_type_id = H5Tarray_create2(base_type.getId(), ndims, dims);
if (new_type_id < 0)
- throw DataTypeIException("ArrayType constructor", "H5Tarray_create2 failed");
+ throw DataTypeIException("ArrayType constructor", "H5Tarray_create2 failed");
// Set the id for this object
id = new_type_id;
}
//--------------------------------------------------------------------------
-// Function: ArrayType overloaded constructor
-///\brief Creates an ArrayType instance by opening an HDF5 array datatype
-/// given its name, provided as a C character string.
-///\param dtype_name - IN: Array type name
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Dec 2016
+// Function: ArrayType overloaded constructor
+///\brief Creates an ArrayType instance by opening an HDF5 array datatype
+/// given its name, provided as a C character string.
+///\param dtype_name - IN: Array type name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openArrayType(const char*) to
-// improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openArrayType(const char*) to
+// improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
ArrayType::ArrayType(const H5Location& loc, const char *dtype_name) : DataType()
{
- id = p_opentype(loc, dtype_name);
+ id = p_opentype(loc, dtype_name);
}
//--------------------------------------------------------------------------
-// Function: ArrayType overloaded constructor
-///\brief Creates an ArrayType instance by opening an HDF5 array datatype
-/// given its name, provided as an \c H5std_string.
-///\param dtype_name - IN: Array type name
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Dec 2016
+// Function: ArrayType overloaded constructor
+///\brief Creates an ArrayType instance by opening an HDF5 array datatype
+/// given its name, provided as an \c H5std_string.
+///\param dtype_name - IN: Array type name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openArrayType(const H5std_string&)
-// to improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openArrayType(const H5std_string&)
+// to improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
ArrayType::ArrayType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
{
- id = p_opentype(loc, dtype_name.c_str());
+ id = p_opentype(loc, dtype_name.c_str());
}
//--------------------------------------------------------------------------
-// Function: ArrayType::operator=
-///\brief Assignment operator
-///\param rhs - IN: Reference to the existing array datatype
-///\return Reference to ArrayType instance
-///\exception H5::DataTypeIException
+// Function: ArrayType::operator=
+///\brief Assignment operator
+///\param rhs - IN: Reference to the existing array datatype
+///\return Reference to ArrayType instance
+///\exception H5::DataTypeIException
// Description
-// Closes the id on the lhs object first with setId, then copies
-// each data member from the rhs object. (Issue HDFFV-9562)
-// Programmer Binh-Minh Ribler - Mar 2016
+// Closes the id on the lhs object first with setId, then copies
+// each data member from the rhs object. (Issue HDFFV-9562)
+// Programmer Binh-Minh Ribler - Mar 2016
// Modification
//--------------------------------------------------------------------------
ArrayType& ArrayType::operator=(const ArrayType& rhs)
@@ -139,14 +139,14 @@ ArrayType& ArrayType::operator=(const ArrayType& rhs)
}
//--------------------------------------------------------------------------
-// Function: ArrayType::getArrayNDims
-///\brief Returns the number of dimensions for an array datatype.
-///\return Number of dimensions
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - May 2004
+// Function: ArrayType::getArrayNDims
+///\brief Returns the number of dimensions for an array datatype.
+///\return Number of dimensions
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - May 2004
// Modification
-// Apr, 2016
-// Became const.
+// Apr, 2016
+// Became const.
//--------------------------------------------------------------------------
int ArrayType::getArrayNDims() const
{
@@ -154,38 +154,38 @@ int ArrayType::getArrayNDims() const
int ndims = H5Tget_array_ndims(id);
if (ndims < 0)
{
- throw DataTypeIException("ArrayType::getArrayNDims", "H5Tget_array_ndims failed");
+ throw DataTypeIException("ArrayType::getArrayNDims", "H5Tget_array_ndims failed");
}
return(ndims);
}
//--------------------------------------------------------------------------
-// Function: ArrayType::getArrayDims
-///\brief Retrieves the size of all dimensions of an array datatype.
-///\param dims - OUT: Sizes of dimensions
-///\return Number of dimensions
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - May 2004
+// Function: ArrayType::getArrayDims
+///\brief Retrieves the size of all dimensions of an array datatype.
+///\param dims - OUT: Sizes of dimensions
+///\return Number of dimensions
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - May 2004
// Modification
-// Apr, 2016
-// Became const.
+// Apr, 2016
+// Became const.
//--------------------------------------------------------------------------
int ArrayType::getArrayDims(hsize_t* dims) const
{
// Get the dimensions
int ndims = H5Tget_array_dims2(id, dims);
if (ndims < 0)
- throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed");
+ throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed");
// Return the number of dimensions
return(ndims);
}
//--------------------------------------------------------------------------
-// Function: ArrayType destructor
-///\brief Properly terminates access to this array datatype.
-// Programmer Binh-Minh Ribler - May 2004
+// Function: ArrayType destructor
+///\brief Properly terminates access to this array datatype.
+// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
ArrayType::~ArrayType() {}
diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h
index 65917ae..15b6bb3 100644
--- a/c++/src/H5ArrayType.h
+++ b/c++/src/H5ArrayType.h
@@ -27,39 +27,39 @@ namespace H5 {
*/
class H5_DLLCPP ArrayType : public DataType {
public:
- // Constructor that creates a new array data type based on the
- // specified base type.
- ArrayType(const DataType& base_type, int ndims, const hsize_t* dims);
+ // Constructor that creates a new array data type based on the
+ // specified base type.
+ ArrayType(const DataType& base_type, int ndims, const hsize_t* dims);
- // Assignment operator
- ArrayType& operator=(const ArrayType& rhs);
+ // Assignment operator
+ ArrayType& operator=(const ArrayType& rhs);
- // Constructors that open an array datatype, given a location.
- ArrayType(const H5Location& loc, const char* name);
- ArrayType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open an array datatype, given a location.
+ ArrayType(const H5Location& loc, const char* name);
+ ArrayType(const H5Location& loc, const H5std_string& name);
- // Returns the number of dimensions of this array datatype.
- int getArrayNDims() const;
- //int getArrayNDims(); // removed 1.8.18 and 1.10.1
+ // Returns the number of dimensions of this array datatype.
+ int getArrayNDims() const;
+ //int getArrayNDims(); // removed 1.8.18 and 1.10.1
- // Returns the sizes of dimensions of this array datatype.
- int getArrayDims(hsize_t* dims) const;
- //int getArrayDims(hsize_t* dims); // removed 1.8.18 and 1.10.1
+ // Returns the sizes of dimensions of this array datatype.
+ int getArrayDims(hsize_t* dims) const;
+ //int getArrayDims(hsize_t* dims); // removed 1.8.18 and 1.10.1
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("ArrayType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("ArrayType"); }
- // Copy constructor: makes copy of the original object.
- ArrayType( const ArrayType& original );
+ // Copy constructor: makes copy of the original object.
+ ArrayType(const ArrayType& original);
- // Constructor that takes an existing id
- ArrayType( const hid_t existing_id );
+ // Constructor that takes an existing id
+ ArrayType(const hid_t existing_id);
- // Noop destructor
- virtual ~ArrayType();
+ // Noop destructor
+ virtual ~ArrayType();
- // Default constructor
- ArrayType();
+ // Default constructor
+ ArrayType();
};
}
#endif // __H5ArrayType_H
diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp
index 22b163a..0dc2b1e 100644
--- a/c++/src/H5AtomType.cpp
+++ b/c++/src/H5AtomType.cpp
@@ -31,265 +31,265 @@ namespace H5 {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: AtomType default constructor [protected]
-// Purpose Default constructor: creates a stub atomic datatype.
-// Programmer Binh-Minh Ribler - 2000
+// Function: AtomType default constructor [protected]
+// Purpose Default constructor: creates a stub atomic datatype.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
AtomType::AtomType() : DataType() {}
//--------------------------------------------------------------------------
-// Function: AtomType overloaded constructor [protected]
-// Purpose Creates an AtomType object using an existing id.
-// Parameter existing_id - IN: Id of an existing datatype
-// Exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: AtomType overloaded constructor [protected]
+// Purpose Creates an AtomType object using an existing id.
+// Parameter existing_id - IN: Id of an existing datatype
+// Exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-AtomType::AtomType( const hid_t existing_id ) : DataType( existing_id ) {}
+AtomType::AtomType(const hid_t existing_id) : DataType(existing_id) {}
//--------------------------------------------------------------------------
-// Function: AtomType copy constructor
-///\brief Copy constructor: makes a copy of the original AtomType object.
-// Programmer Binh-Minh Ribler - 2000
+// Function: AtomType copy constructor
+///\brief Copy constructor: makes a copy of the original AtomType object.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-AtomType::AtomType( const AtomType& original ) : DataType( original ) {}
+AtomType::AtomType(const AtomType& original) : DataType(original) {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: AtomType::setSize
-///\brief Sets the total size for an atomic datatype.
-///\param size - IN: Size to set
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: AtomType::setSize
+///\brief Sets the total size for an atomic datatype.
+///\param size - IN: Size to set
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::setSize( size_t size ) const
+void AtomType::setSize(size_t size) const
{
- // Call C routine H5Tset_size to set the total size
- herr_t ret_value = H5Tset_size( id, size );
- if( ret_value < 0 )
- {
- throw DataTypeIException(inMemFunc("setSize"), "H5Tset_size failed");
- }
+ // Call C routine H5Tset_size to set the total size
+ herr_t ret_value = H5Tset_size(id, size);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException(inMemFunc("setSize"), "H5Tset_size failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: AtomType::getOrder
-///\brief Returns the byte order of an atomic datatype.
-///\return Byte order, which can be:
-/// \li \c H5T_ORDER_LE
-/// \li \c H5T_ORDER_BE
-/// \li \c H5T_ORDER_VAX
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Mar, 2005
+// Function: AtomType::getOrder
+///\brief Returns the byte order of an atomic datatype.
+///\return Byte order, which can be:
+/// \li \c H5T_ORDER_LE
+/// \li \c H5T_ORDER_BE
+/// \li \c H5T_ORDER_VAX
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
H5T_order_t AtomType::getOrder() const
{
- // Call C routine to get the byte ordering
- H5T_order_t type_order = H5Tget_order( id );
+ // Call C routine to get the byte ordering
+ H5T_order_t type_order = H5Tget_order(id);
- // return a byte order constant if successful
- if( type_order == H5T_ORDER_ERROR )
- {
- throw DataTypeIException(inMemFunc("getOrder"),
- "H5Tget_order returns H5T_ORDER_ERROR");
- }
- return( type_order );
+ // return a byte order constant if successful
+ if (type_order == H5T_ORDER_ERROR)
+ {
+ throw DataTypeIException(inMemFunc("getOrder"),
+ "H5Tget_order returns H5T_ORDER_ERROR");
+ }
+ return(type_order);
}
//--------------------------------------------------------------------------
-// Function: AtomType::getOrder
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes a reference to a \c H5std_string for the buffer that
-/// provide the text description of the returned byte order.
-/// The text description can be either of the following:
-/// "Little endian byte ordering (0)";
-/// "Big endian byte ordering (1)";
-/// "VAX mixed byte ordering (2)";
-///\param order_string - OUT: Text description of the returned byte order
-///\return Byte order, which can be:
-/// \li \c H5T_ORDER_LE
-/// \li \c H5T_ORDER_BE
-/// \li \c H5T_ORDER_VAX
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: AtomType::getOrder
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes a reference to a \c H5std_string for the buffer that
+/// provide the text description of the returned byte order.
+/// The text description can be either of the following:
+/// "Little endian byte ordering (0)";
+/// "Big endian byte ordering (1)";
+/// "VAX mixed byte ordering (2)";
+///\param order_string - OUT: Text description of the returned byte order
+///\return Byte order, which can be:
+/// \li \c H5T_ORDER_LE
+/// \li \c H5T_ORDER_BE
+/// \li \c H5T_ORDER_VAX
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_order_t AtomType::getOrder( H5std_string& order_string ) const
+H5T_order_t AtomType::getOrder(H5std_string& order_string) const
{
- // Call the overloaded to get the type order without text
- H5T_order_t type_order = getOrder();
+ // Call the overloaded to get the type order without text
+ H5T_order_t type_order = getOrder();
- // Then provide the text and return the type order
- if( type_order == H5T_ORDER_LE )
- order_string = "Little endian byte ordering (0)";
- else if( type_order == H5T_ORDER_BE )
- order_string = "Big endian byte ordering (1)";
- else if( type_order == H5T_ORDER_VAX )
- order_string = "VAX mixed byte ordering (2)";
- return( type_order );
+ // Then provide the text and return the type order
+ if (type_order == H5T_ORDER_LE)
+ order_string = "Little endian byte ordering (0)";
+ else if (type_order == H5T_ORDER_BE)
+ order_string = "Big endian byte ordering (1)";
+ else if (type_order == H5T_ORDER_VAX)
+ order_string = "VAX mixed byte ordering (2)";
+ return(type_order);
}
//--------------------------------------------------------------------------
-// Function: AtomType::setOrder
-///\brief Sets the byte ordering of an atomic datatype.
-///\param order - IN: Byte ordering constant, which can be:
-/// \li \c H5T_ORDER_LE
-/// \li \c H5T_ORDER_BE
-/// \li \c H5T_ORDER_VAX
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: AtomType::setOrder
+///\brief Sets the byte ordering of an atomic datatype.
+///\param order - IN: Byte ordering constant, which can be:
+/// \li \c H5T_ORDER_LE
+/// \li \c H5T_ORDER_BE
+/// \li \c H5T_ORDER_VAX
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::setOrder( H5T_order_t order ) const
+void AtomType::setOrder(H5T_order_t order) const
{
- // Call C routine to set the byte ordering
- herr_t ret_value = H5Tset_order( id, order );
- if( ret_value < 0 )
- {
- throw DataTypeIException(inMemFunc("setOrder"), "H5Tset_order failed");
- }
+ // Call C routine to set the byte ordering
+ herr_t ret_value = H5Tset_order(id, order);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException(inMemFunc("setOrder"), "H5Tset_order failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: AtomType::getPrecision
-///\brief Returns the precision of an atomic datatype.
-///\return Number of significant bits
-///\exception H5::DataTypeIException
+// Function: AtomType::getPrecision
+///\brief Returns the precision of an atomic datatype.
+///\return Number of significant bits
+///\exception H5::DataTypeIException
///\par Description
-/// The precision is the number of significant bits which,
-/// unless padding is present, is 8 times larger than the
-/// value returned by \c DataType::getSize().
-// Programmer Binh-Minh Ribler - 2000
+/// The precision is the number of significant bits which,
+/// unless padding is present, is 8 times larger than the
+/// value returned by \c DataType::getSize().
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
size_t AtomType::getPrecision() const
{
- size_t num_signi_bits = H5Tget_precision( id ); // C routine
+ size_t num_signi_bits = H5Tget_precision(id); // C routine
- // returns number of significant bits if successful
- if( num_signi_bits == 0 )
- {
- throw DataTypeIException(inMemFunc("getPrecision"),
- "H5Tget_precision returns invalid number of significant bits");
- }
- return( num_signi_bits );
+ // returns number of significant bits if successful
+ if (num_signi_bits == 0)
+ {
+ throw DataTypeIException(inMemFunc("getPrecision"),
+ "H5Tget_precision returns invalid number of significant bits");
+ }
+ return(num_signi_bits);
}
//--------------------------------------------------------------------------
-// Function: AtomType::setPrecision
-///\brief Sets the precision of an atomic datatype.
-///\param precision - IN: Number of bits of precision
-///\exception H5::DataTypeIException
+// Function: AtomType::setPrecision
+///\brief Sets the precision of an atomic datatype.
+///\param precision - IN: Number of bits of precision
+///\exception H5::DataTypeIException
///\par Description
-/// For information, please see C layer Reference Manuat at:
+/// For information, please see C layer Reference Manuat at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetPrecision
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::setPrecision( size_t precision ) const
+void AtomType::setPrecision(size_t precision) const
{
- // Call C routine to set the datatype precision
- herr_t ret_value = H5Tset_precision( id, precision );
- if( ret_value < 0 )
- {
- throw DataTypeIException(inMemFunc("setPrecision"), "H5Tset_precision failed");
- }
+ // Call C routine to set the datatype precision
+ herr_t ret_value = H5Tset_precision(id, precision);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException(inMemFunc("setPrecision"), "H5Tset_precision failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: AtomType::getOffset
-///\brief Retrieves the bit offset of the first significant bit.
-///\return Offset value
-///\exception H5::DataTypeIException
+// Function: AtomType::getOffset
+///\brief Retrieves the bit offset of the first significant bit.
+///\return Offset value
+///\exception H5::DataTypeIException
///\par Description
-/// For information, please see C layer Reference Manuat at:
+/// For information, please see C layer Reference Manuat at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetOffset
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// 12/05/00: due to C API change
-// - return type changed from size_t to int
-// - offset = -1 when failure occurs vs. 0
+// 12/05/00: due to C API change
+// - return type changed from size_t to int
+// - offset = -1 when failure occurs vs. 0
//--------------------------------------------------------------------------
int AtomType::getOffset() const
{
- int offset = H5Tget_offset( id ); // C routine
+ int offset = H5Tget_offset(id); // C routine
- // returns a non-negative offset value if successful
- if( offset == -1 )
- {
- throw DataTypeIException(inMemFunc("getOffset"),
- "H5Tget_offset returns a negative offset value");
- }
- return( offset );
+ // returns a non-negative offset value if successful
+ if (offset == -1)
+ {
+ throw DataTypeIException(inMemFunc("getOffset"),
+ "H5Tget_offset returns a negative offset value");
+ }
+ return(offset);
}
//--------------------------------------------------------------------------
-// Function: AtomType::setOffset
-///\brief Sets the bit offset of the first significant bit.
-///\param offset - IN: Offset of first significant bit
-///\exception H5::DataTypeIException
+// Function: AtomType::setOffset
+///\brief Sets the bit offset of the first significant bit.
+///\param offset - IN: Offset of first significant bit
+///\exception H5::DataTypeIException
///\par Description
-/// For information, please see C layer Reference Manuat at:
+/// For information, please see C layer Reference Manuat at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetOffset
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::setOffset( size_t offset ) const
+void AtomType::setOffset(size_t offset) const
{
- // Call C routine to set the bit offset
- herr_t ret_value = H5Tset_offset( id, offset );
- if( ret_value < 0 )
- {
- throw DataTypeIException(inMemFunc("setOffset"), "H5Tset_offset failed");
- }
+ // Call C routine to set the bit offset
+ herr_t ret_value = H5Tset_offset(id, offset);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException(inMemFunc("setOffset"), "H5Tset_offset failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: AtomType::getPad
-///\brief Retrieves the padding type of the least and most-significant
-/// bit padding.
-///\param lsb - OUT: Least-significant bit padding type
-///\param msb - OUT: Most-significant bit padding type
-///\exception H5::DataTypeIException
+// Function: AtomType::getPad
+///\brief Retrieves the padding type of the least and most-significant
+/// bit padding.
+///\param lsb - OUT: Least-significant bit padding type
+///\param msb - OUT: Most-significant bit padding type
+///\exception H5::DataTypeIException
///\par Description
-/// Possible values for \a lsb and \a msb include:
-/// \li \c H5T_PAD_ZERO (0) - Set background to zeros.
-/// \li \c H5T_PAD_ONE (1) - Set background to ones.
-/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone.
-// Programmer Binh-Minh Ribler - 2000
+/// Possible values for \a lsb and \a msb include:
+/// \li \c H5T_PAD_ZERO (0) - Set background to zeros.
+/// \li \c H5T_PAD_ONE (1) - Set background to ones.
+/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::getPad( H5T_pad_t& lsb, H5T_pad_t& msb ) const
+void AtomType::getPad(H5T_pad_t& lsb, H5T_pad_t& msb) const
{
- // Call C routine to get the padding type
- herr_t ret_value = H5Tget_pad( id, &lsb, &msb );
- if( ret_value < 0 )
- {
- throw DataTypeIException(inMemFunc("getPad"), "H5Tget_pad failed");
- }
+ // Call C routine to get the padding type
+ herr_t ret_value = H5Tget_pad(id, &lsb, &msb);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException(inMemFunc("getPad"), "H5Tget_pad failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: AtomType::setPad
-///\brief Sets the least and most-significant bits padding types.
-///\param lsb - IN: Least-significant bit padding type
-///\param msb - IN: Most-significant bit padding type
-///\exception H5::DataTypeIException
+// Function: AtomType::setPad
+///\brief Sets the least and most-significant bits padding types.
+///\param lsb - IN: Least-significant bit padding type
+///\param msb - IN: Most-significant bit padding type
+///\exception H5::DataTypeIException
///\par Description
-/// Valid values for \a lsb and \a msb include:
-/// \li \c H5T_PAD_ZERO (0) - Set background to zeros.
-/// \li \c H5T_PAD_ONE (1) - Set background to ones.
-/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone.
-// Programmer Binh-Minh Ribler - 2000
+/// Valid values for \a lsb and \a msb include:
+/// \li \c H5T_PAD_ZERO (0) - Set background to zeros.
+/// \li \c H5T_PAD_ONE (1) - Set background to ones.
+/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void AtomType::setPad( H5T_pad_t lsb, H5T_pad_t msb ) const
+void AtomType::setPad(H5T_pad_t lsb, H5T_pad_t msb) const
{
- // Call C routine to set the padding type
- herr_t ret_value = H5Tset_pad( id, lsb, msb );
- if( ret_value < 0 )
- {
- throw DataTypeIException(inMemFunc("setPad"), "H5Tset_pad failed");
- }
+ // Call C routine to set the padding type
+ herr_t ret_value = H5Tset_pad(id, lsb, msb);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException(inMemFunc("setPad"), "H5Tset_pad failed");
+ }
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: AtomType destructor
-///\brief Noop destructor.
-// Programmer Binh-Minh Ribler - 2000
+// Function: AtomType destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
AtomType::~AtomType() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5AtomType.h b/c++/src/H5AtomType.h
index d84b53f..a1e0262 100644
--- a/c++/src/H5AtomType.h
+++ b/c++/src/H5AtomType.h
@@ -30,53 +30,53 @@ namespace H5 {
*/
class H5_DLLCPP AtomType : public DataType {
public:
- // Returns the byte order of an atomic datatype.
- H5T_order_t getOrder() const;
- H5T_order_t getOrder( H5std_string& order_string ) const;
+ // Returns the byte order of an atomic datatype.
+ H5T_order_t getOrder() const;
+ H5T_order_t getOrder(H5std_string& order_string) const;
- // Sets the byte ordering of an atomic datatype.
- void setOrder( H5T_order_t order ) const;
+ // Sets the byte ordering of an atomic datatype.
+ void setOrder(H5T_order_t order) const;
- // Retrieves the bit offset of the first significant bit.
- // 12/05/00 - changed return type to int from size_t - C API
- int getOffset() const;
+ // Retrieves the bit offset of the first significant bit.
+ // 12/05/00 - changed return type to int from size_t - C API
+ int getOffset() const;
- // Sets the bit offset of the first significant bit.
- void setOffset( size_t offset ) const;
+ // Sets the bit offset of the first significant bit.
+ void setOffset(size_t offset) const;
- // Retrieves the padding type of the least and most-significant bit padding.
- void getPad( H5T_pad_t& lsb, H5T_pad_t& msb ) const;
+ // Retrieves the padding type of the least and most-significant bit padding.
+ void getPad(H5T_pad_t& lsb, H5T_pad_t& msb) const;
- // Sets the least and most-significant bits padding types
- void setPad( H5T_pad_t lsb, H5T_pad_t msb ) const;
+ // Sets the least and most-significant bits padding types
+ void setPad(H5T_pad_t lsb, H5T_pad_t msb) const;
- // Returns the precision of an atomic datatype.
- size_t getPrecision() const;
+ // Returns the precision of an atomic datatype.
+ size_t getPrecision() const;
- // Sets the precision of an atomic datatype.
- void setPrecision( size_t precision ) const;
+ // Sets the precision of an atomic datatype.
+ void setPrecision(size_t precision) const;
- // Sets the total size for an atomic datatype.
- void setSize( size_t size ) const;
+ // Sets the total size for an atomic datatype.
+ void setSize(size_t size) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("AtomType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("AtomType"); }
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Copy constructor - makes copy of the original object
- AtomType( const AtomType& original );
+ // Copy constructor - makes copy of the original object
+ AtomType(const AtomType& original);
- // Noop destructor
- virtual ~AtomType();
+ // Noop destructor
+ virtual ~AtomType();
#endif // DOXYGEN_SHOULD_SKIP_THIS
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Default constructor
- AtomType();
+ // Default constructor
+ AtomType();
- // Constructor that takes an existing id
- AtomType( const hid_t existing_id );
+ // Constructor that takes an existing id
+ AtomType(const hid_t existing_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
};
}
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index dfd2b28..6701f6e 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -1,7 +1,7 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
+/* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
@@ -20,7 +20,7 @@
#endif
#include <string>
-#include "H5private.h" // for HDfree
+#include "H5private.h" // for HDfree
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -44,17 +44,17 @@ using std::endl;
class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate
//--------------------------------------------------------------------------
-// Function: Attribute default constructor
-///\brief Default constructor: Creates a stub attribute
-// Programmer Binh-Minh Ribler - May, 2004
+// Function: Attribute default constructor
+///\brief Default constructor: Creates a stub attribute
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
Attribute::Attribute() : AbstractDs(), H5Location(), id(H5I_INVALID_HID) {}
//--------------------------------------------------------------------------
-// Function: Attribute copy constructor
-///\brief Copy constructor: makes a copy of the original Attribute object.
-///\param original - IN: Original Attribute object to copy
-// Programmer Binh-Minh Ribler - 2000
+// Function: Attribute copy constructor
+///\brief Copy constructor: makes a copy of the original Attribute object.
+///\param original - IN: Original Attribute object to copy
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
Attribute::Attribute(const Attribute& original) : AbstractDs(), H5Location(), id(original.id)
{
@@ -62,12 +62,12 @@ Attribute::Attribute(const Attribute& original) : AbstractDs(), H5Location(), id
}
//--------------------------------------------------------------------------
-// Function: Attribute overloaded constructor
-///\brief Creates an Attribute object using the id of an existing
-/// attribute.
-///\param existing_id - IN: Id of an existing attribute
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: Attribute overloaded constructor
+///\brief Creates an Attribute object using the id of an existing
+/// attribute.
+///\param existing_id - IN: Id of an existing attribute
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
Attribute::Attribute(const hid_t existing_id) : AbstractDs(), H5Location(), id(existing_id)
{
@@ -75,30 +75,30 @@ Attribute::Attribute(const hid_t existing_id) : AbstractDs(), H5Location(), id(e
}
//--------------------------------------------------------------------------
-// Function: Attribute::write
-///\brief Writes data to this attribute.
-///\param mem_type - IN: Attribute datatype (in memory)
-///\param buf - IN: Data to be written
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: Attribute::write
+///\brief Writes data to this attribute.
+///\param mem_type - IN: Attribute datatype (in memory)
+///\param buf - IN: Data to be written
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Attribute::write( const DataType& mem_type, const void *buf ) const
+void Attribute::write(const DataType& mem_type, const void *buf) const
{
- herr_t ret_value = H5Awrite( id, mem_type.getId(), buf );
- if( ret_value < 0 )
- {
- throw AttributeIException("Attribute::write", "H5Awrite failed");
- }
+ herr_t ret_value = H5Awrite(id, mem_type.getId(), buf);
+ if (ret_value < 0)
+ {
+ throw AttributeIException("Attribute::write", "H5Awrite failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: Attribute::write
-///\brief This is an overloaded member function, provided for convenience.
-/// It writes a \a H5std_string to this attribute.
-///\param mem_type - IN: Attribute datatype (in memory)
-///\param strg - IN: Data to be written
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - Apr, 2003
+// Function: Attribute::write
+///\brief This is an overloaded member function, provided for convenience.
+/// It writes a \a H5std_string to this attribute.
+///\param mem_type - IN: Attribute datatype (in memory)
+///\param strg - IN: Data to be written
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - Apr, 2003
//--------------------------------------------------------------------------
void Attribute::write(const DataType& mem_type, const H5std_string& strg) const
{
@@ -107,7 +107,7 @@ void Attribute::write(const DataType& mem_type, const H5std_string& strg) const
htri_t is_variable_len = H5Tis_variable_str(mem_type.getId());
if (is_variable_len < 0)
{
- throw AttributeIException("Attribute::write", "H5Tis_variable_str failed");
+ throw AttributeIException("Attribute::write", "H5Tis_variable_str failed");
}
// Convert string to C-string
const char* strg_C;
@@ -117,55 +117,55 @@ void Attribute::write(const DataType& mem_type, const H5std_string& strg) const
// Pass string in differently depends on variable or fixed length
if (!is_variable_len)
{
- ret_value = H5Awrite(id, mem_type.getId(), strg_C);
+ ret_value = H5Awrite(id, mem_type.getId(), strg_C);
}
else
{
- // passing third argument by address
- ret_value = H5Awrite(id, mem_type.getId(), &strg_C);
+ // passing third argument by address
+ ret_value = H5Awrite(id, mem_type.getId(), &strg_C);
}
if (ret_value < 0)
{
- throw AttributeIException("Attribute::write", "H5Awrite failed");
+ throw AttributeIException("Attribute::write", "H5Awrite failed");
}
}
//--------------------------------------------------------------------------
-// Function: Attribute::read
-///\brief Reads data from this attribute.
-///\param mem_type - IN: Attribute datatype (in memory)
-///\param buf - OUT: Buffer for read data
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: Attribute::read
+///\brief Reads data from this attribute.
+///\param mem_type - IN: Attribute datatype (in memory)
+///\param buf - OUT: Buffer for read data
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Attribute::read( const DataType& mem_type, void *buf ) const
+void Attribute::read(const DataType& mem_type, void *buf) const
{
- herr_t ret_value = H5Aread( id, mem_type.getId(), buf );
- if( ret_value < 0 )
- {
- throw AttributeIException("Attribute::read", "H5Aread failed");
- }
+ herr_t ret_value = H5Aread(id, mem_type.getId(), buf);
+ if (ret_value < 0)
+ {
+ throw AttributeIException("Attribute::read", "H5Aread failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: Attribute::read
-///\brief This is an overloaded member function, provided for convenience.
-/// It reads a \a H5std_string from this attribute.
-///\param mem_type - IN: Attribute datatype (in memory)
-///\param strg - IN: Buffer for read string
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - Apr, 2003
+// Function: Attribute::read
+///\brief This is an overloaded member function, provided for convenience.
+/// It reads a \a H5std_string from this attribute.
+///\param mem_type - IN: Attribute datatype (in memory)
+///\param strg - IN: Buffer for read string
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - Apr, 2003
// Modification
-// Mar 2008
-// Corrected a misunderstanding that H5Aread would allocate
-// space for the buffer. Obtained the attribute size and
-// allocated memory properly. -BMR
-// Apr 2009
-// Used getInMemDataSize to get attribute data size. -BMR
-// Jul 2009
-// Divided into specific private functions for fixed- and
-// variable-len string data: p_read_fixed_len and
-// p_read_variable_len. This should improve readability. -BMR
+// Mar 2008
+// Corrected a misunderstanding that H5Aread would allocate
+// space for the buffer. Obtained the attribute size and
+// allocated memory properly. -BMR
+// Apr 2009
+// Used getInMemDataSize to get attribute data size. -BMR
+// Jul 2009
+// Divided into specific private functions for fixed- and
+// variable-len string data: p_read_fixed_len and
+// p_read_variable_len. This should improve readability. -BMR
//--------------------------------------------------------------------------
void Attribute::read(const DataType& mem_type, H5std_string& strg) const
{
@@ -188,11 +188,11 @@ void Attribute::read(const DataType& mem_type, H5std_string& strg) const
}
//--------------------------------------------------------------------------
-// Function: Attribute::getInMemDataSize
-///\brief Gets the size in memory of the attribute's data.
-///\return Size of data (in memory)
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - Apr 2009
+// Function: Attribute::getInMemDataSize
+///\brief Gets the size in memory of the attribute's data.
+///\return Size of data (in memory)
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - Apr 2009
//--------------------------------------------------------------------------
size_t Attribute::getInMemDataSize() const
{
@@ -200,9 +200,9 @@ size_t Attribute::getInMemDataSize() const
// Get the data type of this attribute
hid_t mem_type_id = H5Aget_type(id);
- if( mem_type_id < 0 )
+ if (mem_type_id < 0)
{
- throw AttributeIException(func, "H5Aget_type failed");
+ throw AttributeIException(func, "H5Aget_type failed");
}
// Get the data type's size by first getting its native type then getting
@@ -210,22 +210,22 @@ size_t Attribute::getInMemDataSize() const
hid_t native_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT);
if (native_type < 0)
{
- throw AttributeIException(func, "H5Tget_native_type failed");
+ throw AttributeIException(func, "H5Tget_native_type failed");
}
size_t type_size = H5Tget_size(native_type);
if (type_size == 0)
{
- throw AttributeIException(func, "H5Tget_size failed");
+ throw AttributeIException(func, "H5Tget_size failed");
}
// Close the native type and the datatype of this attribute.
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 attribute by first getting its dataspace
@@ -233,18 +233,18 @@ size_t Attribute::getInMemDataSize() const
hid_t space_id = H5Aget_space(id);
if (space_id < 0)
{
- throw AttributeIException(func, "H5Aget_space failed");
+ throw AttributeIException(func, "H5Aget_space failed");
}
hssize_t num_elements = H5Sget_simple_extent_npoints(space_id);
if (num_elements < 0)
{
- throw AttributeIException(func, "H5Sget_simple_extent_npoints failed");
+ throw AttributeIException(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
@@ -253,46 +253,46 @@ size_t Attribute::getInMemDataSize() const
}
//--------------------------------------------------------------------------
-// Function: Attribute::getSpace
-///\brief Gets a copy of the dataspace for this attribute.
-///\return Dataspace instance
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: Attribute::getSpace
+///\brief Gets a copy of the dataspace for this attribute.
+///\return Dataspace instance
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSpace Attribute::getSpace() const
{
// Calls C function H5Aget_space to get the id of the dataspace
- hid_t dataspace_id = H5Aget_space( id );
+ hid_t dataspace_id = H5Aget_space(id);
// If the dataspace id is valid, create and return the DataSpace object
- if( dataspace_id > 0 )
- {
- DataSpace dataspace;
- f_DataSpace_setId(&dataspace, dataspace_id);
- return(dataspace);
- }
+ if (dataspace_id > 0)
+ {
+ DataSpace dataspace;
+ f_DataSpace_setId(&dataspace, dataspace_id);
+ return(dataspace);
+ }
else
- {
- throw AttributeIException("Attribute::getSpace", "H5Aget_space failed");
- }
+ {
+ throw AttributeIException("Attribute::getSpace", "H5Aget_space failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: Attribute::getName
-///\brief Gets the name of this attribute, returning its length.
-///\param attr_name - OUT: Buffer for the name string as char*
-///\param buf_size - IN: Length of the buffer, default to 0
-///\return Actual length of the attribute name
-///\exception H5::AttributeIException
+// Function: Attribute::getName
+///\brief Gets the name of this attribute, returning its length.
+///\param attr_name - OUT: Buffer for the name string as char*
+///\param buf_size - IN: Length of the buffer, default to 0
+///\return Actual length of the attribute name
+///\exception H5::AttributeIException
///\par Description
-/// This function retrieves \a buf_size chars of the attribute's
-/// name including null termination. Thus, if the actual length
-/// of the name is more than buf_size-1, the retrieved name will
-/// be truncated to accommodate the null terminator.
-/// To get length of the attribute's name for buffer allocation,
-/// an application can call this function passing in NULL for the
-/// first argument and ignore the second argument.
-// Programmer Binh-Minh Ribler - Mar, 2014
+/// This function retrieves \a buf_size chars of the attribute's
+/// name including null termination. Thus, if the actual length
+/// of the name is more than buf_size-1, the retrieved name will
+/// be truncated to accommodate the null terminator.
+/// To get length of the attribute's name for buffer allocation,
+/// an application can call this function passing in NULL for the
+/// first argument and ignore the second argument.
+// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
ssize_t Attribute::getName(char* attr_name, size_t buf_size) const
{
@@ -302,25 +302,25 @@ ssize_t Attribute::getName(char* attr_name, size_t buf_size) const
// If H5Aget_name returns a negative value, raise an exception
if (name_size < 0)
{
- throw AttributeIException("Attribute::getName", "H5Aget_name failed");
+ throw AttributeIException("Attribute::getName", "H5Aget_name failed");
}
else if (name_size == 0)
{
- throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0");
+ throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0");
}
// Return length of the name
return(name_size);
}
//--------------------------------------------------------------------------
-// Function: Attribute::getName
-///\brief Returns the name of this attribute as an \a H5std_string.
-///\return Name of the attribute
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - May, 2004
+// Function: Attribute::getName
+///\brief Returns the name of this attribute as an \a H5std_string.
+///\return Name of the attribute
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - May, 2004
// Modification
-// Mar 2014 - BMR
-// Revised to use the modified getName() above
+// Mar 2014 - BMR
+// Revised to use the modified getName() above
//--------------------------------------------------------------------------
H5std_string Attribute::getName() const
{
@@ -332,11 +332,11 @@ H5std_string Attribute::getName() const
// If H5Aget_name failed, throw exception
if (name_size < 0)
{
- throw AttributeIException("Attribute::getName", "H5Aget_name failed");
+ throw AttributeIException("Attribute::getName", "H5Aget_name failed");
}
else if (name_size == 0)
{
- throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0");
+ throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0");
}
// Attribute's name exists, retrieve it
else if (name_size > 0)
@@ -359,44 +359,44 @@ H5std_string Attribute::getName() const
}
//--------------------------------------------------------------------------
-// Function: Attribute::getName
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an integer
-/// specifying a desired length to be retrieved of the name.
-///\return Name (or part of name) of the attribute
-///\param len - IN: Desired length of the name
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: Attribute::getName
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an integer
+/// specifying a desired length to be retrieved of the name.
+///\return Name (or part of name) of the attribute
+///\param len - IN: Desired length of the name
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// Mar 2014 - BMR
-// Revised to use the new getName() below
+// Mar 2014 - BMR
+// Revised to use the new getName() below
//--------------------------------------------------------------------------
H5std_string Attribute::getName(size_t len) const
{
H5std_string attr_name;
ssize_t name_size = getName(attr_name, len);
if (name_size < 0)
- return("");
+ return("");
else
- return(attr_name);
+ return(attr_name);
}
//--------------------------------------------------------------------------
-// Function: Attribute::getName
-///\brief Gets the name of this attribute, returning its length.
-///\param attr_name - OUT: Buffer for the name string as \a H5std_string
-///\param len - IN: Desired length of the name, default to 0
-///\return Actual length of the attribute name
-///\exception H5::AttributeIException
+// Function: Attribute::getName
+///\brief Gets the name of this attribute, returning its length.
+///\param attr_name - OUT: Buffer for the name string as \a H5std_string
+///\param len - IN: Desired length of the name, default to 0
+///\return Actual length of the attribute name
+///\exception H5::AttributeIException
///\par Description
-/// This function retrieves the attribute's name as a string. The
-/// buf_size can specify a specific length or default to 0, in
-/// which case the entire name will be retrieved.
-// Programmer Binh-Minh Ribler - Nov, 2001
+/// This function retrieves the attribute's name as a string. The
+/// buf_size can specify a specific length or default to 0, in
+/// which case the entire name will be retrieved.
+// Programmer Binh-Minh Ribler - Nov, 2001
// Modification
-// Mar 2014 - BMR
-// Added to replace getName(size_t, H5std_string&) so that it'll
-// allow the argument "len" to be skipped.
+// Mar 2014 - BMR
+// Added to replace getName(size_t, H5std_string&) so that it'll
+// allow the argument "len" to be skipped.
//--------------------------------------------------------------------------
ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const
{
@@ -406,7 +406,7 @@ ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const
if (len == 0)
{
attr_name = getName();
- name_size = attr_name.length();
+ name_size = attr_name.length();
}
// If length is provided, get that number of characters in name
else
@@ -430,33 +430,33 @@ ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const
}
//--------------------------------------------------------------------------
-// Function: Attribute::getName
-// Purpose This function is replaced by the previous function, which
-// provides more convenient prototype. It will be removed
-// in future release.
-// Param len - IN: Desired length of the name
-// Param attr_name - OUT: Buffer for the name string
-// Return Actual length of the attribute name
-// Exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - Nov, 2001
+// Function: Attribute::getName
+// Purpose This function is replaced by the previous function, which
+// provides more convenient prototype. It will be removed
+// in future release.
+// Param len - IN: Desired length of the name
+// Param attr_name - OUT: Buffer for the name string
+// Return Actual length of the attribute name
+// Exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - Nov, 2001
// 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
//--------------------------------------------------------------------------
-//ssize_t Attribute::getName( size_t len, H5std_string& attr_name ) const
+//ssize_t Attribute::getName(size_t len, H5std_string& attr_name) const
//{
// return (getName(attr_name, len));
//}
//--------------------------------------------------------------------------
-// Function: Attribute::getStorageSize
-///\brief Returns the amount of storage size required for this attribute.
-///\return Size of the storage or 0, for no data
-///\exception H5::AttributeIException
-// 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: Attribute::getStorageSize
+///\brief Returns the amount of storage size required for this attribute.
+///\return Size of the storage or 0, for no data
+///\exception H5::AttributeIException
+// 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 Attribute::getStorageSize() const
{
@@ -466,19 +466,19 @@ hsize_t Attribute::getStorageSize() const
//--------------------------------------------------------------------------
// Function: Attribute::getId
-///\brief Get the id of this attribute
-///\return Attribute identifier
+///\brief Get the id of this attribute
+///\return Attribute identifier
// Description:
-// Class hierarchy is revised to address bugzilla 1068. Class
-// AbstractDS and Attribute are moved out of H5Object. In
-// addition, member IdComponent::id is moved into subclasses, and
-// IdComponent::getId now becomes pure virtual function.
+// Class hierarchy is revised to address bugzilla 1068. Class
+// AbstractDS and Attribute are moved out of H5Object. In
+// addition, member IdComponent::id is moved into subclasses, and
+// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
// Modification
-// Aug 2016 - BMR
-// Note that Attribute is now inheriting from H5Location, because
-// an attribute id can be used to specify a location in HDF5
-// library.
+// Aug 2016 - BMR
+// Note that Attribute is now inheriting from H5Location, because
+// an attribute id can be used to specify a location in HDF5
+// library.
//--------------------------------------------------------------------------
hid_t Attribute::getId() const
{
@@ -486,36 +486,36 @@ hid_t Attribute::getId() const
}
//--------------------------------------------------------------------------
-// Function: Attribute::p_get_type (private)
-// Purpose Gets the datatype of this attribute.
-// Return Id of the datatype
-// Exception H5::AttributeIException
+// Function: Attribute::p_get_type (private)
+// Purpose Gets the datatype of this attribute.
+// Return Id of the datatype
+// Exception H5::AttributeIException
// Description
-// This private function is used in AbstractDs.
-// Programmer Binh-Minh Ribler - 2000
+// This private function is used in AbstractDs.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
hid_t Attribute::p_get_type() const
{
- hid_t type_id = H5Aget_type( id );
- if( type_id > 0 )
- return( type_id );
- else
- {
- throw AttributeIException("", "H5Aget_type failed");
- }
+ hid_t type_id = H5Aget_type(id);
+ if (type_id > 0)
+ return(type_id);
+ else
+ {
+ throw AttributeIException("", "H5Aget_type failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: Attribute::p_read_fixed_len (private)
-// brief Reads a fixed length \a H5std_string from an attribute.
-// param mem_type - IN: Attribute datatype (in memory)
-// param strg - IN: Buffer for read string
-// exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - Jul, 2009
+// Function: Attribute::p_read_fixed_len (private)
+// brief Reads a fixed length \a H5std_string from an attribute.
+// param mem_type - IN: Attribute datatype (in memory)
+// param strg - IN: Buffer for read string
+// exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - Jul, 2009
// Modification
-// Jul 2009
-// Separated the fixed length case from the original
-// Attribute::read
+// Jul 2009
+// Separated the fixed length case from the original
+// Attribute::read
//--------------------------------------------------------------------------
void Attribute::p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const
{
@@ -527,31 +527,31 @@ void Attribute::p_read_fixed_len(const DataType& mem_type, H5std_string& strg) c
// If there is data, allocate buffer and read it.
if (attr_size > 0)
{
- char *strg_C = new char[attr_size+1];
- herr_t ret_value = H5Aread(id, mem_type.getId(), strg_C);
- if( ret_value < 0 )
- {
- delete []strg_C; // de-allocate for fixed-len string
- throw AttributeIException("Attribute::read", "H5Aread failed");
- }
- // Get string from the C char* and release resource allocated locally
- strg_C[attr_size] = '\0';
- strg = strg_C;
- delete []strg_C;
+ char *strg_C = new char[attr_size+1];
+ herr_t ret_value = H5Aread(id, mem_type.getId(), strg_C);
+ if (ret_value < 0)
+ {
+ delete []strg_C; // de-allocate for fixed-len string
+ throw AttributeIException("Attribute::read", "H5Aread failed");
+ }
+ // Get string from the C char* and release resource allocated locally
+ strg_C[attr_size] = '\0';
+ strg = strg_C;
+ delete []strg_C;
}
}
//--------------------------------------------------------------------------
-// Function: Attribute::p_read_variable_len (private)
-// brief Reads a variable length \a H5std_string from an attribute.
-// param mem_type - IN: Attribute datatype (in memory)
-// param strg - IN: Buffer for read string
-// exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - Jul, 2009
+// Function: Attribute::p_read_variable_len (private)
+// brief Reads a variable length \a H5std_string from an attribute.
+// param mem_type - IN: Attribute datatype (in memory)
+// param strg - IN: Buffer for read string
+// exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - Jul, 2009
// Modification
-// Jul 2009
-// Separated the variable length case from the original
-// Attribute::read. -BMR
+// Jul 2009
+// Separated the variable length case from the original
+// Attribute::read. -BMR
//--------------------------------------------------------------------------
void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg) const
{
@@ -561,9 +561,9 @@ void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg
// Read attribute, no allocation for variable-len string; C library will
herr_t ret_value = H5Aread(id, mem_type.getId(), &strg_C);
- if( ret_value < 0 )
+ if (ret_value < 0)
{
- throw AttributeIException("Attribute::read", "H5Aread failed");
+ throw AttributeIException("Attribute::read", "H5Aread failed");
}
// Get string from the C char* and release resource allocated by C API
@@ -577,65 +577,65 @@ void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg
///\brief Sets the identifier of this object to a new value.
///
///\exception H5::IdComponentException when the attempt to close the HDF5
-/// object fails
+/// object fails
// Description:
-// The underlaying reference counting in the C library ensures
-// that the current valid id of this object is properly closed.
-// Then the object's id is reset to the new id.
+// The underlaying reference counting in the C library ensures
+// that the current valid id of this object is properly closed.
+// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void Attribute::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
- close();
+ close();
}
catch (Exception& close_error) {
- throw AttributeIException("Attribute::p_setId", close_error.getDetailMsg());
+ throw AttributeIException("Attribute::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;
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: Attribute::close
-///\brief Closes this attribute.
+// Function: Attribute::close
+///\brief Closes this attribute.
///
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - Mar 9, 2005
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
void Attribute::close()
{
if (p_valid_id(id))
{
- herr_t ret_value = H5Aclose(id);
- if( ret_value < 0 )
- {
- throw AttributeIException("Attribute::close", "H5Aclose failed");
- }
- // reset the id
- id = H5I_INVALID_HID;
+ herr_t ret_value = H5Aclose(id);
+ if (ret_value < 0)
+ {
+ throw AttributeIException("Attribute::close", "H5Aclose failed");
+ }
+ // reset the id
+ id = H5I_INVALID_HID;
}
}
//--------------------------------------------------------------------------
-// Function: Attribute destructor
-///\brief Properly terminates access to this attribute.
-// Programmer Binh-Minh Ribler - 2000
+// Function: Attribute destructor
+///\brief Properly terminates access to this attribute.
+// 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
//--------------------------------------------------------------------------
Attribute::~Attribute()
{
try {
- close();
+ close();
}
catch (Exception& close_error) {
- cerr << "Attribute::~Attribute - " << close_error.getDetailMsg() << endl;
+ cerr << "Attribute::~Attribute - " << close_error.getDetailMsg() << endl;
}
}
diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h
index c27bbdf..0243cd9 100644
--- a/c++/src/H5Attribute.h
+++ b/c++/src/H5Attribute.h
@@ -32,74 +32,74 @@ namespace H5 {
class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
public:
- // Copy constructor: makes a copy of an existing Attribute object.
- Attribute( const Attribute& original );
+ // Copy constructor: makes a copy of an existing Attribute object.
+ Attribute(const Attribute& original);
- // Default constructor
- Attribute();
+ // Default constructor
+ Attribute();
- // Creates a copy of an existing attribute using the attribute id
- Attribute( const hid_t attr_id );
+ // Creates a copy of an existing attribute using the attribute id
+ Attribute(const hid_t attr_id);
- // Closes this attribute.
- virtual void close();
+ // Closes this attribute.
+ virtual void close();
- // Gets the name of this attribute.
- ssize_t getName(char* attr_name, size_t buf_size = 0) const;
- H5std_string getName(size_t len) const;
- H5std_string getName() const;
- ssize_t getName(H5std_string& attr_name, size_t len = 0) const;
- // The overloaded function below is replaced by the one above and it
- // is kept for backward compatibility purpose.
- ssize_t getName( size_t buf_size, H5std_string& attr_name ) const;
+ // Gets the name of this attribute.
+ ssize_t getName(char* attr_name, size_t buf_size = 0) const;
+ H5std_string getName(size_t len) const;
+ H5std_string getName() const;
+ ssize_t getName(H5std_string& attr_name, size_t len = 0) const;
+ // The overloaded function below is replaced by the one above and it
+ // is kept for backward compatibility purpose.
+ ssize_t getName(size_t buf_size, H5std_string& attr_name) const;
- // Gets a copy of the dataspace for this attribute.
- virtual DataSpace getSpace() const;
+ // Gets a copy of the dataspace for this attribute.
+ virtual DataSpace getSpace() const;
- // Returns the amount of storage size required for this attribute.
- virtual hsize_t getStorageSize() const;
+ // Returns the amount of storage size required for this attribute.
+ virtual hsize_t getStorageSize() const;
- // Returns the in memory size of this attribute's data.
- virtual size_t getInMemDataSize() const;
+ // Returns the in memory size of this attribute's data.
+ virtual size_t getInMemDataSize() const;
- // Reads data from this attribute.
- void read( const DataType& mem_type, void *buf ) const;
- void read( const DataType& mem_type, H5std_string& strg ) const;
+ // Reads data from this attribute.
+ void read(const DataType& mem_type, void *buf) const;
+ void read(const DataType& mem_type, H5std_string& strg) const;
- // Writes data to this attribute.
- void write(const DataType& mem_type, const void *buf ) const;
- void write(const DataType& mem_type, const H5std_string& strg ) const;
+ // Writes data to this attribute.
+ void write(const DataType& mem_type, const void *buf) const;
+ void write(const DataType& mem_type, const H5std_string& strg) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("Attribute"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("Attribute"); }
- // Gets the attribute id.
- virtual hid_t getId() const;
+ // Gets the attribute id.
+ virtual hid_t getId() const;
- // Destructor: properly terminates access to this attribute.
- virtual ~Attribute();
+ // Destructor: properly terminates access to this attribute.
+ virtual ~Attribute();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
protected:
- // Sets the attribute id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the attribute id.
+ virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
private:
- hid_t id; // HDF5 attribute id
+ hid_t id; // HDF5 attribute id
- // This function contains the common code that is used by
- // getTypeClass and various API functions getXxxType
- // defined in AbstractDs for generic datatype and specific
- // sub-types
- virtual hid_t p_get_type() const;
+ // This function contains the common code that is used by
+ // getTypeClass and various API functions getXxxType
+ // defined in AbstractDs for generic datatype and specific
+ // sub-types
+ virtual hid_t p_get_type() const;
- // Reads variable or fixed len strings from this attribute.
- void p_read_variable_len(const DataType& mem_type, H5std_string& strg) const;
- void p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const;
+ // Reads variable or fixed len strings from this attribute.
+ void p_read_variable_len(const DataType& mem_type, H5std_string& strg) const;
+ void p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const;
- // Friend function to set Attribute id. For library use only.
- friend void f_Attribute_setId(Attribute* attr, hid_t new_id);
+ // Friend function to set Attribute id. For library use only.
+ friend void f_Attribute_setId(Attribute* attr, hid_t new_id);
};
}
diff --git a/c++/src/H5Classes.h b/c++/src/H5Classes.h
index 03faa1a..00066fe 100644
--- a/c++/src/H5Classes.h
+++ b/c++/src/H5Classes.h
@@ -18,31 +18,31 @@
#define __H5Classes_H
namespace H5 {
- class Exception;
- class IdComponent;
- class H5Location;
- class H5Object;
- class PropList;
- class FileCreatPropList;
- class FileAccPropList;
- class LinkAccPropList;
- class DSetCreatPropList;
- class DSetMemXferPropList;
- class DTypePropList;
- class DataType;
- class DataSpace;
- class AtomType;
- class PredType;
- class EnumType;
- class IntType;
- class FloatType;
- class StrType;
- class CompType;
- class AbstractDs;
- class DataSet;
- class Group;
- class H5File;
- class Attribute;
- class H5Library;
+ class Exception;
+ class IdComponent;
+ class H5Location;
+ class H5Object;
+ class PropList;
+ class FileCreatPropList;
+ class FileAccPropList;
+ class LinkAccPropList;
+ class DSetCreatPropList;
+ class DSetMemXferPropList;
+ class DTypePropList;
+ class DataType;
+ class DataSpace;
+ class AtomType;
+ class PredType;
+ class EnumType;
+ class IntType;
+ class FloatType;
+ class StrType;
+ class CompType;
+ class AbstractDs;
+ class DataSet;
+ class Group;
+ class H5File;
+ class Attribute;
+ class H5Library;
}
#endif // __H5Classes_H
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index 5f7971f..5c01055 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -16,7 +16,7 @@
#include <string>
#include "H5Include.h"
-#include "H5private.h" // for HDstrcpy
+#include "H5private.h" // for HDstrcpy
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5DataSpace.h"
@@ -46,293 +46,292 @@
// December 2000
namespace H5 {
-using namespace std;
//--------------------------------------------------------------------------
-// Function: CommonFG::openDataType
-///\brief Opens the named generic datatype at this location.
-///\param name - IN: Name of the datatype to open
-///\return DataType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CommonFG::openDataType
+///\brief Opens the named generic datatype at this location.
+///\param name - IN: Name of the datatype to open
+///\return DataType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType CommonFG::openDataType( const char* name ) const
+DataType CommonFG::openDataType(const char* name) const
{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openDataType", "H5Topen2 failed");
+ // If the datatype's opening failed, throw an exception
+ if (type_id < 0)
+ throwException("openDataType", "H5Topen2 failed");
- // No failure, create and return the DataType object
- DataType data_type(type_id);
- return(data_type);
+ // No failure, create and return the DataType object
+ DataType data_type(type_id);
+ return(data_type);
}
//--------------------------------------------------------------------------
-// Function: CommonFG::openDataType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: CommonFG::openDataType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType CommonFG::openDataType( const H5std_string& name ) const
+DataType CommonFG::openDataType(const H5std_string& name) const
{
- return( openDataType( name.c_str()) );
+ return(openDataType(name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: CommonFG::openArrayType
-///\brief Opens the named array datatype at this location.
-///\param name - IN: Name of the array datatype to open
-///\return ArrayType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - Jul, 2005
+// Function: CommonFG::openArrayType
+///\brief Opens the named array datatype at this location.
+///\param name - IN: Name of the array datatype to open
+///\return ArrayType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-ArrayType CommonFG::openArrayType( const char* name ) const
+ArrayType CommonFG::openArrayType(const char* name) const
{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openArrayType", "H5Topen2 failed");
-
- // No failure, create and return the ArrayType object
- ArrayType array_type;
- f_DataType_setId(&array_type, type_id);
- return(array_type);
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if (type_id < 0)
+ throwException("openArrayType", "H5Topen2 failed");
+
+ // No failure, create and return the ArrayType object
+ ArrayType array_type;
+ f_DataType_setId(&array_type, type_id);
+ return(array_type);
}
//--------------------------------------------------------------------------
-// Function: CommonFG::openArrayType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - Jul, 2005
+// Function: CommonFG::openArrayType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-ArrayType CommonFG::openArrayType( const H5std_string& name ) const
+ArrayType CommonFG::openArrayType(const H5std_string& name) const
{
- return( openArrayType( name.c_str()) );
+ return(openArrayType(name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: CommonFG::openCompType
-///\brief Opens the named compound datatype at this location.
-///\param name - IN: Name of the compound datatype to open
-///\return CompType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CommonFG::openCompType
+///\brief Opens the named compound datatype at this location.
+///\param name - IN: Name of the compound datatype to open
+///\return CompType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType CommonFG::openCompType( const char* name ) const
+CompType CommonFG::openCompType(const char* name) const
{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openCompType", "H5Topen2 failed");
-
- // No failure, create and return the CompType object
- CompType comp_type;
- f_DataType_setId(&comp_type, type_id);
- return(comp_type);
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if (type_id < 0)
+ throwException("openCompType", "H5Topen2 failed");
+
+ // No failure, create and return the CompType object
+ CompType comp_type;
+ f_DataType_setId(&comp_type, type_id);
+ return(comp_type);
}
//--------------------------------------------------------------------------
-// Function: CommonFG::openCompType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: CommonFG::openCompType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType CommonFG::openCompType( const H5std_string& name ) const
+CompType CommonFG::openCompType(const H5std_string& name) const
{
- return( openCompType( name.c_str()) );
+ return(openCompType(name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: CommonFG::openEnumType
-///\brief Opens the named enumeration datatype at this location.
-///\param name - IN: Name of the enumeration datatype to open
-///\return EnumType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CommonFG::openEnumType
+///\brief Opens the named enumeration datatype at this location.
+///\param name - IN: Name of the enumeration datatype to open
+///\return EnumType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType CommonFG::openEnumType( const char* name ) const
+EnumType CommonFG::openEnumType(const char* name) const
{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openEnumType", "H5Topen2 failed");
-
- // No failure, create and return the EnumType object
- EnumType enum_type;
- f_DataType_setId(&enum_type, type_id);
- return(enum_type);
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if (type_id < 0)
+ throwException("openEnumType", "H5Topen2 failed");
+
+ // No failure, create and return the EnumType object
+ EnumType enum_type;
+ f_DataType_setId(&enum_type, type_id);
+ return(enum_type);
}
//--------------------------------------------------------------------------
-// Function: CommonFG::openEnumType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: CommonFG::openEnumType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType CommonFG::openEnumType( const H5std_string& name ) const
+EnumType CommonFG::openEnumType(const H5std_string& name) const
{
- return( openEnumType( name.c_str()) );
+ return(openEnumType(name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: CommonFG::openIntType
-///\brief Opens the named integer datatype at this location.
-///\param name - IN: Name of the integer datatype to open
-///\return IntType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CommonFG::openIntType
+///\brief Opens the named integer datatype at this location.
+///\param name - IN: Name of the integer datatype to open
+///\return IntType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType CommonFG::openIntType( const char* name ) const
+IntType CommonFG::openIntType(const char* name) const
{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openIntType", "H5Topen2 failed");
-
- // No failure, create and return the IntType object
- IntType int_type;
- f_DataType_setId(&int_type, type_id);
- return(int_type);
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if (type_id < 0)
+ throwException("openIntType", "H5Topen2 failed");
+
+ // No failure, create and return the IntType object
+ IntType int_type;
+ f_DataType_setId(&int_type, type_id);
+ return(int_type);
}
//--------------------------------------------------------------------------
-// Function: CommonFG::openIntType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: CommonFG::openIntType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType CommonFG::openIntType( const H5std_string& name ) const
+IntType CommonFG::openIntType(const H5std_string& name) const
{
- return( openIntType( name.c_str()) );
+ return(openIntType(name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: CommonFG::openFloatType
-///\brief Opens the named floating-point datatype at this location.
-///\param name - IN: Name of the floating-point datatype to open
-///\return FloatType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CommonFG::openFloatType
+///\brief Opens the named floating-point datatype at this location.
+///\param name - IN: Name of the floating-point datatype to open
+///\return FloatType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType CommonFG::openFloatType( const char* name ) const
+FloatType CommonFG::openFloatType(const char* name) const
{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openFloatType", "H5Topen2 failed");
-
- // No failure, create and return the FloatType object
- FloatType float_type;
- f_DataType_setId(&float_type, type_id);
- return(float_type);
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if (type_id < 0)
+ throwException("openFloatType", "H5Topen2 failed");
+
+ // No failure, create and return the FloatType object
+ FloatType float_type;
+ f_DataType_setId(&float_type, type_id);
+ return(float_type);
}
//--------------------------------------------------------------------------
-// Function: CommonFG::openFloatType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: CommonFG::openFloatType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType CommonFG::openFloatType( const H5std_string& name ) const
+FloatType CommonFG::openFloatType(const H5std_string& name) const
{
- return( openFloatType( name.c_str()) );
+ return(openFloatType(name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: CommonFG::openStrType
-///\brief Opens the named string datatype at this location.
-///\param name - IN: Name of the string datatype to open
-///\return StrType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CommonFG::openStrType
+///\brief Opens the named string datatype at this location.
+///\param name - IN: Name of the string datatype to open
+///\return StrType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType CommonFG::openStrType( const char* name ) const
+StrType CommonFG::openStrType(const char* name) const
{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openStrType", "H5Topen2 failed");
-
- // No failure, create and return the StrType object
- StrType str_type;
- f_DataType_setId(&str_type, type_id);
- return(str_type);
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if (type_id < 0)
+ throwException("openStrType", "H5Topen2 failed");
+
+ // No failure, create and return the StrType object
+ StrType str_type;
+ f_DataType_setId(&str_type, type_id);
+ return(str_type);
}
//--------------------------------------------------------------------------
-// Function: CommonFG::openStrType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: CommonFG::openStrType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType CommonFG::openStrType( const H5std_string& name ) const
+StrType CommonFG::openStrType(const H5std_string& name) const
{
- return( openStrType( name.c_str()) );
+ return(openStrType(name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: CommonFG::openVarLenType
-///\brief Opens the named variable length datatype at this location.
-///\param name - IN: Name of the variable length datatype to open
-///\return VarLenType instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - Jul, 2005
+// Function: CommonFG::openVarLenType
+///\brief Opens the named variable length datatype at this location.
+///\param name - IN: Name of the variable length datatype to open
+///\return VarLenType instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-VarLenType CommonFG::openVarLenType( const char* name ) const
+VarLenType CommonFG::openVarLenType(const char* name) const
{
- // Call C function H5Topen2 to open the named datatype in this group,
- // given either the file or group id
- hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
-
- // If the datatype's opening failed, throw an exception
- if( type_id < 0 )
- throwException("openVarLenType", "H5Topen2 failed");
-
- // No failure, create and return the VarLenType object
- VarLenType varlen_type;
- f_DataType_setId(&varlen_type, type_id);
- return(varlen_type);
+ // Call C function H5Topen2 to open the named datatype in this group,
+ // given either the file or group id
+ hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT);
+
+ // If the datatype's opening failed, throw an exception
+ if (type_id < 0)
+ throwException("openVarLenType", "H5Topen2 failed");
+
+ // No failure, create and return the VarLenType object
+ VarLenType varlen_type;
+ f_DataType_setId(&varlen_type, type_id);
+ return(varlen_type);
}
//--------------------------------------------------------------------------
-// Function: CommonFG::openVarLenType
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - Jul, 2005
+// Function: CommonFG::openVarLenType
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-VarLenType CommonFG::openVarLenType( const H5std_string& name ) const
+VarLenType CommonFG::openVarLenType(const H5std_string& name) const
{
- return( openVarLenType( name.c_str()) );
+ return(openVarLenType(name.c_str()));
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h
index 59f425c..588d49a 100644
--- a/c++/src/H5CommonFG.h
+++ b/c++/src/H5CommonFG.h
@@ -32,55 +32,55 @@ class VarLenType;
*/
class H5_DLLCPP CommonFG {
public:
- // Opens a generic named datatype in this location.
- DataType openDataType(const char* name) const;
- DataType openDataType(const H5std_string& name) const;
+ // Opens a generic named datatype in this location.
+ DataType openDataType(const char* name) const;
+ DataType openDataType(const H5std_string& name) const;
- // Opens a named array datatype in this location.
- ArrayType openArrayType(const char* name) const;
- ArrayType openArrayType(const H5std_string& name) const;
+ // Opens a named array datatype in this location.
+ ArrayType openArrayType(const char* name) const;
+ ArrayType openArrayType(const H5std_string& name) const;
- // Opens a named compound datatype in this location.
- CompType openCompType(const char* name) const;
- CompType openCompType(const H5std_string& name) const;
+ // Opens a named compound datatype in this location.
+ CompType openCompType(const char* name) const;
+ CompType openCompType(const H5std_string& name) const;
- // Opens a named enumeration datatype in this location.
- EnumType openEnumType(const char* name) const;
- EnumType openEnumType(const H5std_string& name) const;
+ // Opens a named enumeration datatype in this location.
+ EnumType openEnumType(const char* name) const;
+ EnumType openEnumType(const H5std_string& name) const;
- // Opens a named integer datatype in this location.
- IntType openIntType(const char* name) const;
- IntType openIntType(const H5std_string& name) const;
+ // Opens a named integer datatype in this location.
+ IntType openIntType(const char* name) const;
+ IntType openIntType(const H5std_string& name) const;
- // Opens a named floating-point datatype in this location.
- FloatType openFloatType(const char* name) const;
- FloatType openFloatType(const H5std_string& name) const;
+ // Opens a named floating-point datatype in this location.
+ FloatType openFloatType(const char* name) const;
+ FloatType openFloatType(const H5std_string& name) const;
- // Opens a named string datatype in this location.
- StrType openStrType(const char* name) const;
- StrType openStrType(const H5std_string& name) const;
+ // Opens a named string datatype in this location.
+ StrType openStrType(const char* name) const;
+ StrType openStrType(const H5std_string& name) const;
- // Opens a named variable length datatype in this location.
- VarLenType openVarLenType(const char* name) const;
- VarLenType openVarLenType(const H5std_string& name) const;
+ // Opens a named variable length datatype in this location.
+ VarLenType openVarLenType(const char* name) const;
+ VarLenType openVarLenType(const H5std_string& name) const;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- /// For subclasses, H5File and Group, to return the correct
- /// object id, i.e. file or group id.
- virtual hid_t getLocId() const = 0;
+ /// For subclasses, H5File and Group, to return the correct
+ /// object id, i.e. file or group id.
+ virtual hid_t getLocId() const = 0;
- /// For subclasses, H5File and Group, to throw appropriate exception.
- virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0;
+ /// For subclasses, H5File and Group, to throw appropriate exception.
+ virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0;
- // Default constructor.
- CommonFG();
+ // Default constructor.
+ CommonFG();
- // Noop destructor.
- virtual ~CommonFG();
+ // Noop destructor.
+ virtual ~CommonFG();
protected:
- virtual void p_setId(const hid_t new_id) = 0;
+ virtual void p_setId(const hid_t new_id) = 0;
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index babda34..037527f 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -33,203 +33,203 @@
namespace H5 {
//--------------------------------------------------------------------------
-// Function: CompType default constructor
-///\brief Default constructor: Creates a stub compound datatype
-// Programmer Binh-Minh Ribler - 2000
+// Function: CompType default constructor
+///\brief Default constructor: Creates a stub compound datatype
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
CompType::CompType() : DataType() {}
//--------------------------------------------------------------------------
-// Function: CompType copy constructor
-///\brief Copy constructor: makes copy of the original CompType object
-///\param original - IN: Original CompType instance
-// Programmer Binh-Minh Ribler - 2000
+// Function: CompType copy constructor
+///\brief Copy constructor: makes copy of the original CompType object
+///\param original - IN: Original CompType instance
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType::CompType( const CompType& original ) : DataType( original ) {}
+CompType::CompType(const CompType& original) : DataType(original) {}
//--------------------------------------------------------------------------
-// Function: CompType overloaded constructor
-///\brief Creates a CompType object using the id of an existing datatype.
-///\param existing_id - IN: Id of an existing compound datatype
-// Programmer Binh-Minh Ribler - 2000
+// Function: CompType overloaded constructor
+///\brief Creates a CompType object using the id of an existing datatype.
+///\param existing_id - IN: Id of an existing compound datatype
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType::CompType( const hid_t existing_id ) : DataType( existing_id ) {}
+CompType::CompType(const hid_t existing_id) : DataType(existing_id) {}
//--------------------------------------------------------------------------
-// Function: CompType overloaded constructor
-///\brief Creates an empty compound datatype given a size, in bytes.
-///\param size - IN: Number of bytes in the datatype to create
-///\exception H5::DataTypeIException
+// Function: CompType overloaded constructor
+///\brief Creates an empty compound datatype given a size, in bytes.
+///\param size - IN: Number of bytes in the datatype to create
+///\exception H5::DataTypeIException
// Description
-// The DataType constructor calls the C API H5Tcreate to create
-// the compound datatype.
-// Programmer Binh-Minh Ribler - 2000
+// The DataType constructor calls the C API H5Tcreate to create
+// the compound datatype.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType::CompType( size_t size ) : DataType( H5T_COMPOUND, size ) {}
+CompType::CompType(size_t size) : DataType(H5T_COMPOUND, size) {}
//--------------------------------------------------------------------------
-// Function: CompType overloaded constructor
-///\brief Gets the compound datatype of the specified dataset.
-///\param dataset - IN: Dataset that this enum datatype associates with
-///\return CompType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CompType overloaded constructor
+///\brief Gets the compound datatype of the specified dataset.
+///\param dataset - IN: Dataset that this enum datatype associates with
+///\return CompType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType::CompType( const DataSet& dataset ) : DataType()
+CompType::CompType(const DataSet& dataset) : DataType()
{
- // Calls C function H5Dget_type to get the id of the datatype
- id = H5Dget_type( dataset.getId() );
-
- // If the datatype id is invalid, throw exception
- if( id < 0 )
- {
- throw DataSetIException("CompType constructor", "H5Dget_type failed");
- }
+ // Calls C function H5Dget_type to get the id of the datatype
+ id = H5Dget_type(dataset.getId());
+
+ // If the datatype id is invalid, throw exception
+ if (id < 0)
+ {
+ throw DataSetIException("CompType constructor", "H5Dget_type failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: CompType overloaded constructor
-///\brief Creates an CompType instance by opening an HDF5 compound
-/// given its name, provided as a C character string.
-///\param dtype_name - IN: Compound type name
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Dec 2016
+// Function: CompType overloaded constructor
+///\brief Creates an CompType instance by opening an HDF5 compound
+/// given its name, provided as a C character string.
+///\param dtype_name - IN: Compound type name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openCompType(const char*) to
-// improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openCompType(const char*) to
+// improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
CompType::CompType(const H5Location& loc, const char *dtype_name) : DataType()
{
- id = p_opentype(loc, dtype_name);
+ id = p_opentype(loc, dtype_name);
}
//--------------------------------------------------------------------------
-// Function: CompType overloaded constructor
-///\brief Creates an CompType instance by opening an HDF5 compound
-/// datatype given its name, provided as an \c H5std_string.
-///\param dtype_name - IN: Compound type name
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Dec 2016
+// Function: CompType overloaded constructor
+///\brief Creates an CompType instance by opening an HDF5 compound
+/// datatype given its name, provided as an \c H5std_string.
+///\param dtype_name - IN: Compound type name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openCompType(const H5Location&)
-// to improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openCompType(const H5Location&)
+// to improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
CompType::CompType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
{
- id = p_opentype(loc, dtype_name.c_str());
+ id = p_opentype(loc, dtype_name.c_str());
}
//--------------------------------------------------------------------------
-// Function: CompType::getNmembers
-///\brief Returns the number of members in this compound datatype.
-///\return Number of members
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CompType::getNmembers
+///\brief Returns the number of members in this compound datatype.
+///\return Number of members
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int CompType::getNmembers() const
{
- int num_members = H5Tget_nmembers( id );
- if( num_members < 0 )
- {
- throw DataTypeIException("CompType::getNmembers",
- "H5Tget_nmembers returns negative number of members");
- }
- return( num_members );
+ int num_members = H5Tget_nmembers(id);
+ if (num_members < 0)
+ {
+ throw DataTypeIException("CompType::getNmembers",
+ "H5Tget_nmembers returns negative number of members");
+ }
+ return(num_members);
}
//--------------------------------------------------------------------------
-// Function: CompType::getMemberName
-///\brief Returns the name of a member in this compound datatype.
-///\param member_num - IN: Zero-based index of the member
-///\return Name of member
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CompType::getMemberName
+///\brief Returns the name of a member in this compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return Name of member
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string CompType::getMemberName( unsigned member_num ) const
+H5std_string CompType::getMemberName(unsigned member_num) const
{
- char* member_name_C = H5Tget_member_name( id, member_num );
- if( member_name_C == NULL ) // NULL means failure
+ char* member_name_C = H5Tget_member_name(id, member_num);
+ if (member_name_C == NULL) // NULL means failure
{
- throw DataTypeIException("CompType::getMemberName",
- "H5Tget_member_name returns NULL for member name");
+ throw DataTypeIException("CompType::getMemberName",
+ "H5Tget_member_name returns NULL for member name");
}
H5std_string member_name = H5std_string(member_name_C); // convert C string to string
H5free_memory(member_name_C); // free the C string
- return( member_name ); // return the member name string
+ return(member_name); // return the member name string
}
//--------------------------------------------------------------------------
-// Function: CompType::getMemberIndex
-///\brief Returns the index of a member in this compound datatype.
-///\param name - IN: Name of the member
-///\return Index of member
-///\exception H5::DataTypeIException
+// Function: CompType::getMemberIndex
+///\brief Returns the index of a member in this compound datatype.
+///\param name - IN: Name of the member
+///\return Index of member
+///\exception H5::DataTypeIException
///\par Description
-/// Members are stored in no particular order with numbers 0
-/// through N-1, where N is the value returned by the member
-/// function \c CompType::getNmembers.
-// Programmer Binh-Minh Ribler - May 16, 2002
+/// Members are stored in no particular order with numbers 0
+/// through N-1, where N is the value returned by the member
+/// function \c CompType::getNmembers.
+// Programmer Binh-Minh Ribler - May 16, 2002
//--------------------------------------------------------------------------
int CompType::getMemberIndex(const char* name) const
{
- int member_index = H5Tget_member_index(id, name);
- if( member_index < 0 )
- {
- throw DataTypeIException("CompType::getMemberIndex",
- "H5Tget_member_index returns negative value");
- }
- return( member_index );
+ int member_index = H5Tget_member_index(id, name);
+ if (member_index < 0)
+ {
+ throw DataTypeIException("CompType::getMemberIndex",
+ "H5Tget_member_index returns negative value");
+ }
+ return(member_index);
}
int CompType::getMemberIndex(const H5std_string& name) const
{
- return(getMemberIndex(name.c_str()));
+ return(getMemberIndex(name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: CompType::getMemberOffset
-///\brief Returns the byte offset of the beginning of a member with
-/// respect to the beginning of the compound data type datum.
-///\param member_num - IN: Zero-based index of the member
-///\return Byte offset
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CompType::getMemberOffset
+///\brief Returns the byte offset of the beginning of a member with
+/// respect to the beginning of the compound data type datum.
+///\param member_num - IN: Zero-based index of the member
+///\return Byte offset
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
// Description
-/// Members are stored in no particular order with numbers 0
-/// through N-1, where N is the value returned by the member
-/// function \c CompType::getNmembers.
+/// Members are stored in no particular order with numbers 0
+/// through N-1, where N is the value returned by the member
+/// function \c CompType::getNmembers.
//
-// Note that byte offset being returned as 0 doesn't indicate
-// a failure. (According to Quincey)
+// Note that byte offset being returned as 0 doesn't indicate
+// a failure. (According to Quincey)
//--------------------------------------------------------------------------
-size_t CompType::getMemberOffset( unsigned member_num ) const
+size_t CompType::getMemberOffset(unsigned member_num) const
{
- size_t offset = H5Tget_member_offset( id, member_num );
- return( offset );
+ size_t offset = H5Tget_member_offset(id, member_num);
+ return(offset);
}
//--------------------------------------------------------------------------
-// Function: CompType::getMemberClass
-///\brief Gets the type class of the specified member.
-///\param member_num - IN: Zero-based index of the member
-///\return Type class of the member
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CompType::getMemberClass
+///\brief Gets the type class of the specified member.
+///\param member_num - IN: Zero-based index of the member
+///\return Type class of the member
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// Modified to use H5Tget_member_class instead. - Jul, 2005
+// Modified to use H5Tget_member_class instead. - Jul, 2005
//--------------------------------------------------------------------------
-H5T_class_t CompType::getMemberClass( unsigned member_num ) const
+H5T_class_t CompType::getMemberClass(unsigned member_num) const
{
- H5T_class_t member_class = H5Tget_member_class(id, member_num);
- if( member_class == H5T_NO_CLASS )
- {
- throw DataTypeIException("CompType::getMemberClass",
- "H5Tget_member_class returns H5T_NO_CLASS");
- }
- return(member_class);
+ H5T_class_t member_class = H5Tget_member_class(id, member_num);
+ if (member_class == H5T_NO_CLASS)
+ {
+ throw DataTypeIException("CompType::getMemberClass",
+ "H5Tget_member_class returns H5T_NO_CLASS");
+ }
+ return(member_class);
}
// This private member function calls the C API to get the identifier
@@ -238,184 +238,184 @@ H5T_class_t CompType::getMemberClass( unsigned member_num ) const
// the sub-types.
hid_t CompType::p_get_member_type(unsigned member_num) const
{
- // get the id of the specified member first
- hid_t member_type_id = H5Tget_member_type( id, member_num );
- if( member_type_id > 0 )
- return( member_type_id );
- else
- {
- // p_get_member_type is private, caller will catch this exception
- // then throw another with appropriate API name
- throw DataTypeIException("", "H5Tget_member_type failed");
- }
+ // get the id of the specified member first
+ hid_t member_type_id = H5Tget_member_type(id, member_num);
+ if (member_type_id > 0)
+ return(member_type_id);
+ else
+ {
+ // p_get_member_type is private, caller will catch this exception
+ // then throw another with appropriate API name
+ throw DataTypeIException("", "H5Tget_member_type failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: CompType::getMemberDataType
-///\brief Returns the generic datatype of the specified member in this
-/// compound datatype.
-///\param member_num - IN: Zero-based index of the member
-///\return DataType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CompType::getMemberDataType
+///\brief Returns the generic datatype of the specified member in this
+/// compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return DataType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType CompType::getMemberDataType( unsigned member_num ) const
+DataType CompType::getMemberDataType(unsigned member_num) const
{
- try {
- DataType datatype;
- f_DataType_setId(&datatype, p_get_member_type(member_num));
- return(datatype);
- }
- catch (DataTypeIException& E) {
- throw DataTypeIException("CompType::getMemberDataType", E.getDetailMsg());
- }
+ try {
+ DataType datatype;
+ f_DataType_setId(&datatype, p_get_member_type(member_num));
+ return(datatype);
+ }
+ catch (DataTypeIException& E) {
+ throw DataTypeIException("CompType::getMemberDataType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: CompType::getMemberArrayType
-///\brief Returns the array datatype of the specified member in this
-/// compound datatype.
-///\param member_num - IN: Zero-based index of the member
-///\return ArrayType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Jul, 2005
+// Function: CompType::getMemberArrayType
+///\brief Returns the array datatype of the specified member in this
+/// compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return ArrayType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-ArrayType CompType::getMemberArrayType( unsigned member_num ) const
+ArrayType CompType::getMemberArrayType(unsigned member_num) const
{
- try {
- ArrayType arraytype(p_get_member_type(member_num));
- f_DataType_setId(&arraytype, p_get_member_type(member_num));
- return(arraytype);
- }
- catch (DataTypeIException& E) {
- throw DataTypeIException("CompType::getMemberArrayType", E.getDetailMsg());
- }
+ try {
+ ArrayType arraytype(p_get_member_type(member_num));
+ f_DataType_setId(&arraytype, p_get_member_type(member_num));
+ return(arraytype);
+ }
+ catch (DataTypeIException& E) {
+ throw DataTypeIException("CompType::getMemberArrayType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: CompType::getMemberCompType
-///\brief Returns the compound datatype of the specified member in this
-/// compound datatype.
-///\param member_num - IN: Zero-based index of the member
-///\return CompType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CompType::getMemberCompType
+///\brief Returns the compound datatype of the specified member in this
+/// compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return CompType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-CompType CompType::getMemberCompType( unsigned member_num ) const
+CompType CompType::getMemberCompType(unsigned member_num) const
{
try {
CompType comptype(p_get_member_type(member_num));
- f_DataType_setId(&comptype, p_get_member_type(member_num));
+ f_DataType_setId(&comptype, p_get_member_type(member_num));
return(comptype);
- }
- catch (DataTypeIException& E) {
- throw DataTypeIException("CompType::getMemberCompType", E.getDetailMsg());
- }
+ }
+ catch (DataTypeIException& E) {
+ throw DataTypeIException("CompType::getMemberCompType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: CompType::getMemberEnumType
-///\brief Returns the enumeration datatype of the specified member in
-/// this compound datatype.
-///\param member_num - IN: Zero-based index of the member
-///\return EnumType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CompType::getMemberEnumType
+///\brief Returns the enumeration datatype of the specified member in
+/// this compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return EnumType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType CompType::getMemberEnumType( unsigned member_num ) const
+EnumType CompType::getMemberEnumType(unsigned member_num) const
{
try {
EnumType enumtype(p_get_member_type(member_num));
- f_DataType_setId(&enumtype, p_get_member_type(member_num));
+ f_DataType_setId(&enumtype, p_get_member_type(member_num));
return(enumtype);
- }
- catch (DataTypeIException& E) {
- throw DataTypeIException("CompType::getMemberEnumType", E.getDetailMsg());
- }
+ }
+ catch (DataTypeIException& E) {
+ throw DataTypeIException("CompType::getMemberEnumType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: CompType::getMemberIntType
-///\brief Returns the integer datatype of the specified member in this
-/// compound datatype.
-///\param member_num - IN: Zero-based index of the member
-///\return IntType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CompType::getMemberIntType
+///\brief Returns the integer datatype of the specified member in this
+/// compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return IntType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType CompType::getMemberIntType( unsigned member_num ) const
+IntType CompType::getMemberIntType(unsigned member_num) const
{
try {
IntType inttype(p_get_member_type(member_num));
- f_DataType_setId(&inttype, p_get_member_type(member_num));
+ f_DataType_setId(&inttype, p_get_member_type(member_num));
return(inttype);
- }
- catch (DataTypeIException& E) {
- throw DataTypeIException("CompType::getMemberIntType", E.getDetailMsg());
- }
+ }
+ catch (DataTypeIException& E) {
+ throw DataTypeIException("CompType::getMemberIntType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: CompType::getMemberFloatType
-///\brief Returns the floating-point datatype of the specified member
-/// in this compound datatype.
-///\param member_num - IN: Zero-based index of the member
-///\return FloatType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CompType::getMemberFloatType
+///\brief Returns the floating-point datatype of the specified member
+/// in this compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return FloatType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType CompType::getMemberFloatType( unsigned member_num ) const
+FloatType CompType::getMemberFloatType(unsigned member_num) const
{
try {
FloatType floatype(p_get_member_type(member_num));
- f_DataType_setId(&floatype, p_get_member_type(member_num));
+ f_DataType_setId(&floatype, p_get_member_type(member_num));
return(floatype);
- }
- catch (DataTypeIException& E) {
- throw DataTypeIException("CompType::getMemberFloatType", E.getDetailMsg());
- }
+ }
+ catch (DataTypeIException& E) {
+ throw DataTypeIException("CompType::getMemberFloatType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: CompType::getMemberStrType
-///\brief Returns the string datatype of the specified member in this
-/// compound datatype.
-///\param member_num - IN: Zero-based index of the member
-///\return StrType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CompType::getMemberStrType
+///\brief Returns the string datatype of the specified member in this
+/// compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return StrType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType CompType::getMemberStrType( unsigned member_num ) const
+StrType CompType::getMemberStrType(unsigned member_num) const
{
try {
StrType strtype(p_get_member_type(member_num));
- f_DataType_setId(&strtype, p_get_member_type(member_num));
+ f_DataType_setId(&strtype, p_get_member_type(member_num));
return(strtype);
- }
- catch (DataTypeIException& E) {
- throw DataTypeIException("CompType::getMemberStrType", E.getDetailMsg());
- }
+ }
+ catch (DataTypeIException& E) {
+ throw DataTypeIException("CompType::getMemberStrType", E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: CompType::getMemberVarLenType
-///\brief Returns the variable length datatype of the specified member
-/// in this compound datatype.
-///\param member_num - IN: Zero-based index of the member
-///\return VarLenType instance
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Jul, 2005
+// Function: CompType::getMemberVarLenType
+///\brief Returns the variable length datatype of the specified member
+/// in this compound datatype.
+///\param member_num - IN: Zero-based index of the member
+///\return VarLenType instance
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-VarLenType CompType::getMemberVarLenType( unsigned member_num ) const
+VarLenType CompType::getMemberVarLenType(unsigned member_num) const
{
try {
VarLenType varlentype(p_get_member_type(member_num));
- f_DataType_setId(&varlentype, p_get_member_type(member_num));
+ f_DataType_setId(&varlentype, p_get_member_type(member_num));
return(varlentype);
- }
- catch (DataTypeIException& E) {
- throw DataTypeIException("CompType::getMemberVarLenType", E.getDetailMsg());
- }
+ }
+ catch (DataTypeIException& E) {
+ throw DataTypeIException("CompType::getMemberVarLenType", E.getDetailMsg());
+ }
}
/* old style of getMemberType - using overloads; new style above
@@ -424,27 +424,27 @@ VarLenType CompType::getMemberVarLenType( unsigned member_num ) const
May, 2004: These should be reconsidered to provide more convenience.
// Returns the datatype of the specified member in this compound datatype.
// Several overloading of getMemberType are for different datatypes
-void CompType::getMemberType( unsigned member_num, EnumType& enumtype ) const
+void CompType::getMemberType(unsigned member_num, EnumType& enumtype) const
{
p_get_member_type(member_num, enumtype);
}
-void CompType::getMemberType( unsigned member_num, CompType& comptype ) const
+void CompType::getMemberType(unsigned member_num, CompType& comptype) const
{
p_get_member_type(member_num, comptype);
}
-void CompType::getMemberType( unsigned member_num, IntType& inttype ) const
+void CompType::getMemberType(unsigned member_num, IntType& inttype) const
{
p_get_member_type(member_num, inttype);
}
-void CompType::getMemberType( unsigned member_num, FloatType& floatype ) const
+void CompType::getMemberType(unsigned member_num, FloatType& floatype) const
{
p_get_member_type(member_num, floatype);
}
-void CompType::getMemberType( unsigned member_num, StrType& strtype ) const
+void CompType::getMemberType(unsigned member_num, StrType& strtype) const
{
p_get_member_type(member_num, strtype);
}
@@ -452,55 +452,55 @@ void CompType::getMemberType( unsigned member_num, StrType& strtype ) const
*/
//--------------------------------------------------------------------------
-// Function: CompType::insertMember
-///\brief Inserts a new member to this compound datatype.
-///\param name - IN: Name of the new member
-///\param offset - IN: Offset in memory structure of the field to insert
-///\param new_member - IN: New member to be inserted
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: CompType::insertMember
+///\brief Inserts a new member to this compound datatype.
+///\param name - IN: Name of the new member
+///\param offset - IN: Offset in memory structure of the field to insert
+///\param new_member - IN: New member to be inserted
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void CompType::insertMember( const H5std_string& name, size_t offset, const DataType& new_member ) const
+void CompType::insertMember(const H5std_string& name, size_t offset, const DataType& new_member) const
{
- // Convert string to C-string
- const char* name_C;
- name_C = name.c_str(); // name_C refers to the contents of name as a C-str
-
- hid_t new_member_id = new_member.getId(); // get new_member id for C API
-
- // Call C routine H5Tinsert to add the new member
- herr_t ret_value = H5Tinsert( id, name_C, offset, new_member_id );
- if( ret_value < 0 )
- {
- throw DataTypeIException("CompType::insertMember", "H5Tinsert failed");
- }
+ // Convert string to C-string
+ const char* name_C;
+ name_C = name.c_str(); // name_C refers to the contents of name as a C-str
+
+ hid_t new_member_id = new_member.getId(); // get new_member id for C API
+
+ // Call C routine H5Tinsert to add the new member
+ herr_t ret_value = H5Tinsert(id, name_C, offset, new_member_id);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException("CompType::insertMember", "H5Tinsert failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: CompType::pack
-///\brief Recursively removes padding from within a compound datatype.
+// Function: CompType::pack
+///\brief Recursively removes padding from within a compound datatype.
///
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void CompType::pack() const
{
- // Calls C routine H5Tpack to remove padding
- herr_t ret_value = H5Tpack( id );
- if( ret_value < 0 )
- {
- throw DataTypeIException("CompType::pack", "H5Tpack failed");
- }
+ // Calls C routine H5Tpack to remove padding
+ herr_t ret_value = H5Tpack(id);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException("CompType::pack", "H5Tpack failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: CompType::setSize
-///\brief Sets the total size for this compound datatype.
-///\param size - IN: Size to set
-///\exception H5::DataTypeIException
+// Function: CompType::setSize
+///\brief Sets the total size for this compound datatype.
+///\param size - IN: Size to set
+///\exception H5::DataTypeIException
// Note
-// H5Tset_size works on atom datatypes and compound datatypes only
-// Programmer Binh-Minh Ribler - 2014
+// H5Tset_size works on atom datatypes and compound datatypes only
+// Programmer Binh-Minh Ribler - 2014
//--------------------------------------------------------------------------
void CompType::setSize(size_t size) const
{
@@ -508,7 +508,7 @@ void CompType::setSize(size_t size) const
herr_t ret_value = H5Tset_size(id, size);
if (ret_value < 0)
{
- throw DataTypeIException("CompType::setSize", "H5Tset_size failed");
+ throw DataTypeIException("CompType::setSize", "H5Tset_size failed");
}
}
diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h
index 3337df7..222044d 100644
--- a/c++/src/H5CompType.h
+++ b/c++/src/H5CompType.h
@@ -27,94 +27,94 @@ namespace H5 {
*/
class H5_DLLCPP CompType : public DataType {
public:
- // Default constructor
- CompType();
+ // Default constructor
+ CompType();
- // Creates a compound datatype using an existing id
- CompType( const hid_t existing_id );
+ // Creates a compound datatype using an existing id
+ CompType(const hid_t existing_id);
- // Creates a new compound datatype, given the type's size
- CompType( size_t size ); // H5Tcreate
+ // Creates a new compound datatype, given the type's size
+ CompType(size_t size); // H5Tcreate
- // Gets the compound datatype of the specified dataset
- CompType( const DataSet& dataset ); // H5Dget_type
+ // Gets the compound datatype of the specified dataset
+ CompType(const DataSet& dataset); // H5Dget_type
- // Copy constructor - makes a copy of original object
- CompType( const CompType& original );
+ // Copy constructor - makes a copy of original object
+ CompType(const CompType& original);
- // Constructors that open a compound datatype, given a location.
- CompType(const H5Location& loc, const char* name);
- CompType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open a compound datatype, given a location.
+ CompType(const H5Location& loc, const char* name);
+ CompType(const H5Location& loc, const H5std_string& name);
- // Returns the type class of the specified member of this compound
- // datatype. It provides to the user a way of knowing what type
- // to create another datatype of the same class
- H5T_class_t getMemberClass( unsigned member_num ) const;
+ // Returns the type class of the specified member of this compound
+ // datatype. It provides to the user a way of knowing what type
+ // to create another datatype of the same class
+ H5T_class_t getMemberClass(unsigned member_num) const;
- // Returns the index of a member in this compound data type.
- int getMemberIndex(const char* name) const;
- int getMemberIndex(const H5std_string& name) const;
+ // Returns the index of a member in this compound data type.
+ int getMemberIndex(const char* name) const;
+ int getMemberIndex(const H5std_string& name) const;
- // Returns the offset of a member of this compound datatype.
- size_t getMemberOffset( unsigned memb_no ) const;
+ // Returns the offset of a member of this compound datatype.
+ size_t getMemberOffset(unsigned memb_no) const;
- // Returns the name of a member of this compound datatype.
- H5std_string getMemberName( unsigned member_num ) const;
+ // Returns the name of a member of this compound datatype.
+ H5std_string getMemberName(unsigned member_num) const;
- // Returns the generic datatype of the specified member in
- // this compound datatype.
- DataType getMemberDataType( unsigned member_num ) const;
+ // Returns the generic datatype of the specified member in
+ // this compound datatype.
+ DataType getMemberDataType(unsigned member_num) const;
- // Returns the array datatype of the specified member in
- // this compound datatype.
- ArrayType getMemberArrayType( unsigned member_num ) const;
+ // Returns the array datatype of the specified member in
+ // this compound datatype.
+ ArrayType getMemberArrayType(unsigned member_num) const;
- // Returns the compound datatype of the specified member in
- // this compound datatype.
- CompType getMemberCompType( unsigned member_num ) const;
+ // Returns the compound datatype of the specified member in
+ // this compound datatype.
+ CompType getMemberCompType(unsigned member_num) const;
- // Returns the enumeration datatype of the specified member in
- // this compound datatype.
- EnumType getMemberEnumType( unsigned member_num ) const;
+ // Returns the enumeration datatype of the specified member in
+ // this compound datatype.
+ EnumType getMemberEnumType(unsigned member_num) const;
- // Returns the integer datatype of the specified member in
- // this compound datatype.
- IntType getMemberIntType( unsigned member_num ) const;
+ // Returns the integer datatype of the specified member in
+ // this compound datatype.
+ IntType getMemberIntType(unsigned member_num) const;
- // Returns the floating-point datatype of the specified member in
- // this compound datatype.
- FloatType getMemberFloatType( unsigned member_num ) const;
+ // Returns the floating-point datatype of the specified member in
+ // this compound datatype.
+ FloatType getMemberFloatType(unsigned member_num) const;
- // Returns the string datatype of the specified member in
- // this compound datatype.
- StrType getMemberStrType( unsigned member_num ) const;
+ // Returns the string datatype of the specified member in
+ // this compound datatype.
+ StrType getMemberStrType(unsigned member_num) const;
- // Returns the variable length datatype of the specified member in
- // this compound datatype.
- VarLenType getMemberVarLenType( unsigned member_num ) const;
+ // Returns the variable length datatype of the specified member in
+ // this compound datatype.
+ VarLenType getMemberVarLenType(unsigned member_num) const;
- // Returns the number of members in this compound datatype.
- int getNmembers() const;
+ // Returns the number of members in this compound datatype.
+ int getNmembers() const;
- // Adds a new member to this compound datatype.
- void insertMember( const H5std_string& name, size_t offset, const DataType& new_member ) const;
+ // Adds a new member to this compound datatype.
+ void insertMember(const H5std_string& name, size_t offset, const DataType& new_member) const;
- // Recursively removes padding from within this compound datatype.
- void pack() const;
+ // Recursively removes padding from within this compound datatype.
+ void pack() const;
- // Sets the total size for this compound datatype.
- void setSize(size_t size) const;
+ // Sets the total size for this compound datatype.
+ void setSize(size_t size) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("CompType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("CompType"); }
- // Noop destructor.
- virtual ~CompType();
+ // Noop destructor.
+ virtual ~CompType();
private:
- // Contains common code that is used by the member functions
- // getMemberXxxType
- hid_t p_get_member_type(unsigned member_num) const;
+ // Contains common code that is used by the member functions
+ // getMemberXxxType
+ hid_t p_get_member_type(unsigned member_num) const;
};
}
#endif // __H5CompType_H
diff --git a/c++/src/H5CppDoc.h b/c++/src/H5CppDoc.h
index 2420586..afc6ebf 100644
--- a/c++/src/H5CppDoc.h
+++ b/c++/src/H5CppDoc.h
@@ -67,34 +67,34 @@
* <br />
*/
-/// This example shows how to create datasets.
+/// This example shows how to create datasets.
///\par
///\example create.cpp
///\par
-/// This example shows how to write datasets.
+/// This example shows how to write datasets.
///\example writedata.cpp
///\par
-/// This example shows how to read datasets.
+/// This example shows how to read datasets.
///\example readdata.cpp
///\par
-/// This example shows how to create a compound datatype,
-/// write an array which has the compound datatype to the file,
-/// and read back fields' subsets.
+/// This example shows how to create a compound datatype,
+/// write an array which has the compound datatype to the file,
+/// and read back fields' subsets.
///\example compound.cpp
///\par
-/// This example shows how to work with extendible datasets.
+/// This example shows how to work with extendible datasets.
///\example extend_ds.cpp
///\par
-/// This example shows how to read data from a chunked dataset.
+/// This example shows how to read data from a chunked dataset.
///\example chunks.cpp
///\par
-/// This example shows how to work with groups.
+/// This example shows how to work with groups.
///\example h5group.cpp
#endif // __H5CppDoc_H
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 7c5b994..a0db328 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -20,7 +20,7 @@
#endif
#include <string>
-#include "H5private.h" // for HDfree
+#include "H5private.h" // for HDfree
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -44,23 +44,23 @@ using std::cerr;
using std::endl;
//--------------------------------------------------------------------------
-// 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)
{
@@ -68,10 +68,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)
{
@@ -79,22 +79,22 @@ 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
-///\param plist - IN: Property list - default to PropList::DEFAULT
-///\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
+///\param plist - IN: Property list - default to PropList::DEFAULT
+///\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, const PropList& plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
{
@@ -102,18 +102,18 @@ DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, co
}
//--------------------------------------------------------------------------
-// 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
-///\param plist - IN: Property list - default to PropList::DEFAULT
-///\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
+///\param plist - IN: Property list - default to PropList::DEFAULT
+///\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, const PropList& plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
{
@@ -121,26 +121,26 @@ DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, co
}
//--------------------------------------------------------------------------
-// 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
@@ -148,57 +148,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
{
@@ -206,9 +206,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
@@ -216,22 +216,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,
@@ -239,18 +239,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
@@ -259,184 +259,184 @@ 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
//--------------------------------------------------------------------------
-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));
//}
//--------------------------------------------------------------------------
-// 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
{
@@ -465,47 +465,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.
@@ -515,11 +515,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;
@@ -529,12 +529,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)
{
@@ -543,65 +543,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
@@ -610,28 +610,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)
//{
@@ -639,39 +639,39 @@ 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
//--------------------------------------------------------------------------
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)
//{
@@ -680,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
@@ -691,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
{
@@ -715,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
{
@@ -751,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
@@ -805,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;
}
}
diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h
index ee9ef28..93f9782 100644
--- a/c++/src/H5DataSet.h
+++ b/c++/src/H5DataSet.h
@@ -31,82 +31,82 @@ namespace H5 {
class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
public:
- // Close this dataset.
- virtual void close();
+ // Close this dataset.
+ virtual void close();
- // Extends the dataset with unlimited dimension.
- void extend( const hsize_t* size ) const;
+ // 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, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const;
- //void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
+ // Fills a selection in memory with a value
+ void fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const;
+ //void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
- // Fills a selection in memory with zero
- void fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& space) const;
- //void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
+ // Fills a selection in memory with zero
+ void fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& space) const;
+ //void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1
- // Gets the creation property list of this dataset.
- DSetCreatPropList getCreatePlist() const;
+ // Gets the creation property list of this dataset.
+ DSetCreatPropList getCreatePlist() const;
- // Returns the address of this dataset in the file.
- haddr_t getOffset() const;
+ // Returns the address of this dataset in the file.
+ haddr_t getOffset() const;
- // Gets the dataspace of this dataset.
- virtual DataSpace getSpace() const;
+ // Gets the dataspace of this dataset.
+ virtual DataSpace getSpace() const;
- // Determines whether space has been allocated for a dataset.
- void getSpaceStatus(H5D_space_status_t& status) const;
+ // Determines whether space has been allocated for a dataset.
+ void getSpaceStatus(H5D_space_status_t& status) const;
- // Returns the amount of storage size required for this dataset.
- virtual hsize_t getStorageSize() const;
+ // Returns the amount of storage size required for this dataset.
+ virtual hsize_t getStorageSize() const;
- // Returns the in memory size of this attribute's data.
- virtual size_t getInMemDataSize() const;
+ // Returns the in memory size of this attribute's data.
+ virtual size_t getInMemDataSize() const;
- // Returns the number of bytes required to store VL data.
- hsize_t getVlenBufSize(const DataType& type, const DataSpace& space ) const;
- //hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // removed from 1.8.18 and 1.10.1
+ // Returns the number of bytes required to store VL data.
+ hsize_t getVlenBufSize(const DataType& type, const DataSpace& space) const;
+ //hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // removed from 1.8.18 and 1.10.1
- // Reclaims VL datatype memory buffers.
- static void vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf );
- static void vlenReclaim(void *buf, const DataType& type, const DataSpace& space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT);
+ // Reclaims VL datatype memory buffers.
+ static void vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf);
+ static void vlenReclaim(void *buf, const DataType& type, const DataSpace& space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT);
- // Reads the data of this dataset and stores it in the provided buffer.
- // The memory and file dataspaces and the transferring property list
- // can be defaults.
- 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;
- 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;
+ // Reads the data of this dataset and stores it in the provided buffer.
+ // The memory and file dataspaces and the transferring property list
+ // can be defaults.
+ 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;
+ 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;
- // Writes the buffered data to this dataset.
- // The memory and file dataspaces and the transferring property list
- // can be defaults.
- 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;
- 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;
+ // Writes the buffered data to this dataset.
+ // The memory and file dataspaces and the transferring property list
+ // can be defaults.
+ 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;
+ 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;
- // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet
- int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL );
+ // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet
+ int iterateElems(void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL);
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DataSet"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("DataSet"); }
- // Creates a dataset by way of dereference.
- DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
- DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
+ // Creates a dataset by way of dereference.
+ DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
+ DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
- // Default constructor.
- DataSet();
+ // Default constructor.
+ DataSet();
- // Copy constructor.
- DataSet( const DataSet& original );
+ // Copy constructor.
+ DataSet(const DataSet& original);
- // Creates a copy of an existing DataSet using its id.
- DataSet(const hid_t existing_id);
+ // Creates a copy of an existing DataSet using its id.
+ DataSet(const hid_t existing_id);
// Gets the dataset id.
virtual hid_t getId() const;
- // Destructor: properly terminates access to this dataset.
- virtual ~DataSet();
+ // Destructor: properly terminates access to this dataset.
+ virtual ~DataSet();
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -115,20 +115,20 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
#endif // DOXYGEN_SHOULD_SKIP_THIS
private:
- hid_t id; // HDF5 dataset id
+ hid_t id; // HDF5 dataset id
// This function contains the common code that is used by
// getTypeClass and various API functions getXxxType
// defined in AbstractDs for generic datatype and specific
// sub-types
- virtual hid_t p_get_type() const;
+ virtual hid_t p_get_type() const;
- // Reads variable or fixed len strings from this dataset.
- 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;
- 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;
+ // Reads variable or fixed len strings from this dataset.
+ 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;
+ 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;
- // Friend function to set DataSet id. For library use only.
- friend void f_DataSet_setId(DataSet* dset, hid_t new_id);
+ // Friend function to set DataSet id. For library use only.
+ friend void f_DataSet_setId(DataSet* dset, hid_t new_id);
};
}
diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp
index cb479e1..2587a72 100644
--- a/c++/src/H5DataSpace.cpp
+++ b/c++/src/H5DataSpace.cpp
@@ -38,14 +38,14 @@ using std::endl;
DataSpace* DataSpace::ALL_ = 0;
//--------------------------------------------------------------------------
-// Function: DataSpace::getConstant
-// Creates a DataSpace object representing the HDF5 constant
-// H5S_ALL, pointed to by DataSpace::ALL_
-// Exception H5::DataSpaceIException
+// Function: DataSpace::getConstant
+// Creates a DataSpace object representing the HDF5 constant
+// H5S_ALL, pointed to by DataSpace::ALL_
+// Exception H5::DataSpaceIException
// Description
-// If DataSpace::ALL_ already points to an allocated object, throw
-// a DataSpaceIException. This scenario should not happen.
-// Programmer Binh-Minh Ribler - 2015
+// If DataSpace::ALL_ already points to an allocated object, throw
+// a DataSpaceIException. This scenario should not happen.
+// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
DataSpace* DataSpace::getConstant()
{
@@ -78,55 +78,55 @@ void DataSpace::deleteConstants()
}
//--------------------------------------------------------------------------
-// Purpose Constant for default dataspace.
+// Purpose Constant for default dataspace.
//--------------------------------------------------------------------------
const DataSpace& DataSpace::ALL = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: DataSpace constructor
-///\brief Creates a new dataspace given a dataspace type.
-///\param type - IN: Type of the dataspace to be created, which
-/// currently can be either \c H5S_SCALAR or \c H5S_SIMPLE;
-/// default to \c H5S_SCALAR.
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace constructor
+///\brief Creates a new dataspace given a dataspace type.
+///\param type - IN: Type of the dataspace to be created, which
+/// currently can be either \c H5S_SCALAR or \c H5S_SIMPLE;
+/// default to \c H5S_SCALAR.
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSpace::DataSpace(H5S_class_t type) : IdComponent()
{
- id = H5Screate( type );
- if( id < 0 )
- {
- throw DataSpaceIException("DataSpace constructor", "H5Screate failed");
- }
+ id = H5Screate(type);
+ if (id < 0)
+ {
+ throw DataSpaceIException("DataSpace constructor", "H5Screate failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSpace overloaded constructor
-///\brief Creates a new simple dataspace.
-///\param rank - IN: Number of dimensions of dataspace.
-///\param dims - IN: An array of the size of each dimension.
-///\param maxdims - IN: An array of the maximum size of each dimension.
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace overloaded constructor
+///\brief Creates a new simple dataspace.
+///\param rank - IN: Number of dimensions of dataspace.
+///\param dims - IN: An array of the size of each dimension.
+///\param maxdims - IN: An array of the maximum size of each dimension.
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSpace::DataSpace( int rank, const hsize_t * dims, const hsize_t * maxdims) : IdComponent()
+DataSpace::DataSpace(int rank, const hsize_t * dims, const hsize_t * maxdims) : IdComponent()
{
- id = H5Screate_simple( rank, dims, maxdims );
- if( id < 0 )
- {
- throw DataSpaceIException("DataSpace constructor", "H5Screate_simple failed");
- }
+ id = H5Screate_simple(rank, dims, maxdims);
+ if (id < 0)
+ {
+ throw DataSpaceIException("DataSpace constructor", "H5Screate_simple failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSpace overloaded constructor
-///\brief Creates a DataSpace object using the id of an existing
-/// dataspace.
-///\param existing_id - IN: Id of an existing dataspace
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace overloaded constructor
+///\brief Creates a DataSpace object using the id of an existing
+/// dataspace.
+///\param existing_id - IN: Id of an existing dataspace
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSpace::DataSpace(const hid_t existing_id) : IdComponent(), id(existing_id)
{
@@ -134,10 +134,10 @@ DataSpace::DataSpace(const hid_t existing_id) : IdComponent(), id(existing_id)
}
//--------------------------------------------------------------------------
-// Function: DataSpace copy constructor
-///\brief Copy constructor: makes a copy of the original DataSpace object.
-///\param original - IN: DataSpace object to copy
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace copy constructor
+///\brief Copy constructor: makes a copy of the original DataSpace object.
+///\param original - IN: DataSpace object to copy
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSpace::DataSpace(const DataSpace& original) : IdComponent(), id(original.id)
{
@@ -145,48 +145,48 @@ DataSpace::DataSpace(const DataSpace& original) : IdComponent(), id(original.id)
}
//--------------------------------------------------------------------------
-// Function: DataSpace::copy
-///\brief Makes a copy of an existing dataspace.
-///\param like_space - IN: Dataspace to be copied
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace::copy
+///\brief Makes a copy of an existing dataspace.
+///\param like_space - IN: Dataspace to be copied
+///\exception H5::DataSpaceIException
+// 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
-//--------------------------------------------------------------------------
-void DataSpace::copy( const DataSpace& like_space )
-{
- // If this object has an hdf5 valid id, close it
- if( id != H5S_ALL ) {
- try {
- close();
- }
- catch (Exception& close_error) {
+// - 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
+//--------------------------------------------------------------------------
+void DataSpace::copy(const DataSpace& like_space)
+{
+ // If this object has an hdf5 valid id, close it
+ if (id != H5S_ALL) {
+ try {
+ close();
+ }
+ catch (Exception& close_error) {
throw DataSpaceIException("DataSpace::copy", close_error.getDetailMsg());
- }
- } // end if
+ }
+ } // end if
- // call C routine to copy the dataspace
- id = H5Scopy( like_space.getId() );
+ // call C routine to copy the dataspace
+ id = H5Scopy(like_space.getId());
- if( id < 0 )
- throw DataSpaceIException("DataSpace::copy", "H5Scopy failed");
+ if (id < 0)
+ throw DataSpaceIException("DataSpace::copy", "H5Scopy failed");
}
//--------------------------------------------------------------------------
-// Function: DataSpace::operator=
-///\brief Assignment operator.
-///\param rhs - IN: Reference to the existing dataspace
-///\return Reference to DataSpace instance
-///\exception H5::DataSpaceIException
+// Function: DataSpace::operator=
+///\brief Assignment operator.
+///\param rhs - IN: Reference to the existing dataspace
+///\return Reference to DataSpace instance
+///\exception H5::DataSpaceIException
// Description
-// Makes a copy of the type on the right hand side and stores
-// the new id in the left hand side object.
-// Programmer Binh-Minh Ribler - 2000
+// Makes a copy of the type on the right hand side and stores
+// the new id in the left hand side object.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSpace& DataSpace::operator=( const DataSpace& rhs )
+DataSpace& DataSpace::operator=(const DataSpace& rhs)
{
if (this != &rhs)
copy(rhs);
@@ -194,435 +194,434 @@ DataSpace& DataSpace::operator=( const DataSpace& rhs )
}
//--------------------------------------------------------------------------
-// Function: DataSpace::isSimple
-///\brief Determines whether this dataspace is a simple dataspace.
-///\return \c true if the dataspace is a simple dataspace, and \c false,
-/// otherwise
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace::isSimple
+///\brief Determines whether this dataspace is a simple dataspace.
+///\return \c true if the dataspace is a simple dataspace, and \c false,
+/// otherwise
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
bool DataSpace::isSimple () const
{
- htri_t simple = H5Sis_simple( id );
- if( simple > 0 )
- return true;
- else if( simple == 0 )
- return false;
- else
- {
- throw DataSpaceIException("DataSpace::isSimple",
- "H5Sis_simple returns negative value");
- }
+ htri_t simple = H5Sis_simple(id);
+ if (simple > 0)
+ return true;
+ else if (simple == 0)
+ return false;
+ else
+ {
+ throw DataSpaceIException("DataSpace::isSimple",
+ "H5Sis_simple returns negative value");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSpace::offsetSimple
-///\brief Sets the offset of this simple dataspace.
-///\param offset - IN: Offset to position the selection at
-///\exception H5::DataSpaceIException
+// Function: DataSpace::offsetSimple
+///\brief Sets the offset of this simple dataspace.
+///\param offset - IN: Offset to position the selection at
+///\exception H5::DataSpaceIException
///\par Description
-/// This function creates an offset for the selection within
-/// an extent, allowing the same shaped selection to be moved
-/// to different locations within a dataspace without requiring
-/// it to be re-defined.
-// Programmer Binh-Minh Ribler - 2000
+/// This function creates an offset for the selection within
+/// an extent, allowing the same shaped selection to be moved
+/// to different locations within a dataspace without requiring
+/// it to be re-defined.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::offsetSimple ( const hssize_t* offset ) const
+void DataSpace::offsetSimple (const hssize_t* offset) const
{
- herr_t ret_value = H5Soffset_simple( id, offset );
- if( ret_value < 0 )
- {
- throw DataSpaceIException("DataSpace::offsetSimple", "H5Soffset_simple failed");
- }
+ herr_t ret_value = H5Soffset_simple(id, offset);
+ if (ret_value < 0)
+ {
+ throw DataSpaceIException("DataSpace::offsetSimple", "H5Soffset_simple failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSpace::getSimpleExtentDims
-///\brief Retrieves dataspace dimension size and maximum size.
-///\param dims - IN: Name of the new member
-///\param maxdims - IN: Pointer to the value of the new member
-///\return Number of dimensions, the same value as returned by
-/// \c DataSpace::getSimpleExtentNdims()
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace::getSimpleExtentDims
+///\brief Retrieves dataspace dimension size and maximum size.
+///\param dims - IN: Name of the new member
+///\param maxdims - IN: Pointer to the value of the new member
+///\return Number of dimensions, the same value as returned by
+/// \c DataSpace::getSimpleExtentNdims()
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int DataSpace::getSimpleExtentDims ( hsize_t *dims, hsize_t *maxdims ) const
+int DataSpace::getSimpleExtentDims (hsize_t *dims, hsize_t *maxdims) const
{
- int ndims = H5Sget_simple_extent_dims( id, dims, maxdims );
- if( ndims < 0 )
- {
- throw DataSpaceIException("DataSpace::getSimpleExtentDims",
- "H5Sget_simple_extent_dims returns negative number of dimensions");
- }
- return( ndims );
+ int ndims = H5Sget_simple_extent_dims(id, dims, maxdims);
+ if (ndims < 0)
+ {
+ throw DataSpaceIException("DataSpace::getSimpleExtentDims",
+ "H5Sget_simple_extent_dims returns negative number of dimensions");
+ }
+ return(ndims);
}
//--------------------------------------------------------------------------
-// Function: DataSpace::getSimpleExtentNdims
-///\brief Returns the dimensionality of a dataspace.
-///\return Number of dimensions
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace::getSimpleExtentNdims
+///\brief Returns the dimensionality of a dataspace.
+///\return Number of dimensions
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int DataSpace::getSimpleExtentNdims () const
{
- int ndims = H5Sget_simple_extent_ndims( id );
- if( ndims < 0 )
- {
- throw DataSpaceIException("DataSpace::getSimpleExtentNdims",
- "H5Sget_simple_extent_ndims returns negative value for dimensionality of the dataspace");
- }
- return( ndims );
+ int ndims = H5Sget_simple_extent_ndims(id);
+ if (ndims < 0)
+ {
+ throw DataSpaceIException("DataSpace::getSimpleExtentNdims",
+ "H5Sget_simple_extent_ndims returns negative value for dimensionality of the dataspace");
+ }
+ return(ndims);
}
//--------------------------------------------------------------------------
-// Function: DataSpace::getSimpleExtentNpoints
-///\brief Returns the number of elements in a dataspace.
-///\return Number of elements
-///\exception H5::DataSpaceIException
+// Function: DataSpace::getSimpleExtentNpoints
+///\brief Returns the number of elements in a dataspace.
+///\return Number of elements
+///\exception H5::DataSpaceIException
// Modification
-// 12/05/00: due to C API change
-// return type hssize_t vs. hsize_t
-// num_elements = -1 when failure occurs vs. 0
-// Programmer Binh-Minh Ribler - 2000
+// 12/05/00: due to C API change
+// return type hssize_t vs. hsize_t
+// num_elements = -1 when failure occurs vs. 0
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
hssize_t DataSpace::getSimpleExtentNpoints () const
{
- hssize_t num_elements = H5Sget_simple_extent_npoints( id );
-
- if( num_elements > -1 )
- return( num_elements );
- else
- {
- throw DataSpaceIException("DataSpace::getSimpleExtentNpoints",
- "H5Sget_simple_extent_npoints returns negative value for the number of elements in the dataspace");
- }
+ hssize_t num_elements = H5Sget_simple_extent_npoints(id);
+ if (num_elements > -1)
+ return(num_elements);
+ else
+ {
+ throw DataSpaceIException("DataSpace::getSimpleExtentNpoints",
+ "H5Sget_simple_extent_npoints returns negative value for the number of elements in the dataspace");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSpace::getSimpleExtentType
-///\brief Returns the current class of a dataspace.
-///\return Class of the dataspace
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace::getSimpleExtentType
+///\brief Returns the current class of a dataspace.
+///\return Class of the dataspace
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5S_class_t DataSpace::getSimpleExtentType () const
{
- H5S_class_t class_name = H5Sget_simple_extent_type( id );
- if( class_name == H5S_NO_CLASS )
- {
- throw DataSpaceIException("DataSpace::getSimpleExtentType",
- "H5Sget_simple_extent_type returns H5S_NO_CLASS");
- }
- return( class_name );
+ H5S_class_t class_name = H5Sget_simple_extent_type(id);
+ if (class_name == H5S_NO_CLASS)
+ {
+ throw DataSpaceIException("DataSpace::getSimpleExtentType",
+ "H5Sget_simple_extent_type returns H5S_NO_CLASS");
+ }
+ return(class_name);
}
//--------------------------------------------------------------------------
-// Function: DataSpace::extentCopy
-///\brief Copies the extent of a dataspace.
-///\param dest_space - IN: Dataspace to copy from
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace::extentCopy
+///\brief Copies the extent of a dataspace.
+///\param dest_space - IN: Dataspace to copy from
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::extentCopy (const DataSpace& dest_space) const
{
- hid_t dest_space_id = dest_space.getId();
- herr_t ret_value = H5Sextent_copy( dest_space_id, id );
- if( ret_value < 0 )
- {
- throw DataSpaceIException("DataSpace::extentCopy", "H5Sextent_copy failed");
- }
+ hid_t dest_space_id = dest_space.getId();
+ herr_t ret_value = H5Sextent_copy(dest_space_id, id);
+ if (ret_value < 0)
+ {
+ throw DataSpaceIException("DataSpace::extentCopy", "H5Sextent_copy failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSpace::extentCopy
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const. This wrapper will be removed in future release.
-// Param dest_space - IN: Dataspace to copy from
-// Exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace::extentCopy
+// Purpose This is an overloaded member function, kept for backward
+// compatibility. It differs from the above function in that it
+// misses const. This wrapper will be removed in future release.
+// Param dest_space - IN: Dataspace to copy from
+// Exception H5::DataSpaceIException
+// 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 DataSpace::extentCopy( DataSpace& dest_space ) const
+//void DataSpace::extentCopy(DataSpace& dest_space) const
//{
// extentCopy(dest_space);
//}
//--------------------------------------------------------------------------
-// Function: DataSpace::setExtentSimple
-///\brief Sets or resets the size of an existing dataspace.
-///\param rank - IN: Rank of the dataspace
-///\param current_size - IN: Array containing current size of dataspace
-///\param maximum_size - IN: Array containing maximum size of dataspace
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace::setExtentSimple
+///\brief Sets or resets the size of an existing dataspace.
+///\param rank - IN: Rank of the dataspace
+///\param current_size - IN: Array containing current size of dataspace
+///\param maximum_size - IN: Array containing maximum size of dataspace
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size ) const
+void DataSpace::setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size) const
{
- herr_t ret_value;
- ret_value = H5Sset_extent_simple( id, rank, current_size, maximum_size );
- if( ret_value < 0 )
- {
- throw DataSpaceIException("DataSpace::setExtentSimple", "H5Sset_extent_simple failed");
- }
+ herr_t ret_value;
+ ret_value = H5Sset_extent_simple(id, rank, current_size, maximum_size);
+ if (ret_value < 0)
+ {
+ throw DataSpaceIException("DataSpace::setExtentSimple", "H5Sset_extent_simple failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSpace::setExtentNone
-///\brief Removes the extent from a dataspace.
+// Function: DataSpace::setExtentNone
+///\brief Removes the extent from a dataspace.
///
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::setExtentNone () const
{
- herr_t ret_value = H5Sset_extent_none( id );
- if( ret_value < 0 )
- {
- throw DataSpaceIException("DataSpace::setExtentNone", "H5Sset_extent_none failed");
- }
+ herr_t ret_value = H5Sset_extent_none(id);
+ if (ret_value < 0)
+ {
+ throw DataSpaceIException("DataSpace::setExtentNone", "H5Sset_extent_none failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSpace::getSelectNpoints
-///\brief Returns the number of elements in a dataspace selection.
-///\return Number of elements
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace::getSelectNpoints
+///\brief Returns the number of elements in a dataspace selection.
+///\return Number of elements
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
hssize_t DataSpace::getSelectNpoints () const
{
- hssize_t num_elements = H5Sget_select_npoints( id );
- if( num_elements < 0 )
- {
- throw DataSpaceIException("DataSpace::getSelectNpoints",
- "H5Sget_select_npoints returns negative value for number of elements in the dataspace selection");
- }
- return( num_elements );
+ hssize_t num_elements = H5Sget_select_npoints(id);
+ if (num_elements < 0)
+ {
+ throw DataSpaceIException("DataSpace::getSelectNpoints",
+ "H5Sget_select_npoints returns negative value for number of elements in the dataspace selection");
+ }
+ return(num_elements);
}
//--------------------------------------------------------------------------
-// Function: DataSpace::getSelectHyperNblocks
-///\brief Returns number of hyperslab blocks.
-///\return Number of hyperslab blocks
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace::getSelectHyperNblocks
+///\brief Returns number of hyperslab blocks.
+///\return Number of hyperslab blocks
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
hssize_t DataSpace::getSelectHyperNblocks () const
{
- hssize_t num_blocks = H5Sget_select_hyper_nblocks( id );
- if( num_blocks < 0 )
- {
- throw DataSpaceIException("DataSpace::getSelectHyperNblocks",
- "H5Sget_select_hyper_nblocks returns negative value for the number of hyperslab blocks");
- }
- return( num_blocks );
+ hssize_t num_blocks = H5Sget_select_hyper_nblocks(id);
+ if (num_blocks < 0)
+ {
+ throw DataSpaceIException("DataSpace::getSelectHyperNblocks",
+ "H5Sget_select_hyper_nblocks returns negative value for the number of hyperslab blocks");
+ }
+ return(num_blocks);
}
//--------------------------------------------------------------------------
-// Function: DataSpace::getSelectHyperBlocklist
-///\brief Gets the list of hyperslab blocks currently selected
-///\param startblock - IN: Hyperslab block to start with
-///\param numblocks - IN: Number of hyperslab blocks to get
-///\param buf - IN: List of hyperslab blocks selected
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace::getSelectHyperBlocklist
+///\brief Gets the list of hyperslab blocks currently selected
+///\param startblock - IN: Hyperslab block to start with
+///\param numblocks - IN: Number of hyperslab blocks to get
+///\param buf - IN: List of hyperslab blocks selected
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::getSelectHyperBlocklist( hsize_t startblock, hsize_t numblocks, hsize_t *buf ) const
+void DataSpace::getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const
{
- herr_t ret_value;
- ret_value = H5Sget_select_hyper_blocklist( id, startblock, numblocks, buf );
- if( ret_value < 0 )
- {
- throw DataSpaceIException("DataSpace::getSelectHyperBlocklist",
- "H5Sget_select_hyper_blocklist failed");
- }
+ herr_t ret_value;
+ ret_value = H5Sget_select_hyper_blocklist(id, startblock, numblocks, buf);
+ if (ret_value < 0)
+ {
+ throw DataSpaceIException("DataSpace::getSelectHyperBlocklist",
+ "H5Sget_select_hyper_blocklist failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSpace::getSelectElemNpoints
-///\brief Returns the number of element points in the current selection.
-///\return Number of element points
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace::getSelectElemNpoints
+///\brief Returns the number of element points in the current selection.
+///\return Number of element points
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
hssize_t DataSpace::getSelectElemNpoints () const
{
- hssize_t num_points = H5Sget_select_elem_npoints( id );
- if( num_points < 0 )
- {
- throw DataSpaceIException("DataSpace::getSelectElemNpoints",
- "H5Sget_select_elem_npoints failed");
- }
- return( num_points );
+ hssize_t num_points = H5Sget_select_elem_npoints(id);
+ if (num_points < 0)
+ {
+ throw DataSpaceIException("DataSpace::getSelectElemNpoints",
+ "H5Sget_select_elem_npoints failed");
+ }
+ return(num_points);
}
//--------------------------------------------------------------------------
-// Function: DataSpace::getSelectElemPointlist
-///\brief Gets the list of element points currently selected
-///\param startpoint - IN: Element point to start with
-///\param numpoints - IN: Number of element points to get
-///\param buf - IN: List of element points selected
-///\exception H5::DataSpaceIException
+// Function: DataSpace::getSelectElemPointlist
+///\brief Gets the list of element points currently selected
+///\param startpoint - IN: Element point to start with
+///\param numpoints - IN: Number of element points to get
+///\param buf - IN: List of element points selected
+///\exception H5::DataSpaceIException
///\par Description
-/// For more information, please refer to the C layer Reference
-/// Manual at:
+/// For more information, please refer to the C layer Reference
+/// Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectElemPointList
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::getSelectElemPointlist ( hsize_t startpoint, hsize_t numpoints, hsize_t *buf ) const
+void DataSpace::getSelectElemPointlist (hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const
{
- herr_t ret_value;
- ret_value = H5Sget_select_elem_pointlist( id, startpoint, numpoints, buf );
- if( ret_value < 0 )
- {
- throw DataSpaceIException("DataSpace::getSelectElemPointlist",
- "H5Sget_select_elem_pointlist failed");
- }
+ herr_t ret_value;
+ ret_value = H5Sget_select_elem_pointlist(id, startpoint, numpoints, buf);
+ if (ret_value < 0)
+ {
+ throw DataSpaceIException("DataSpace::getSelectElemPointlist",
+ "H5Sget_select_elem_pointlist failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSpace::getSelectBounds
-///\brief Gets the bounding box containing the current selection.
-///\param start - IN: Starting coordinates of the bounding box
-///\param end - IN: Ending coordinates of the bounding box, i.e.,
-/// the coordinates of the diagonally opposite corner
-///\exception H5::DataSpaceIException
+// Function: DataSpace::getSelectBounds
+///\brief Gets the bounding box containing the current selection.
+///\param start - IN: Starting coordinates of the bounding box
+///\param end - IN: Ending coordinates of the bounding box, i.e.,
+/// the coordinates of the diagonally opposite corner
+///\exception H5::DataSpaceIException
///\par Description
-/// For more information, please refer to the C layer Reference
-/// Manual at:
+/// For more information, please refer to the C layer Reference
+/// Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectBounds
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::getSelectBounds ( hsize_t* start, hsize_t* end ) const
+void DataSpace::getSelectBounds (hsize_t* start, hsize_t* end) const
{
- herr_t ret_value = H5Sget_select_bounds( id, start, end );
- if( ret_value < 0 )
- {
- throw DataSpaceIException("DataSpace::getSelectBounds",
- "H5Sget_select_bounds failed");
- }
+ herr_t ret_value = H5Sget_select_bounds(id, start, end);
+ if (ret_value < 0)
+ {
+ throw DataSpaceIException("DataSpace::getSelectBounds",
+ "H5Sget_select_bounds failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSpace::selectElements
-///\brief Selects array elements to be included in the selection for
-/// this dataspace.
-///\param op - IN: Operator specifying how the new selection is to be
-/// combined with the existing selection for the dataspace
-///\param num_elements - IN: Number of elements to be selected
-///\param coord - IN: A 2-dimensional array of 0-based values
-/// specifying the coordinates of the elements being selected
-///\exception H5::DataSpaceIException
+// Function: DataSpace::selectElements
+///\brief Selects array elements to be included in the selection for
+/// this dataspace.
+///\param op - IN: Operator specifying how the new selection is to be
+/// combined with the existing selection for the dataspace
+///\param num_elements - IN: Number of elements to be selected
+///\param coord - IN: A 2-dimensional array of 0-based values
+/// specifying the coordinates of the elements being selected
+///\exception H5::DataSpaceIException
///\par Description
-/// For more information, please refer to the C layer Reference
-/// Manual at:
+/// For more information, please refer to the C layer Reference
+/// Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectElements
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::selectElements ( H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const
+void DataSpace::selectElements (H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const
{
- herr_t ret_value;
- ret_value = H5Sselect_elements( id, op, num_elements, coord );
- if( ret_value < 0 )
- {
- throw DataSpaceIException("DataSpace::selectElements",
- "H5Sselect_elements failed");
- }
+ herr_t ret_value;
+ ret_value = H5Sselect_elements(id, op, num_elements, coord);
+ if (ret_value < 0)
+ {
+ throw DataSpaceIException("DataSpace::selectElements",
+ "H5Sselect_elements failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSpace::selectAll
-///\brief Selects the entire dataspace.
+// Function: DataSpace::selectAll
+///\brief Selects the entire dataspace.
///
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::selectAll () const
{
- herr_t ret_value = H5Sselect_all( id );
- if( ret_value < 0 )
- {
- throw DataSpaceIException("DataSpace::selectAll", "H5Sselect_all failed");
- }
+ herr_t ret_value = H5Sselect_all(id);
+ if (ret_value < 0)
+ {
+ throw DataSpaceIException("DataSpace::selectAll", "H5Sselect_all failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSpace::selectNone
-///\brief Resets the selection region to include no elements.
+// Function: DataSpace::selectNone
+///\brief Resets the selection region to include no elements.
///
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::selectNone () const
{
- herr_t ret_value = H5Sselect_none( id );
- if( ret_value < 0 )
- {
- throw DataSpaceIException("DataSpace::selectNone",
- "H5Sselect_none failed");
- }
+ herr_t ret_value = H5Sselect_none(id);
+ if (ret_value < 0)
+ {
+ throw DataSpaceIException("DataSpace::selectNone",
+ "H5Sselect_none failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataSpace::selectValid
-///\brief Verifies that the selection is within the extent of the
-/// dataspace.
-///\return \c true if the selection is within the extent of the
-/// dataspace, and \c false, otherwise
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace::selectValid
+///\brief Verifies that the selection is within the extent of the
+/// dataspace.
+///\return \c true if the selection is within the extent of the
+/// dataspace, and \c false, otherwise
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
bool DataSpace::selectValid () const
{
- htri_t ret_value = H5Sselect_valid( id );
- if( ret_value > 0 )
- return true;
- else if( ret_value == 0 )
- return false;
- else
- {
- throw DataSpaceIException("DataSpace::selectValid",
- "H5Sselect_valid returns negative value");
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: DataSpace::selectHyperslab
-///\brief Selects a hyperslab region to add to the current selected region.
-///\param op - IN: Operation to perform on current selection
-///\param count - IN: Number of blocks included in the hyperslab
-///\param start - IN: Offset of the start of hyperslab
-///\param stride - IN: Hyperslab stride - default to \c NULL
-///\param block - IN: Size of block in the hyperslab - default to \c NULL
-///\exception H5::DataSpaceIException
+ htri_t ret_value = H5Sselect_valid(id);
+ if (ret_value > 0)
+ return true;
+ else if (ret_value == 0)
+ return false;
+ else
+ {
+ throw DataSpaceIException("DataSpace::selectValid",
+ "H5Sselect_valid returns negative value");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: DataSpace::selectHyperslab
+///\brief Selects a hyperslab region to add to the current selected region.
+///\param op - IN: Operation to perform on current selection
+///\param count - IN: Number of blocks included in the hyperslab
+///\param start - IN: Offset of the start of hyperslab
+///\param stride - IN: Hyperslab stride - default to \c NULL
+///\param block - IN: Size of block in the hyperslab - default to \c NULL
+///\exception H5::DataSpaceIException
///\par Description
-/// For more information, please refer to the C layer Reference
-/// Manual at:
+/// For more information, please refer to the C layer Reference
+/// Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectHyperslab
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataSpace::selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride, const hsize_t *block ) const
+void DataSpace::selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride, const hsize_t *block) const
{
- herr_t ret_value;
- ret_value = H5Sselect_hyperslab( id, op, start, stride, count, block );
- if( ret_value < 0 )
- {
- throw DataSpaceIException("DataSpace::selectHyperslab",
- "H5Sselect_hyperslab failed");
- }
+ herr_t ret_value;
+ ret_value = H5Sselect_hyperslab(id, op, start, stride, count, block);
+ if (ret_value < 0)
+ {
+ throw DataSpaceIException("DataSpace::selectHyperslab",
+ "H5Sselect_hyperslab failed");
+ }
}
//--------------------------------------------------------------------------
// Function: DataSpace::getId
-///\brief Get the id of this dataspace
-///\return Dataspace identifier
+///\brief Get the id of this dataspace
+///\return Dataspace identifier
// Modification:
-// May 2008 - BMR
+// May 2008 - BMR
// Class hierarchy is revised to address bugzilla 1068. Class
// AbstractDS and Attribute are moved out of H5Object. In
// addition, member IdComponent::id is moved into subclasses, and
@@ -631,7 +630,7 @@ void DataSpace::selectHyperslab( H5S_seloper_t op, const hsize_t *count, const h
//--------------------------------------------------------------------------
hid_t DataSpace::getId() const
{
- return(id);
+ return(id);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -656,49 +655,49 @@ void DataSpace::p_setId(const hid_t new_id)
catch (Exception& close_error) {
throw DataSpaceIException(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;
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: DataSpace::close
-///\brief Closes this dataspace.
+// Function: DataSpace::close
+///\brief Closes this dataspace.
///
-///\exception H5::DataSpaceIException
-// Programmer Binh-Minh Ribler - Mar 9, 2005
+///\exception H5::DataSpaceIException
+// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
void DataSpace::close()
{
// check if id is a valid hdf5 object id before trying to close it
if (p_valid_id(id))
{
- herr_t ret_value = H5Sclose(id);
- if( ret_value < 0 )
- {
- throw DataSpaceIException("DataSpace::close", "H5Sclose failed");
- }
- // reset the id
- id = H5I_INVALID_HID;
+ herr_t ret_value = H5Sclose(id);
+ if (ret_value < 0)
+ {
+ throw DataSpaceIException("DataSpace::close", "H5Sclose failed");
+ }
+ // reset the id
+ id = H5I_INVALID_HID;
}
}
//--------------------------------------------------------------------------
-// Function: DataSpace destructor
-///\brief Properly terminates access to this dataspace.
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataSpace destructor
+///\brief Properly terminates access to this dataspace.
+// 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
//--------------------------------------------------------------------------
DataSpace::~DataSpace()
{
try {
- close();
+ close();
} catch (Exception& close_error) {
- cerr << "DataSpace::~DataSpace - " << close_error.getDetailMsg() << endl;
+ cerr << "DataSpace::~DataSpace - " << close_error.getDetailMsg() << endl;
}
}
diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h
index e76bc72..969e146 100644
--- a/c++/src/H5DataSpace.h
+++ b/c++/src/H5DataSpace.h
@@ -27,126 +27,126 @@ namespace H5 {
*/
class H5_DLLCPP DataSpace : public IdComponent {
public:
- ///\brief Default DataSpace objects
- static const DataSpace& ALL;
+ ///\brief Default DataSpace objects
+ static const DataSpace& ALL;
- // Creates a dataspace object given the space type
- DataSpace(H5S_class_t type = H5S_SCALAR);
+ // Creates a dataspace object given the space type
+ DataSpace(H5S_class_t type = H5S_SCALAR);
- // Creates a simple dataspace
- DataSpace(int rank, const hsize_t * dims, const hsize_t * maxdims = NULL);
+ // Creates a simple dataspace
+ DataSpace(int rank, const hsize_t * dims, const hsize_t * maxdims = NULL);
- // Creates a DataSpace object using an existing dataspace id.
- DataSpace(const hid_t space_id);
+ // Creates a DataSpace object using an existing dataspace id.
+ DataSpace(const hid_t space_id);
- // Copy constructor: makes a copy of the original DataSpace object.
- DataSpace(const DataSpace& original);
+ // Copy constructor: makes a copy of the original DataSpace object.
+ DataSpace(const DataSpace& original);
- // Assignment operator
- DataSpace& operator=( const DataSpace& rhs );
+ // Assignment operator
+ DataSpace& operator=(const DataSpace& rhs);
- // Closes this dataspace.
- virtual void close();
+ // Closes this dataspace.
+ virtual void close();
- // Makes copy of an existing dataspace.
- void copy(const DataSpace& like_space);
+ // Makes copy of an existing dataspace.
+ void copy(const DataSpace& like_space);
- // Copies the extent of this dataspace.
- void extentCopy(const DataSpace& dest_space) const;
- // removed from 1.8.18 and 1.10.1
- //void extentCopy(DataSpace& dest_space) const;
+ // Copies the extent of this dataspace.
+ void extentCopy(const DataSpace& dest_space) const;
+ // removed from 1.8.18 and 1.10.1
+ //void extentCopy(DataSpace& dest_space) const;
- // Gets the bounding box containing the current selection.
- void getSelectBounds( hsize_t* start, hsize_t* end ) const;
+ // Gets the bounding box containing the current selection.
+ void getSelectBounds(hsize_t* start, hsize_t* end) const;
- // Gets the number of element points in the current selection.
- hssize_t getSelectElemNpoints() const;
+ // Gets the number of element points in the current selection.
+ hssize_t getSelectElemNpoints() const;
- // Retrieves the list of element points currently selected.
- void getSelectElemPointlist( hsize_t startpoint, hsize_t numpoints, hsize_t *buf ) const;
+ // Retrieves the list of element points currently selected.
+ void getSelectElemPointlist(hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const;
- // Gets the list of hyperslab blocks currently selected.
- void getSelectHyperBlocklist( hsize_t startblock, hsize_t numblocks, hsize_t *buf ) const;
+ // Gets the list of hyperslab blocks currently selected.
+ void getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const;
- // Get number of hyperslab blocks.
- hssize_t getSelectHyperNblocks() const;
+ // Get number of hyperslab blocks.
+ hssize_t getSelectHyperNblocks() const;
- // Gets the number of elements in this dataspace selection.
- hssize_t getSelectNpoints() const;
+ // Gets the number of elements in this dataspace selection.
+ hssize_t getSelectNpoints() const;
- // Retrieves dataspace dimension size and maximum size.
- int getSimpleExtentDims( hsize_t *dims, hsize_t *maxdims = NULL ) const;
+ // Retrieves dataspace dimension size and maximum size.
+ int getSimpleExtentDims(hsize_t *dims, hsize_t *maxdims = NULL) const;
- // Gets the dimensionality of this dataspace.
- int getSimpleExtentNdims() const;
+ // Gets the dimensionality of this dataspace.
+ int getSimpleExtentNdims() const;
- // Gets the number of elements in this dataspace.
- // 12/05/00 - changed return type to hssize_t from hsize_t - C API
- hssize_t getSimpleExtentNpoints() const;
+ // Gets the number of elements in this dataspace.
+ // 12/05/00 - changed return type to hssize_t from hsize_t - C API
+ hssize_t getSimpleExtentNpoints() const;
- // Gets the current class of this dataspace.
- H5S_class_t getSimpleExtentType() const;
+ // Gets the current class of this dataspace.
+ H5S_class_t getSimpleExtentType() const;
- // Determines if this dataspace is a simple one.
- bool isSimple() const;
+ // Determines if this dataspace is a simple one.
+ bool isSimple() const;
- // Sets the offset of this simple dataspace.
- void offsetSimple( const hssize_t* offset ) const;
+ // Sets the offset of this simple dataspace.
+ void offsetSimple(const hssize_t* offset) const;
- // Selects the entire dataspace.
- void selectAll() const;
+ // Selects the entire dataspace.
+ void selectAll() const;
- // Selects array elements to be included in the selection for
- // this dataspace.
- void selectElements( H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const;
+ // Selects array elements to be included in the selection for
+ // this dataspace.
+ void selectElements(H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const;
- // Selects a hyperslab region to add to the current selected region.
- void selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride = NULL, const hsize_t *block = NULL ) const;
+ // Selects a hyperslab region to add to the current selected region.
+ void selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride = NULL, const hsize_t *block = NULL) const;
- // Resets the selection region to include no elements.
- void selectNone() const;
+ // Resets the selection region to include no elements.
+ void selectNone() const;
- // Verifies that the selection is within the extent of the dataspace.
- bool selectValid() const;
+ // Verifies that the selection is within the extent of the dataspace.
+ bool selectValid() const;
- // Removes the extent from this dataspace.
- void setExtentNone() const;
+ // Removes the extent from this dataspace.
+ void setExtentNone() const;
- // Sets or resets the size of this dataspace.
- void setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL ) const;
+ // Sets or resets the size of this dataspace.
+ void setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DataSpace"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("DataSpace"); }
- // Gets the dataspace id.
- virtual hid_t getId() const;
+ // Gets the dataspace id.
+ virtual hid_t getId() const;
- // Deletes the global constant
- static void deleteConstants();
+ // Deletes the global constant
+ static void deleteConstants();
- // Destructor: properly terminates access to this dataspace.
- virtual ~DataSpace();
+ // Destructor: properly terminates access to this dataspace.
+ virtual ~DataSpace();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
protected:
- // Sets the dataspace id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the dataspace id.
+ virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
private:
- hid_t id; // HDF5 dataspace id
+ hid_t id; // HDF5 dataspace id
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- static DataSpace* ALL_;
+ static DataSpace* ALL_;
- // Creates the global constant
- static DataSpace* getConstant();
+ // Creates the global constant
+ static DataSpace* getConstant();
- // Friend function to set DataSpace id. For library use only.
- friend void f_DataSpace_setId(DataSpace *dspace, hid_t new_id);
+ // Friend function to set DataSpace id. For library use only.
+ friend void f_DataSpace_setId(DataSpace *dspace, hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
};
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index 372b2c9..ae48d16 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -46,24 +46,24 @@ using std::cerr;
using std::endl;
//--------------------------------------------------------------------------
-// Function: DataType default constructor
-///\brief Default constructor: Creates a stub datatype
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType default constructor
+///\brief Default constructor: Creates a stub datatype
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataType::DataType() : H5Object(), id(H5I_INVALID_HID) {}
//--------------------------------------------------------------------------
-// Function: DataType overloaded constructor
-///\brief Creates a datatype using an existing datatype's id
-///\param existing_id - IN: Id of the existing datatype
+// Function: DataType overloaded constructor
+///\brief Creates a datatype using an existing datatype's id
+///\param existing_id - IN: Id of the existing datatype
// Description
-// Constructor creates a copy of an existing DataType using
-// its id.
-// Programmer Binh-Minh Ribler - 2000
+// Constructor creates a copy of an existing DataType using
+// its id.
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// Dec, 2005
-// Removed second argument, "predefined", after changing to the
-// new ref counting mechanism that relies on C's ref counting.
+// Dec, 2005
+// Removed second argument, "predefined", after changing to the
+// new ref counting mechanism that relies on C's ref counting.
//--------------------------------------------------------------------------
DataType::DataType(const hid_t existing_id) : H5Object(), id(existing_id)
{
@@ -71,36 +71,36 @@ DataType::DataType(const hid_t existing_id) : H5Object(), id(existing_id)
}
//--------------------------------------------------------------------------
-// Function: DataType overloaded constructor
-///\brief Creates a object given its class and size
-///\param type_class - IN: Class of datatype to create
-///\param size - IN: Number of bytes in the datatype to create
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType overloaded constructor
+///\brief Creates a object given its class and size
+///\param type_class - IN: Class of datatype to create
+///\param size - IN: Number of bytes in the datatype to create
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object()
+DataType::DataType(const H5T_class_t type_class, size_t size) : H5Object()
{
- // Call C routine to create the new datatype
- id = H5Tcreate( type_class, size );
- if( id < 0 )
- {
- throw DataTypeIException("DataType constructor", "H5Tcreate failed");
- }
+ // Call C routine to create the new datatype
+ id = H5Tcreate(type_class, size);
+ if (id < 0)
+ {
+ throw DataTypeIException("DataType constructor", "H5Tcreate failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataType overload constructor - dereference
-///\brief Given a reference, ref, to an hdf5 group, creates a
-/// DataType object
+// Function: DataType overload constructor - dereference
+///\brief Given a reference, ref, to an hdf5 group, creates a
+/// DataType object
///\param loc - IN: Location referenced object is in
-///\param ref - IN: Reference pointer
-///\param ref_type - IN: Reference type - default to H5R_OBJECT
-///\param plist - IN: Property list - default to PropList::DEFAULT
-///\exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
+///\param ref - IN: Reference pointer
+///\param ref_type - IN: Reference type - default to H5R_OBJECT
+///\param plist - IN: Property list - default to PropList::DEFAULT
+///\exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
-// Jul, 2008
-// Added for application convenience.
+// Jul, 2008
+// Added for application convenience.
//--------------------------------------------------------------------------
DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object()
{
@@ -108,18 +108,18 @@ DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type,
}
//--------------------------------------------------------------------------
-// Function: DataType overload constructor - dereference
-///\brief Given a reference, ref, to an hdf5 group, creates a
-/// DataType object
+// Function: DataType overload constructor - dereference
+///\brief Given a reference, ref, to an hdf5 group, creates a
+/// DataType 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
-///\param plist - IN: Property list - default to PropList::DEFAULT
-///\exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
+///\param ref - IN: Reference pointer
+///\param ref_type - IN: Reference type - default to H5R_OBJECT
+///\param plist - IN: Property list - default to PropList::DEFAULT
+///\exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
-// Jul, 2008
-// Added for application convenience.
+// Jul, 2008
+// Added for application convenience.
//--------------------------------------------------------------------------
/* DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID)
{
@@ -128,9 +128,9 @@ DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type,
*/
//--------------------------------------------------------------------------
-// Function: DataType copy constructor
-///\brief Copy constructor: makes a copy of the original DataType object
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType copy constructor
+///\brief Copy constructor: makes a copy of the original DataType object
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataType::DataType(const DataType& original) : H5Object(), id(original.id)
{
@@ -144,32 +144,32 @@ DataType::DataType(const DataType& original) : H5Object(), id(original.id)
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2015
// Description
-// Copying the type so that when a predefined type is passed in,
-// a copy of it is made, not just a duplicate of the HDF5 id.
-// Note: calling DataType::copy will invoke DataType::close()
-// unnecessarily and will produce undefined behavior.
-// -BMR, Apr 2015
+// Copying the type so that when a predefined type is passed in,
+// a copy of it is made, not just a duplicate of the HDF5 id.
+// Note: calling DataType::copy will invoke DataType::close()
+// unnecessarily and will produce undefined behavior.
+// -BMR, Apr 2015
//--------------------------------------------------------------------------
DataType::DataType(const PredType& pred_type) : H5Object()
{
// Call C routine to copy the datatype
- id = H5Tcopy( pred_type.getId() );
+ id = H5Tcopy(pred_type.getId());
if (id < 0)
- throw DataTypeIException("DataType constructor", "H5Tcopy failed");
+ throw DataTypeIException("DataType constructor", "H5Tcopy failed");
}
//--------------------------------------------------------------------------
// Function: DataType overloaded constructor
///\brief Creates a DataType instance by opening an HDF5 datatype given
-/// its name as a char*.
+/// its name as a char*.
///\param dtype_name - IN: Datatype name
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openDataType(const char*) to
-// improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openDataType(const char*) to
+// improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
DataType::DataType(const H5Location& loc, const char *dtype_name) : H5Object()
{
@@ -178,16 +178,16 @@ DataType::DataType(const H5Location& loc, const char *dtype_name) : H5Object()
//--------------------------------------------------------------------------
// Function: DataType overloaded constructor
-///\brief Creates a DataType instance by opening an HDF5 datatype given
-/// its name as an \c H5std_string.
+///\brief Creates a DataType instance by opening an HDF5 datatype given
+/// its name as an \c H5std_string.
///\param dtype_name - IN: Datatype name
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openDataType(const H5std_string&) to
-// improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openDataType(const H5std_string&) to
+// improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
DataType::DataType(const H5Location& loc, const H5std_string& dtype_name) : H5Object()
{
@@ -195,108 +195,108 @@ DataType::DataType(const H5Location& loc, const H5std_string& dtype_name) : H5Ob
}
//--------------------------------------------------------------------------
-// Function: DataType::copy
-///\brief Copies an existing datatype to this datatype object
-///\param like_type - IN: Datatype to be copied
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType::copy
+///\brief Copies an existing datatype to this datatype object
+///\param like_type - IN: Datatype to be copied
+///\exception H5::DataTypeIException
+// 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
//--------------------------------------------------------------------------
-void DataType::copy( const DataType& like_type )
+void DataType::copy(const DataType& like_type)
{
// close the current data type before copying like_type to this object
try {
- close();
+ close();
}
catch (Exception& close_error) {
- throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg());
+ throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg());
}
// call C routine to copy the datatype
- id = H5Tcopy( like_type.getId() );
- if( id < 0 )
- throw DataTypeIException(inMemFunc("copy"), "H5Tcopy failed");
+ id = H5Tcopy(like_type.getId());
+ if (id < 0)
+ throw DataTypeIException(inMemFunc("copy"), "H5Tcopy failed");
}
//--------------------------------------------------------------------------
-// Function: DataType::copy
-///\brief Copies the datatype of the given dataset to this datatype object
-///\param dset - IN: Dataset
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Jan, 2007
+// Function: DataType::copy
+///\brief Copies the datatype of the given dataset to this datatype object
+///\param dset - IN: Dataset
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Jan, 2007
///\par Description
-/// The resulted dataset will be transient and modifiable.
+/// The resulted dataset will be transient and modifiable.
//--------------------------------------------------------------------------
void DataType::copy(const DataSet& dset)
{
// close the current data type before copying dset's datatype to this object
try {
- close();
+ close();
}
catch (Exception& close_error) {
- throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg());
+ throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg());
}
// call C routine to copy the datatype
- id = H5Tcopy( dset.getId() );
- if( id < 0 )
- throw DataTypeIException(inMemFunc("copy"), "H5Tcopy failed");
+ id = H5Tcopy(dset.getId());
+ if (id < 0)
+ throw DataTypeIException(inMemFunc("copy"), "H5Tcopy failed");
}
//--------------------------------------------------------------------------
-// Function: DataType::operator=
-///\brief Assignment operator
-///\param rhs - IN: Reference to the existing datatype
-///\return Reference to DataType instance
-///\exception H5::DataTypeIException
+// Function: DataType::operator=
+///\brief Assignment operator
+///\param rhs - IN: Reference to the existing datatype
+///\return Reference to DataType instance
+///\exception H5::DataTypeIException
// Description
-// Makes a copy of the type on the right hand side and stores
-// the new id in the left hand side object.
-// Programmer Binh-Minh Ribler - 2000
+// Makes a copy of the type on the right hand side and stores
+// the new id in the left hand side object.
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// Changed operator= to simply copy the id of rhs instead of
-// calling H5Tcopy because, when the operator= is invoked, a
-// different datatype id is created and it won't have the same
-// characteristics as the original one, specifically, if the
-// rhs represents a named datatype, "this" would still be a
-// transient datatype.
-// BMR - Mar, 2015
+// Changed operator= to simply copy the id of rhs instead of
+// calling H5Tcopy because, when the operator= is invoked, a
+// different datatype id is created and it won't have the same
+// characteristics as the original one, specifically, if the
+// rhs represents a named datatype, "this" would still be a
+// transient datatype.
+// BMR - Mar, 2015
//--------------------------------------------------------------------------
-DataType& DataType::operator=( const DataType& rhs )
+DataType& DataType::operator=(const DataType& rhs)
{
if (this != &rhs)
{
- setId(rhs.id);
+ setId(rhs.id);
}
return(*this);
}
//--------------------------------------------------------------------------
-// Function: DataType::operator==
-///\brief Compares this DataType against the given one to determines
-/// whether the two objects refer to the same actual datatype.
-///\param compared_type - IN: Reference to the datatype to compare
-///\return true if the datatypes are equal, and false, otherwise.
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType::operator==
+///\brief Compares this DataType against the given one to determines
+/// whether the two objects refer to the same actual datatype.
+///\param compared_type - IN: Reference to the datatype to compare
+///\return true if the datatypes are equal, and false, otherwise.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool DataType::operator==(const DataType& compared_type ) const
+bool DataType::operator==(const DataType& compared_type) const
{
- // Call C routine H5Tequal to determines whether two datatype
- // identifiers refer to the same datatype
- htri_t ret_value = H5Tequal( id, compared_type.getId() );
- if( ret_value > 0 )
- return true;
- else if( ret_value == 0 )
- return false;
- else
- {
- throw DataTypeIException(inMemFunc("operator=="), "H5Tequal returns negative value");
- }
+ // Call C routine H5Tequal to determines whether two datatype
+ // identifiers refer to the same datatype
+ htri_t ret_value = H5Tequal(id, compared_type.getId());
+ if (ret_value > 0)
+ return true;
+ else if (ret_value == 0)
+ return false;
+ else
+ {
+ throw DataTypeIException(inMemFunc("operator=="), "H5Tequal returns negative value");
+ }
}
//--------------------------------------------------------------------------
@@ -306,69 +306,69 @@ bool DataType::operator==(const DataType& compared_type ) const
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// This function was introduced in 1.10.1 to be used by the new
-// XxxType constructors that were introduced to replace the
-// existing functions CommonFG::openXxxType(), which is awkward
-// to use. -BMR, Dec 2016
+// This function was introduced in 1.10.1 to be used by the new
+// XxxType constructors that were introduced to replace the
+// existing functions CommonFG::openXxxType(), which is awkward
+// to use. -BMR, Dec 2016
//--------------------------------------------------------------------------
hid_t DataType::p_opentype(const H5Location& loc, const char *dtype_name) const
{
// Call C function to open the named datatype at this location
hid_t ret_value = H5Topen2(loc.getId(), dtype_name, H5P_DEFAULT);
if (ret_value < 0)
- throw DataTypeIException("DataType constructor", "H5Topen2 failed");
+ throw DataTypeIException("DataType constructor", "H5Topen2 failed");
return(ret_value);
}
//--------------------------------------------------------------------------
-// Function: DataType::p_commit (private)
-//\brief Commits a transient datatype to a file, creating a new
-// named datatype
-//\param loc_id - IN: The id of either a file, group, dataset, named
-// datatype, or attribute.
-//\param name - IN: Name of the datatype
-//\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType::p_commit (private)
+//\brief Commits a transient datatype to a file, creating a new
+// named datatype
+//\param loc_id - IN: The id of either a file, group, dataset, named
+// datatype, or attribute.
+//\param name - IN: Name of the datatype
+//\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
// Modification:
-// Copied from DataType::commit and made into private function
-// to be commonly used by several overloads of DataType::commit.
-// BMR - Jan, 2007
+// Copied from DataType::commit and made into private function
+// to be commonly used by several overloads of DataType::commit.
+// BMR - Jan, 2007
//--------------------------------------------------------------------------
void DataType::p_commit(hid_t loc_id, const char* name)
{
- // Call C routine to commit the transient datatype
- herr_t ret_value = H5Tcommit2(loc_id, name, id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if( ret_value < 0 )
- throw DataTypeIException(inMemFunc("p_commit"), "H5Tcommit2 failed");
+ // Call C routine to commit the transient datatype
+ herr_t ret_value = H5Tcommit2(loc_id, name, id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (ret_value < 0)
+ throw DataTypeIException(inMemFunc("p_commit"), "H5Tcommit2 failed");
}
//--------------------------------------------------------------------------
-// Function: DataType::commit
-///\brief Commits a transient datatype to a file, creating a new
-/// named datatype
-///\param loc - IN: A location (file, dataset, datatype, or group)
-///\param name - IN: Name of the datatype
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Jan, 2007
+// Function: DataType::commit
+///\brief Commits a transient datatype to a file, creating a new
+/// named datatype
+///\param loc - IN: A location (file, dataset, datatype, or group)
+///\param name - IN: Name of the datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Jan, 2007
//--------------------------------------------------------------------------
void DataType::commit(const H5Location& loc, const char* name)
{
- p_commit(loc.getId(), name);
+ p_commit(loc.getId(), name);
}
//--------------------------------------------------------------------------
-// Function: DataType::commit
-// 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 loc - IN: A location (file, dataset, datatype, or group)
-// Param name - IN: Name of the datatype
-// Exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Jan, 2007
+// Function: DataType::commit
+// 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 loc - IN: A location (file, dataset, datatype, or group)
+// Param name - IN: Name of the datatype
+// Exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Jan, 2007
// Modification
-// Planned for removal. -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
+// Planned for removal. -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 DataType::commit(H5Location& loc, const char* name)
//{
@@ -376,30 +376,30 @@ void DataType::commit(const H5Location& loc, const char* name)
//}
//--------------------------------------------------------------------------
-// Function: DataType::commit
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in the type of the
-/// argument \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType::commit
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in the type of the
+/// argument \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataType::commit(const H5Location& loc, const H5std_string& name)
{
- p_commit(loc.getId(), name.c_str());
+ p_commit(loc.getId(), name.c_str());
}
//--------------------------------------------------------------------------
-// Function: DataType::commit
-// 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 loc - IN: A location (file, dataset, datatype, or group)
-// Param name - IN: Name of the datatype
-// Exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Jan, 2007
+// Function: DataType::commit
+// 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 loc - IN: A location (file, dataset, datatype, or group)
+// Param name - IN: Name of the datatype
+// Exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Jan, 2007
// Modification
-// Planned for removal. -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
+// Planned for removal. -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 DataType::commit(H5Location& loc, const H5std_string& name)
//{
@@ -407,340 +407,340 @@ void DataType::commit(const H5Location& loc, const H5std_string& name)
//}
//--------------------------------------------------------------------------
-// Function: DataType::committed
-///\brief Determines whether a datatype is a named type or a
-/// transient type.
-///\return \c true if the datatype is a named type, and \c false,
-/// otherwise.
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType::committed
+///\brief Determines whether a datatype is a named type or a
+/// transient type.
+///\return \c true if the datatype is a named type, and \c false,
+/// otherwise.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
bool DataType::committed() const
{
- // Call C function to determine if a datatype is a named one
- htri_t is_committed = H5Tcommitted( id );
- if (is_committed > 0)
- return true;
- else if (is_committed == 0)
- return false;
- else
- {
- throw DataTypeIException(inMemFunc("committed"), "H5Tcommitted return negative value");
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: DataType::find
-///\brief Finds a conversion function that can handle a conversion
-/// from this datatype to the specified datatype, \a dest.
-///\param dest - IN: Destination datatype
-///\param pcdata - IN: Pointer to type conversion data
-///\return Pointer to a suitable conversion function
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-H5T_conv_t DataType::find( const DataType& dest, H5T_cdata_t **pcdata ) const
-{
- // Call C routine to find the conversion function
- H5T_conv_t func = H5Tfind( id, dest.getId(), pcdata );
- if( func == NULL )
- {
- throw DataTypeIException(inMemFunc("find"), "H5Tfind returns a NULL function");
- }
- return( func );
-}
-
-//--------------------------------------------------------------------------
-// Function: DataType::convert
-///\brief Converts data from this datatype to the specified datatypes.
-///\param dest - IN: Destination datatype
-///\param nelmts - IN: Size of array \a buf
-///\param buf - IN/OUT: Array containing pre- and post-conversion
-/// values
-///\param background - IN: Optional backgroud buffer
-///\param plist - IN: Property list - default to PropList::DEFAULT
-///\return Pointer to a suitable conversion function
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void DataType::convert( const DataType& dest, size_t nelmts, void *buf, void *background, const PropList& plist ) const
-{
- // Get identifiers for C API
- hid_t dest_id = dest.getId();
- hid_t plist_id = plist.getId();
-
- // Call C routine H5Tconvert to convert the data
- herr_t ret_value;
- ret_value = H5Tconvert( id, dest_id, nelmts, buf, background, plist_id );
- if( ret_value < 0 )
- {
- throw DataTypeIException(inMemFunc("convert"), "H5Tconvert failed");
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: DataType::lock
-///\brief Locks a datatype, making it read-only and non-destructible.
+ // Call C function to determine if a datatype is a named one
+ htri_t is_committed = H5Tcommitted(id);
+ if (is_committed > 0)
+ return true;
+ else if (is_committed == 0)
+ return false;
+ else
+ {
+ throw DataTypeIException(inMemFunc("committed"), "H5Tcommitted return negative value");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: DataType::find
+///\brief Finds a conversion function that can handle a conversion
+/// from this datatype to the specified datatype, \a dest.
+///\param dest - IN: Destination datatype
+///\param pcdata - IN: Pointer to type conversion data
+///\return Pointer to a suitable conversion function
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+H5T_conv_t DataType::find(const DataType& dest, H5T_cdata_t **pcdata) const
+{
+ // Call C routine to find the conversion function
+ H5T_conv_t func = H5Tfind(id, dest.getId(), pcdata);
+ if (func == NULL)
+ {
+ throw DataTypeIException(inMemFunc("find"), "H5Tfind returns a NULL function");
+ }
+ return(func);
+}
+
+//--------------------------------------------------------------------------
+// Function: DataType::convert
+///\brief Converts data from this datatype to the specified datatypes.
+///\param dest - IN: Destination datatype
+///\param nelmts - IN: Size of array \a buf
+///\param buf - IN/OUT: Array containing pre- and post-conversion
+/// values
+///\param background - IN: Optional backgroud buffer
+///\param plist - IN: Property list - default to PropList::DEFAULT
+///\return Pointer to a suitable conversion function
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void DataType::convert(const DataType& dest, size_t nelmts, void *buf, void *background, const PropList& plist) const
+{
+ // Get identifiers for C API
+ hid_t dest_id = dest.getId();
+ hid_t plist_id = plist.getId();
+
+ // Call C routine H5Tconvert to convert the data
+ herr_t ret_value;
+ ret_value = H5Tconvert(id, dest_id, nelmts, buf, background, plist_id);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException(inMemFunc("convert"), "H5Tconvert failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: DataType::lock
+///\brief Locks a datatype, making it read-only and non-destructible.
///
-///\exception H5::DataTypeIException
+///\exception H5::DataTypeIException
///\par Descrition
-/// This is normally done by the library for predefined data
-/// types so the application doesn't inadvertently change or
-/// delete a predefined type.
+/// This is normally done by the library for predefined data
+/// types so the application doesn't inadvertently change or
+/// delete a predefined type.
///
-/// Once a data type is locked it can never be unlocked unless
-/// the entire library is closed.
-// Programmer Binh-Minh Ribler - 2000
+/// Once a data type is locked it can never be unlocked unless
+/// the entire library is closed.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataType::lock() const
{
- // Call C routine to lock the datatype
- herr_t ret_value = H5Tlock( id );
- if( ret_value < 0 )
- {
- throw DataTypeIException(inMemFunc("lock"), "H5Tlock failed");
- }
+ // Call C routine to lock the datatype
+ herr_t ret_value = H5Tlock(id);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException(inMemFunc("lock"), "H5Tlock failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataType::getClass
-///\brief Returns the datatype class identifier.
-///\return Datatype class identifier
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType::getClass
+///\brief Returns the datatype class identifier.
+///\return Datatype class identifier
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5T_class_t DataType::getClass() const
{
- H5T_class_t type_class = H5Tget_class( id );
+ H5T_class_t type_class = H5Tget_class(id);
- // Return datatype class identifier if successful
- if( type_class == H5T_NO_CLASS )
- {
- throw DataTypeIException(inMemFunc("getClass"), "H5Tget_class returns H5T_NO_CLASS");
- }
- return( type_class );
+ // Return datatype class identifier if successful
+ if (type_class == H5T_NO_CLASS)
+ {
+ throw DataTypeIException(inMemFunc("getClass"), "H5Tget_class returns H5T_NO_CLASS");
+ }
+ return(type_class);
}
//--------------------------------------------------------------------------
-// Function: DataType::getSize
-///\brief Returns the size of a datatype.
-///\return Datatype size in bytes
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType::getSize
+///\brief Returns the size of a datatype.
+///\return Datatype size in bytes
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
size_t DataType::getSize() const
{
- // Call C routine to get the datatype size
- size_t type_size = H5Tget_size( id );
- if( type_size <= 0 ) // valid data types are never zero size
- {
- throw DataTypeIException(inMemFunc("getSize"), "H5Tget_size returns invalid datatype size");
- }
- return( type_size );
+ // Call C routine to get the datatype size
+ size_t type_size = H5Tget_size(id);
+ if (type_size <= 0) // valid data types are never zero size
+ {
+ throw DataTypeIException(inMemFunc("getSize"), "H5Tget_size returns invalid datatype size");
+ }
+ return(type_size);
}
//--------------------------------------------------------------------------
-// Function: DataType::getSuper
-///\brief Returns the base datatype from which a datatype is derived.
-///\return DataType object
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType::getSuper
+///\brief Returns the base datatype from which a datatype is derived.
+///\return DataType object
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataType DataType::getSuper() const
{
- // Call C routine to get the base datatype from which the specified
- // datatype is derived.
- hid_t base_type_id = H5Tget_super( id );
-
- // If H5Tget_super returns a valid datatype id, create and return
- // the base type, otherwise, raise exception
- if( base_type_id > 0 )
- {
- DataType base_type;
- base_type.p_setId(base_type_id);
- return(base_type);
- }
- else
- {
- throw DataTypeIException(inMemFunc("getSuper"), "H5Tget_super failed");
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: DataType::registerFunc
-///\brief Registers the specified conversion function.
-///\param pers - IN: Conversion option
-/// \li \c H5T_PERS_HARD for hard conversion functions
-/// \li \c H5T_PERS_SOFT for soft conversion functions.
-///\param name - IN: Name displayed in diagnostic output.
-///\param dest - IN: Destination datatype.
-///\param func - IN: Function to convert between source and
-/// destination datatypes.
-///\exception H5::DataTypeIException
+ // Call C routine to get the base datatype from which the specified
+ // datatype is derived.
+ hid_t base_type_id = H5Tget_super(id);
+
+ // If H5Tget_super returns a valid datatype id, create and return
+ // the base type, otherwise, raise exception
+ if (base_type_id > 0)
+ {
+ DataType base_type;
+ base_type.p_setId(base_type_id);
+ return(base_type);
+ }
+ else
+ {
+ throw DataTypeIException(inMemFunc("getSuper"), "H5Tget_super failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: DataType::registerFunc
+///\brief Registers the specified conversion function.
+///\param pers - IN: Conversion option
+/// \li \c H5T_PERS_HARD for hard conversion functions
+/// \li \c H5T_PERS_SOFT for soft conversion functions.
+///\param name - IN: Name displayed in diagnostic output.
+///\param dest - IN: Destination datatype.
+///\param func - IN: Function to convert between source and
+/// destination datatypes.
+///\exception H5::DataTypeIException
///\par Description
-/// For more information, please see:
+/// For more information, please see:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Register
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::registerFunc( H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const
+void DataType::registerFunc(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const
{
- hid_t dest_id = dest.getId(); // get id of the destination datatype
+ hid_t dest_id = dest.getId(); // get id of the destination datatype
- // Call C routine H5Tregister to register the conversion function
- herr_t ret_value = H5Tregister( pers, name, id, dest_id, func );
- if( ret_value < 0 )
- {
- throw DataTypeIException(inMemFunc("registerFunc"), "H5Tregister failed");
- }
+ // Call C routine H5Tregister to register the conversion function
+ herr_t ret_value = H5Tregister(pers, name, id, dest_id, func);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException(inMemFunc("registerFunc"), "H5Tregister failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataType::registerFunc
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in the type of the
-/// argument \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType::registerFunc
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in the type of the
+/// argument \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::registerFunc( H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func ) const
+void DataType::registerFunc(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const
{
- registerFunc( pers, name.c_str(), dest, func );
+ registerFunc(pers, name.c_str(), dest, func);
}
//--------------------------------------------------------------------------
-// Function: DataType::unregister
-///\brief Removes a conversion function from all conversion paths.
-///\param pers - IN: Conversion option
-/// \li \c H5T_PERS_HARD for hard conversion functions
-/// \li \c H5T_PERS_SOFT for soft conversion functions.
-///\param name - IN: Name displayed in diagnostic output.
-///\param dest - IN: Destination datatype.
-///\param func - IN: Function to convert between source and
-/// destination datatypes.
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType::unregister
+///\brief Removes a conversion function from all conversion paths.
+///\param pers - IN: Conversion option
+/// \li \c H5T_PERS_HARD for hard conversion functions
+/// \li \c H5T_PERS_SOFT for soft conversion functions.
+///\param name - IN: Name displayed in diagnostic output.
+///\param dest - IN: Destination datatype.
+///\param func - IN: Function to convert between source and
+/// destination datatypes.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::unregister( H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const
+void DataType::unregister(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const
{
- hid_t dest_id = dest.getId(); // get id of the dest datatype for C API
+ hid_t dest_id = dest.getId(); // get id of the dest datatype for C API
- // Call C routine H5Tunregister to remove the conversion function
- herr_t ret_value = H5Tunregister( pers, name, id, dest_id, func );
- if( ret_value < 0 )
- {
- throw DataTypeIException(inMemFunc("unregister"), "H5Tunregister failed");
- }
+ // Call C routine H5Tunregister to remove the conversion function
+ herr_t ret_value = H5Tunregister(pers, name, id, dest_id, func);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException(inMemFunc("unregister"), "H5Tunregister failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataType::unregister
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in the type of the
-/// argument \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType::unregister
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in the type of the
+/// argument \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::unregister( H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func ) const
+void DataType::unregister(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const
{
- unregister( pers, name.c_str(), dest, func );
+ unregister(pers, name.c_str(), dest, func);
}
//--------------------------------------------------------------------------
-// Function: DataType::setTag
-///\brief Tags an opaque datatype.
-///\param tag - IN: Descriptive ASCII string with which the opaque
-/// datatype is to be tagged.
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType::setTag
+///\brief Tags an opaque datatype.
+///\param tag - IN: Descriptive ASCII string with which the opaque
+/// datatype is to be tagged.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::setTag( const char* tag ) const
+void DataType::setTag(const char* tag) const
{
- // Call C routine H5Tset_tag to tag an opaque datatype.
- herr_t ret_value = H5Tset_tag( id, tag );
- if( ret_value < 0 )
- {
- throw DataTypeIException(inMemFunc("setTag"), "H5Tset_tag failed");
- }
+ // Call C routine H5Tset_tag to tag an opaque datatype.
+ herr_t ret_value = H5Tset_tag(id, tag);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException(inMemFunc("setTag"), "H5Tset_tag failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataType::setTag
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in the type of the
-/// argument \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType::setTag
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in the type of the
+/// argument \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DataType::setTag( const H5std_string& tag ) const
+void DataType::setTag(const H5std_string& tag) const
{
- setTag( tag.c_str());
+ setTag(tag.c_str());
}
//--------------------------------------------------------------------------
-// Function: DataType::getTag
-///\brief Gets the tag associated with an opaque datatype.
-///\return Tag associated with the opaque datatype
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType::getTag
+///\brief Gets the tag associated with an opaque datatype.
+///\return Tag associated with the opaque datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5std_string DataType::getTag() const
{
- char* tag_Cstr = H5Tget_tag( id );
+ char* tag_Cstr = H5Tget_tag(id);
// if the tag C-string returned is not NULL, convert it to C++ string
// and return it, otherwise, raise an exception
- if( tag_Cstr != NULL )
+ if (tag_Cstr != NULL)
{
- H5std_string tag = H5std_string(tag_Cstr); // C string to string object
- H5free_memory(tag_Cstr); // free the C string
- return (tag); // return the tag
+ H5std_string tag = H5std_string(tag_Cstr); // C string to string object
+ H5free_memory(tag_Cstr); // free the C string
+ return (tag); // return the tag
}
else
{
- throw DataTypeIException(inMemFunc("getTag"), "H5Tget_tag returns NULL for tag");
+ throw DataTypeIException(inMemFunc("getTag"), "H5Tget_tag returns NULL for tag");
}
}
//--------------------------------------------------------------------------
-// Function: DataType::detectClass
-///\brief Checks whether a datatype contains (or is) a certain type of
-/// datatype.
-///\return true if this datatype contains or is the specified type,
-/// and false, otherwise.
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - May, 2004
+// Function: DataType::detectClass
+///\brief Checks whether a datatype contains (or is) a certain type of
+/// datatype.
+///\return true if this datatype contains or is the specified type,
+/// and false, otherwise.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
bool DataType::detectClass(H5T_class_t cls) const
{
- htri_t ret_value = H5Tdetect_class(id, cls);
- if( ret_value > 0 )
- return true;
- else if( ret_value == 0 )
- return false;
- else
- {
- throw DataTypeIException(inMemFunc("detectClass"),
- "H5Tdetect_class returns negative value");
- }
+ htri_t ret_value = H5Tdetect_class(id, cls);
+ if (ret_value > 0)
+ return true;
+ else if (ret_value == 0)
+ return false;
+ else
+ {
+ throw DataTypeIException(inMemFunc("detectClass"),
+ "H5Tdetect_class returns negative value");
+ }
}
//--------------------------------------------------------------------------
-// Function: DataType::isVariableStr
-///\brief Check whether this datatype is a variable-length string.
-///\return true if this datatype is a variable-length string, and
-/// false, otherwise.
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - May, 2004
+// Function: DataType::isVariableStr
+///\brief Check whether this datatype is a variable-length string.
+///\return true if this datatype is a variable-length string, and
+/// false, otherwise.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
bool DataType::isVariableStr() const
{
- htri_t is_varlen_str = H5Tis_variable_str(id);
- if( is_varlen_str == 1 )
- return true;
- else if( is_varlen_str == 0 )
- return false;
- else
- {
- throw DataTypeIException(inMemFunc("isVariableStr"),
- "H5Tis_variable_str returns negative value");
- }
+ htri_t is_varlen_str = H5Tis_variable_str(id);
+ if (is_varlen_str == 1)
+ return true;
+ else if (is_varlen_str == 0)
+ return false;
+ else
+ {
+ throw DataTypeIException(inMemFunc("isVariableStr"),
+ "H5Tis_variable_str returns negative value");
+ }
}
//--------------------------------------------------------------------------
@@ -757,7 +757,7 @@ bool DataType::isVariableStr() const
//--------------------------------------------------------------------------
hid_t DataType::getId() const
{
- return(id);
+ return(id);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -782,58 +782,58 @@ void DataType::p_setId(const hid_t new_id)
catch (Exception& close_error) {
throw DataTypeIException(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;
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: DataType::close
-///\brief Closes the datatype if it is not a predefined type.
+// Function: DataType::close
+///\brief Closes the datatype if it is not a predefined type.
///
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Mar 9, 2005
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
void DataType::close()
{
if (p_valid_id(id))
{
- herr_t ret_value = H5Tclose(id);
- if( ret_value < 0 )
- {
- throw DataTypeIException(inMemFunc("close"), "H5Tclose failed");
- }
- // reset the id
- id = H5I_INVALID_HID;
+ herr_t ret_value = H5Tclose(id);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException(inMemFunc("close"), "H5Tclose failed");
+ }
+ // reset the id
+ id = H5I_INVALID_HID;
}
}
//--------------------------------------------------------------------------
-// Function: DataType destructor
-///\brief Properly terminates access to this datatype.
-// Programmer Binh-Minh Ribler - 2000
+// Function: DataType destructor
+///\brief Properly terminates access to this datatype.
+// 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
-// - Added the use of H5CPP_EXITED to terminate the HDF5 library
-// and elimiate previous memory leaks. See comments in the
-// header file "H5PredType.h" for details. - BMR, Mar 30, 2012
-// - Major re-implementation of the global constants was done
-// to avoid relying on the order of the creation and deletion
-// of the global constants. Hence, H5CPP_EXITED was removed.
-// See Design Notes in "H5PredType.cpp" for details.
-// - BMR, Sep 30, 2015
+// - 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
+// - Added the use of H5CPP_EXITED to terminate the HDF5 library
+// and elimiate previous memory leaks. See comments in the
+// header file "H5PredType.h" for details. - BMR, Mar 30, 2012
+// - Major re-implementation of the global constants was done
+// to avoid relying on the order of the creation and deletion
+// of the global constants. Hence, H5CPP_EXITED was removed.
+// See Design Notes in "H5PredType.cpp" for details.
+// - BMR, Sep 30, 2015
//--------------------------------------------------------------------------
DataType::~DataType()
{
try
{
- close();
+ close();
}
catch (Exception& close_error) {
- cerr << inMemFunc("~DataType - ") << close_error.getDetailMsg() << endl;
+ cerr << inMemFunc("~DataType - ") << close_error.getDetailMsg() << endl;
}
}
} // end namespace
diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h
index 4e904a6..fd9c17d 100644
--- a/c++/src/H5DataType.h
+++ b/c++/src/H5DataType.h
@@ -30,128 +30,128 @@ namespace H5 {
*/
class H5_DLLCPP DataType : public H5Object {
public:
- // Creates a datatype given its class and size
- DataType( const H5T_class_t type_class, size_t size );
+ // Creates a datatype given its class and size
+ DataType(const H5T_class_t type_class, size_t size);
- // Copy constructor: makes a copy of the original object
- DataType( const DataType& original );
+ // Copy constructor: makes a copy of the original object
+ DataType(const DataType& original);
- // Creates a copy of a predefined type
- DataType(const PredType& pred_type);
+ // Creates a copy of a predefined type
+ DataType(const PredType& pred_type);
- // Creates a datatype by way of dereference.
- DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
-// DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
+ // Creates a datatype by way of dereference.
+ DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
+// DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
- // Closes this datatype.
- virtual void close();
+ // Closes this datatype.
+ virtual void close();
- // Copies an existing datatype to this datatype object.
- void copy(const DataType& like_type);
+ // Copies an existing datatype to this datatype object.
+ void copy(const DataType& like_type);
- // Copies the datatype of dset to this datatype object.
- void copy(const DataSet& dset);
+ // Copies the datatype of dset to this datatype object.
+ void copy(const DataSet& dset);
- // Returns the datatype class identifier.
- H5T_class_t getClass() const;
+ // Returns the datatype class identifier.
+ H5T_class_t getClass() const;
- // Commits a transient datatype to a file; this datatype becomes
- // a named datatype which can be accessed from the location.
- void commit(const H5Location& loc, const char* name);
- void commit(const H5Location& loc, const H5std_string& name);
+ // Commits a transient datatype to a file; this datatype becomes
+ // a named datatype which can be accessed from the location.
+ void commit(const H5Location& loc, const char* name);
+ void commit(const H5Location& loc, const H5std_string& name);
- // These two overloaded functions are kept for backward compatibility
- // only; they missed the const - removed from 1.8.18 and 1.10.1
- //void commit(H5Location& loc, const char* name);
- //void commit(H5Location& loc, const H5std_string& name);
+ // These two overloaded functions are kept for backward compatibility
+ // only; they missed the const - removed from 1.8.18 and 1.10.1
+ //void commit(H5Location& loc, const char* name);
+ //void commit(H5Location& loc, const H5std_string& name);
- // Determines whether this datatype is a named datatype or
- // a transient datatype.
- bool committed() const;
+ // Determines whether this datatype is a named datatype or
+ // a transient datatype.
+ bool committed() const;
// Finds a conversion function that can handle the conversion
// this datatype to the given datatype, dest.
- H5T_conv_t find( const DataType& dest, H5T_cdata_t **pcdata ) const;
+ H5T_conv_t find(const DataType& dest, H5T_cdata_t **pcdata) const;
- // Converts data from between specified datatypes.
- void convert( const DataType& dest, size_t nelmts, void *buf, void *background, const PropList& plist=PropList::DEFAULT) const;
+ // Converts data from between specified datatypes.
+ void convert(const DataType& dest, size_t nelmts, void *buf, void *background, const PropList& plist=PropList::DEFAULT) const;
- // Assignment operator
- DataType& operator=( const DataType& rhs );
+ // Assignment operator
+ DataType& operator=(const DataType& rhs);
- // Determines whether two datatypes are the same.
- bool operator==(const DataType& compared_type ) const;
+ // Determines whether two datatypes are the same.
+ bool operator==(const DataType& compared_type) const;
- // Locks a datatype.
- void lock() const;
+ // Locks a datatype.
+ void lock() const;
- // Returns the size of a datatype.
- size_t getSize() const;
+ // Returns the size of a datatype.
+ size_t getSize() const;
- // Returns the base datatype from which a datatype is derived.
- // Note: not quite right for specific types yet???
- DataType getSuper() const;
+ // Returns the base datatype from which a datatype is derived.
+ // Note: not quite right for specific types yet???
+ DataType getSuper() const;
- // Registers a conversion function.
- void registerFunc(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const;
- void registerFunc(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func ) const;
+ // Registers a conversion function.
+ void registerFunc(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const;
+ void registerFunc(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const;
- // Removes a conversion function from all conversion paths.
- void unregister( H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const;
- void unregister( H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func ) const;
+ // Removes a conversion function from all conversion paths.
+ void unregister(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func) const;
+ void unregister(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func) const;
- // Tags an opaque datatype.
- void setTag( const char* tag ) const;
- void setTag( const H5std_string& tag ) const;
+ // Tags an opaque datatype.
+ void setTag(const char* tag) const;
+ void setTag(const H5std_string& tag) const;
- // Gets the tag associated with an opaque datatype.
- H5std_string getTag() const;
+ // Gets the tag associated with an opaque datatype.
+ H5std_string getTag() const;
- // Checks whether this datatype contains (or is) a certain type class.
- bool detectClass(H5T_class_t cls) const;
+ // Checks whether this datatype contains (or is) a certain type class.
+ bool detectClass(H5T_class_t cls) const;
- // Checks whether this datatype is a variable-length string.
- bool isVariableStr() const;
+ // Checks whether this datatype is a variable-length string.
+ bool isVariableStr() const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DataType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("DataType"); }
// From CommonFG then H5Location
- // Constructors to open a generic named datatype at a given location.
- DataType(const H5Location& loc, const char* name);
- DataType(const H5Location& loc, const H5std_string& name);
+ // Constructors to open a generic named datatype at a given location.
+ DataType(const H5Location& loc, const char* name);
+ DataType(const H5Location& loc, const H5std_string& name);
// End of From CommonFG then H5Location
- // Creates a copy of an existing DataType using its id
- DataType( const hid_t type_id );
+ // Creates a copy of an existing DataType using its id
+ DataType(const hid_t type_id);
- // Default constructor
- DataType();
+ // Default constructor
+ DataType();
- // Gets the datatype id.
- virtual hid_t getId() const;
+ // Gets the datatype id.
+ virtual hid_t getId() const;
- // Destructor: properly terminates access to this datatype.
- virtual ~DataType();
+ // Destructor: properly terminates access to this datatype.
+ virtual ~DataType();
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- hid_t id; // HDF5 datatype id
+ hid_t id; // HDF5 datatype id
- // Sets the datatype id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the datatype id.
+ virtual void p_setId(const hid_t new_id);
- // Opens a datatype and returns the id.
- hid_t p_opentype(const H5Location& loc, const char* dtype_name) const;
+ // Opens a datatype and returns the id.
+ hid_t p_opentype(const H5Location& loc, const char* dtype_name) const;
#endif // DOXYGEN_SHOULD_SKIP_THIS
private:
- // Friend function to set DataType id. For library use only.
- friend void f_DataType_setId(DataType* dtype, hid_t new_id);
+ // Friend function to set DataType id. For library use only.
+ friend void f_DataType_setId(DataType* dtype, hid_t new_id);
- void p_commit(hid_t loc_id, const char* name);
+ void p_commit(hid_t loc_id, const char* name);
};
}
#endif // __H5DataType_H
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp
index 8ab38dc..86d4d9c 100644
--- a/c++/src/H5DcreatProp.cpp
+++ b/c++/src/H5DcreatProp.cpp
@@ -40,7 +40,7 @@ DSetCreatPropList* DSetCreatPropList::DEFAULT_ = 0;
// Function: DSetCreatPropList::getConstant
// Purpose: Creates a DSetCreatPropList object representing the HDF5
// constant H5P_DATASET_CREATE, pointed to by
-// DSetCreatPropList::DEFAULT_
+// DSetCreatPropList::DEFAULT_
// exception H5::PropListIException
// Description
// If DSetCreatPropList::DEFAULT_ already points to an allocated
@@ -80,670 +80,670 @@ void DSetCreatPropList::deleteConstants()
}
//--------------------------------------------------------------------------
-// Purpose Constant for dataset creation default property
+// Purpose Constant for dataset creation default property
//--------------------------------------------------------------------------
const DSetCreatPropList& DSetCreatPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList default constructor
-///\brief Default constructor: creates a stub dataset creation property list
-// Programmer Binh-Minh Ribler - 2000
+// Function: DSetCreatPropList default constructor
+///\brief Default constructor: creates a stub dataset creation property list
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetCreatPropList::DSetCreatPropList() : ObjCreatPropList(H5P_DATASET_CREATE) {}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList copy constructor
-///\brief Copy constructor: makes a copy of the original
-/// DSetCreatPropList object
-// Programmer Binh-Minh Ribler - 2000
+// Function: DSetCreatPropList copy constructor
+///\brief Copy constructor: makes a copy of the original
+/// DSetCreatPropList object
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetCreatPropList::DSetCreatPropList( const DSetCreatPropList& orig ) : ObjCreatPropList(orig) {}
+DSetCreatPropList::DSetCreatPropList(const DSetCreatPropList& orig) : ObjCreatPropList(orig) {}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList overloaded constructor
-///\brief Creates a DSetCreatPropList object using the id of an
-/// existing dataset creation property list.
-// Programmer Binh-Minh Ribler - 2000
+// Function: DSetCreatPropList overloaded constructor
+///\brief Creates a DSetCreatPropList object using the id of an
+/// existing dataset creation property list.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetCreatPropList::DSetCreatPropList(const hid_t plist_id) : ObjCreatPropList(plist_id) {}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::setChunk
-///\brief Sets the size of the chunks used to store a chunked layout
-/// dataset.
-///\param ndims - IN: Number of dimensions of each chunk
-///\param dim - IN: Array containing the size of each chunk
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::setChunk
+///\brief Sets the size of the chunks used to store a chunked layout
+/// dataset.
+///\param ndims - IN: Number of dimensions of each chunk
+///\param dim - IN: Array containing the size of each chunk
+///\exception H5::PropListIException
///\par Description
-/// The \a ndims parameter currently must have the same value as
-/// the rank of the dataset. The values of the \a dim array
-/// define the size of the chunks to store the dataset's raw
-/// data. As a side-effect, the layout of the dataset will be
-/// changed to \c H5D_CHUNKED, if it is not so already.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void DSetCreatPropList::setChunk( int ndims, const hsize_t* dim ) const
+/// The \a ndims parameter currently must have the same value as
+/// the rank of the dataset. The values of the \a dim array
+/// define the size of the chunks to store the dataset's raw
+/// data. As a side-effect, the layout of the dataset will be
+/// changed to \c H5D_CHUNKED, if it is not so already.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void DSetCreatPropList::setChunk(int ndims, const hsize_t* dim) const
{
- herr_t ret_value = H5Pset_chunk( id, ndims, dim );
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::setChunk", "H5Pset_chunk failed");
- }
+ herr_t ret_value = H5Pset_chunk(id, ndims, dim);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::setChunk", "H5Pset_chunk failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::getChunk
-///\brief Retrieves the size of the chunks used to store a chunked
-/// layout dataset.
-///\param max_ndims - IN: Size of \a dim array
-///\param dim - OUT: Array to store the chunk dimensions
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DSetCreatPropList::getChunk
+///\brief Retrieves the size of the chunks used to store a chunked
+/// layout dataset.
+///\param max_ndims - IN: Size of \a dim array
+///\param dim - OUT: Array to store the chunk dimensions
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int DSetCreatPropList::getChunk( int max_ndims, hsize_t* dim ) const
+int DSetCreatPropList::getChunk(int max_ndims, hsize_t* dim) const
{
- int chunk_size = H5Pget_chunk( id, max_ndims, dim );
- if( chunk_size < 0 )
- {
- throw PropListIException("DSetCreatPropList::getChunk",
- "H5Pget_chunk returns negative chunk size");
- }
- return( chunk_size );
+ int chunk_size = H5Pget_chunk(id, max_ndims, dim);
+ if (chunk_size < 0)
+ {
+ throw PropListIException("DSetCreatPropList::getChunk",
+ "H5Pget_chunk returns negative chunk size");
+ }
+ return(chunk_size);
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::setLayout
-///\brief Sets the type of storage used store the raw data for a dataset.
-///\param layout - IN: Type of storage layout for raw data
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::setLayout
+///\brief Sets the type of storage used store the raw data for a dataset.
+///\param layout - IN: Type of storage layout for raw data
+///\exception H5::PropListIException
///\par Description
-/// For information on valid layout types, please refer to
+/// For information on valid layout types, please refer to
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetLayout
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setLayout(H5D_layout_t layout) const
{
- herr_t ret_value = H5Pset_layout( id, layout );
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::setLayout",
- "H5Pset_layout failed");
- }
+ herr_t ret_value = H5Pset_layout(id, layout);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::setLayout",
+ "H5Pset_layout failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::getLayout
-///\brief Retrieves the layout type of this property list
-///\return Layout type, which can be:
-/// \li \c H5D_COMPACT - raw data is stored in the object
-/// header in the file.
-/// \li \c H5D_CONTIGUOUS - raw data is stored separately from the
-/// object header in one contiguous chunk in
-/// the file.
-/// \li \c H5D_CHUNKED - raw data is stored separately from the
-/// object header in chunks in separate locations
-/// in the file.
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::getLayout
+///\brief Retrieves the layout type of this property list
+///\return Layout type, which can be:
+/// \li \c H5D_COMPACT - raw data is stored in the object
+/// header in the file.
+/// \li \c H5D_CONTIGUOUS - raw data is stored separately from the
+/// object header in one contiguous chunk in
+/// the file.
+/// \li \c H5D_CHUNKED - raw data is stored separately from the
+/// object header in chunks in separate locations
+/// in the file.
+///\exception H5::PropListIException
///\par Description
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5D_layout_t DSetCreatPropList::getLayout() const
{
- H5D_layout_t layout = H5Pget_layout( id );
- if( layout == H5D_LAYOUT_ERROR )
- {
- throw PropListIException("DSetCreatPropList::getLayout",
- "H5Pget_layout returns H5D_LAYOUT_ERROR");
- }
- return( layout );
+ H5D_layout_t layout = H5Pget_layout(id);
+ if (layout == H5D_LAYOUT_ERROR)
+ {
+ throw PropListIException("DSetCreatPropList::getLayout",
+ "H5Pget_layout returns H5D_LAYOUT_ERROR");
+ }
+ return(layout);
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::setDeflate
-///\brief Sets compression method and compression level
-///\param level - IN: Compression level, should [0..9], inclusive
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::setDeflate
+///\brief Sets compression method and compression level
+///\param level - IN: Compression level, should [0..9], inclusive
+///\exception H5::PropListIException
///\par Description
-/// The function sets the compression method for this property
-/// list to \c H5D_COMPRESS_DEFLATE and the compression level to
-/// \a level. Lower compression levels are faster but result in
-/// less compression.
-// Programmer Binh-Minh Ribler - 2000
+/// The function sets the compression method for this property
+/// list to \c H5D_COMPRESS_DEFLATE and the compression level to
+/// \a level. Lower compression levels are faster but result in
+/// less compression.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setDeflate( int level ) const
+void DSetCreatPropList::setDeflate(int level) const
{
- herr_t ret_value = H5Pset_deflate( id, level );
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::setDeflate",
- "H5Pset_deflate failed");
- }
+ herr_t ret_value = H5Pset_deflate(id, level);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::setDeflate",
+ "H5Pset_deflate failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::setSzip
-///\brief Sets up for the use of the SZIP compression filter.
-///\param options_mask - IN: A bit-mask conveying the desired SZIP
-/// options. Valid values are H5_SZIP_EC_OPTION_MASK
-/// and H5_SZIP_NN_OPTION_MASK.
-///\param pixels_per_block - IN: Number of pixels or data elements in
-/// each data block.
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::setSzip
+///\brief Sets up for the use of the SZIP compression filter.
+///\param options_mask - IN: A bit-mask conveying the desired SZIP
+/// options. Valid values are H5_SZIP_EC_OPTION_MASK
+/// and H5_SZIP_NN_OPTION_MASK.
+///\param pixels_per_block - IN: Number of pixels or data elements in
+/// each data block.
+///\exception H5::PropListIException
///\par Description
-/// The associate C function sets an SZIP compression filter,
-/// H5Z_FILTER_SZIP, for a dataset. For more information about
-/// SZIP and usage, please refer to the C layer Reference
-/// Manual at:
+/// The associate C function sets an SZIP compression filter,
+/// H5Z_FILTER_SZIP, for a dataset. For more information about
+/// SZIP and usage, please refer to the C layer Reference
+/// Manual at:
/// http://hdfgroup.org/HDF5/doc/RM_H5P.html#Property-SetSzip
-// Programmer Binh-Minh Ribler - Jan, 2007
+// Programmer Binh-Minh Ribler - Jan, 2007
//--------------------------------------------------------------------------
void DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_per_block) const
{
herr_t ret_value = H5Pset_szip(id, options_mask, pixels_per_block);
- if( ret_value < 0 )
+ if (ret_value < 0)
{
- throw PropListIException("DSetCreatPropList::setSzip",
- "H5Pset_szip failed");
+ throw PropListIException("DSetCreatPropList::setSzip",
+ "H5Pset_szip failed");
}
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::setNbit
-///\brief Sets up for the use of the Nbit compression filter.
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::setNbit
+///\brief Sets up for the use of the Nbit compression filter.
+///\exception H5::PropListIException
///\par Description
-/// The associate C function sets an Nbit compression filter,
-/// H5Z_FILTER_NBIT, for a dataset. For more information about
-/// Nbit compression, please refer to the C layer Reference
-/// Manual at:
+/// The associate C function sets an Nbit compression filter,
+/// H5Z_FILTER_NBIT, for a dataset. For more information about
+/// Nbit compression, please refer to the C layer Reference
+/// Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-setNbit
-// Programmer Binh-Minh Ribler - Apr, 2016
+// Programmer Binh-Minh Ribler - Apr, 2016
//--------------------------------------------------------------------------
void DSetCreatPropList::setNbit() const
{
herr_t ret_value = H5Pset_nbit(id);
- if( ret_value < 0 )
+ if (ret_value < 0)
{
- throw PropListIException("DSetCreatPropList::setNbit",
- "H5Pset_nbit failed");
+ throw PropListIException("DSetCreatPropList::setNbit",
+ "H5Pset_nbit failed");
}
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::setFillValue
-///\brief Sets a dataset fill value
-///\param fvalue_type - IN: Data type for the value passed via \a value
-///\param value - IN: Pointer to buffer containing the fill value
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::setFillValue
+///\brief Sets a dataset fill value
+///\param fvalue_type - IN: Data type for the value passed via \a value
+///\param value - IN: Pointer to buffer containing the fill value
+///\exception H5::PropListIException
///\par Description
-/// The datatype may differ from that of the dataset, but it must
-/// be one that the HDF5 library is able to convert \a value to
-/// the dataset datatype when the dataset is created.
-/// The default fill value is 0 (zero,) which is interpreted
-/// according to the actual dataset datatype.
+/// The datatype may differ from that of the dataset, but it must
+/// be one that the HDF5 library is able to convert \a value to
+/// the dataset datatype when the dataset is created.
+/// The default fill value is 0 (zero,) which is interpreted
+/// according to the actual dataset datatype.
///\par
-/// For information on setting fill value, please refer to the
-/// C layer Reference Manual at:
+/// For information on setting fill value, please refer to the
+/// C layer Reference Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFillValue
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::setFillValue( const DataType& fvalue_type, const void* value ) const
+void DSetCreatPropList::setFillValue(const DataType& fvalue_type, const void* value) const
{
- herr_t ret_value = H5Pset_fill_value( id, fvalue_type.getId(), value );
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::setFillValue",
+ herr_t ret_value = H5Pset_fill_value(id, fvalue_type.getId(), value);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::setFillValue",
"H5Pset_fill_value failed");
- }
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::getFillValue
-///\brief Retrieves a dataset fill value
-///\param fvalue_type - IN: Data type for the value passed via \a value
-///\param value - OUT: Pointer to buffer to hold the retrieved fill value
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::getFillValue
+///\brief Retrieves a dataset fill value
+///\param fvalue_type - IN: Data type for the value passed via \a value
+///\param value - OUT: Pointer to buffer to hold the retrieved fill value
+///\exception H5::PropListIException
///\par Description
-/// The fill value is returned through \a value pointer
-/// and the memory is allocated by the caller. The fill
-/// value will be converted from its current data type to the
-/// specified by \a fvalue_type.
-// Programmer Binh-Minh Ribler - 2000
+/// The fill value is returned through \a value pointer
+/// and the memory is allocated by the caller. The fill
+/// value will be converted from its current data type to the
+/// specified by \a fvalue_type.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetCreatPropList::getFillValue( const DataType& fvalue_type, void* value ) const
+void DSetCreatPropList::getFillValue(const DataType& fvalue_type, void* value) const
{
- herr_t ret_value = H5Pget_fill_value( id, fvalue_type.getId(), value );
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::getFillValue",
+ herr_t ret_value = H5Pget_fill_value(id, fvalue_type.getId(), value);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::getFillValue",
"H5Pget_fill_value failed");
- }
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::isFillValueDefined
-///\brief Check if fill value has been defined for this property
+// Function: DSetCreatPropList::isFillValueDefined
+///\brief Check if fill value has been defined for this property
///\return
-/// \li \c H5D_FILL_VALUE_UNDEFINED =0,
-/// \li \c H5D_FILL_VALUE_DEFAULT =1,
-/// \li \c H5D_FILL_VALUE_USER_DEFINED =2
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - 2000
+/// \li \c H5D_FILL_VALUE_UNDEFINED =0,
+/// \li \c H5D_FILL_VALUE_DEFAULT =1,
+/// \li \c H5D_FILL_VALUE_USER_DEFINED =2
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5D_fill_value_t DSetCreatPropList::isFillValueDefined() const
{
- H5D_fill_value_t status;
- herr_t ret_value = H5Pfill_value_defined(id, &status);
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::isFillValueDefined",
+ H5D_fill_value_t status;
+ herr_t ret_value = H5Pfill_value_defined(id, &status);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::isFillValueDefined",
"H5Pfill_value_defined returned H5D_FILL_VALUE_ERROR (-1)");
- }
- else
- return (status);
+ }
+ else
+ return (status);
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::setFilter
-///\brief Adds a filter to the filter pipeline
-///\param filter_id - IN: Filter to add
-///\param flags - IN: Specifies general properties of the filter
-///\param cd_nelmts - IN: Number of elements in cd_values
-///\param cd_values - IN: Auxiliary data for the filter
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::setFilter
+///\brief Adds a filter to the filter pipeline
+///\param filter_id - IN: Filter to add
+///\param flags - IN: Specifies general properties of the filter
+///\param cd_nelmts - IN: Number of elements in cd_values
+///\param cd_values - IN: Auxiliary data for the filter
+///\exception H5::PropListIException
///\par Description
-/// The \a flags argument is a bit vector of the field:
-/// \c H5Z_FLAG_OPTIONAL(0x0001)
+/// The \a flags argument is a bit vector of the field:
+/// \c H5Z_FLAG_OPTIONAL(0x0001)
///\par
-/// If this bit is set then the filter is optional. If the filter
-/// fails during a \c DataSet::write() operation then the filter
-/// is just excluded from the pipeline for the chunk for which it
-/// failed; the filter will not participate in the pipeline
-/// during a \c DataSet::read() of the chunk. If this bit is clear
-/// and the filter fails then the entire I/O operation fails.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void DSetCreatPropList::setFilter( H5Z_filter_t filter_id, unsigned int flags,
- size_t cd_nelmts, const unsigned int cd_values[] ) const
+/// If this bit is set then the filter is optional. If the filter
+/// fails during a \c DataSet::write() operation then the filter
+/// is just excluded from the pipeline for the chunk for which it
+/// failed; the filter will not participate in the pipeline
+/// during a \c DataSet::read() of the chunk. If this bit is clear
+/// and the filter fails then the entire I/O operation fails.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void DSetCreatPropList::setFilter(H5Z_filter_t filter_id, unsigned int flags,
+ size_t cd_nelmts, const unsigned int cd_values[]) const
{
- herr_t ret_value = H5Pset_filter( id, filter_id, flags, cd_nelmts, cd_values );
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::setFilter",
+ herr_t ret_value = H5Pset_filter(id, filter_id, flags, cd_nelmts, cd_values);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::setFilter",
"H5Pset_filter failed");
- }
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::removeFilter
-///\brief Removes one or more filters
-///\param filter_id - IN: Filter to remove
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::removeFilter
+///\brief Removes one or more filters
+///\param filter_id - IN: Filter to remove
+///\exception H5::PropListIException
///\par Description
-/// Deletes a filter from the dataset creation property list;
-/// deletes all filters if \a filter_id is \c H5Z_FILTER_NONE.
-// Programmer Binh-Minh Ribler - 2000
+/// Deletes a filter from the dataset creation property list;
+/// deletes all filters if \a filter_id is \c H5Z_FILTER_NONE.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::removeFilter(H5Z_filter_t filter_id) const
{
- herr_t ret_value = H5Premove_filter( id, filter_id);
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::removeFilter",
+ herr_t ret_value = H5Premove_filter(id, filter_id);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::removeFilter",
"H5Premove_filter failed");
- }
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::getNfilters
-///\brief Returns the number of filters in the pipeline
-///\return Number of filters
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DSetCreatPropList::getNfilters
+///\brief Returns the number of filters in the pipeline
+///\return Number of filters
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int DSetCreatPropList::getNfilters() const
{
- int num_filters = H5Pget_nfilters( id );
- if( num_filters < 0 )
- {
- throw PropListIException("DSetCreatPropList::getNfilters",
+ int num_filters = H5Pget_nfilters(id);
+ if (num_filters < 0)
+ {
+ throw PropListIException("DSetCreatPropList::getNfilters",
"H5Pget_nfilters returned negative number of filters");
- }
- else
- return( num_filters );
+ }
+ else
+ return(num_filters);
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::getFilter
-///\brief Returns information about a filter in a pipeline
-///\param filter_number - IN: Filter to get, range [0..N-1], where
-/// N is returned by H5Pget_nfilters()
-///\param flags - OUT: General properties of the filter
-///\param cd_nelmts - IN/OUT: Number of elements in \a cd_values /Number
-/// of values defined by the filter
-///\param cd_values - OUT: Array to hold the data; allocated by the user
-///\param namelen - IN: Length of \a name
-///\param name - OUT: Name of the filter
-///\param filter_config - OUT: Flags indicating whether filter can encode/decode
-///\return Filter id
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::getFilter
+///\brief Returns information about a filter in a pipeline
+///\param filter_number - IN: Filter to get, range [0..N-1], where
+/// N is returned by H5Pget_nfilters()
+///\param flags - OUT: General properties of the filter
+///\param cd_nelmts - IN/OUT: Number of elements in \a cd_values /Number
+/// of values defined by the filter
+///\param cd_values - OUT: Array to hold the data; allocated by the user
+///\param namelen - IN: Length of \a name
+///\param name - OUT: Name of the filter
+///\param filter_config - OUT: Flags indicating whether filter can encode/decode
+///\return Filter id
+///\exception H5::PropListIException
///\par Description
-/// Failure occurs when \a filter_number is out of range.
-// Note: the first argument was mistakenly typed as int instead
-// of unsigned int, but for backward compatibility, it cannot be
-// changed. -BMR (2014/04/15)
+/// Failure occurs when \a filter_number is out of range.
+// Note: the first argument was mistakenly typed as int instead
+// of unsigned int, but for backward compatibility, it cannot be
+// changed. -BMR (2014/04/15)
//--------------------------------------------------------------------------
H5Z_filter_t DSetCreatPropList::getFilter(int filter_number,
- unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values,
- size_t namelen, char name[], unsigned int& filter_config) const
+ unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values,
+ size_t namelen, char name[], unsigned int& filter_config) const
{
- H5Z_filter_t filter_id;
- filter_id = H5Pget_filter2(id, filter_number, &flags, &cd_nelmts,
- cd_values, namelen, name, &filter_config);
- if( filter_id == H5Z_FILTER_ERROR )
- throw PropListIException("DSetCreatPropList::getFilter",
+ H5Z_filter_t filter_id;
+ filter_id = H5Pget_filter2(id, filter_number, &flags, &cd_nelmts,
+ cd_values, namelen, name, &filter_config);
+ if (filter_id == H5Z_FILTER_ERROR)
+ throw PropListIException("DSetCreatPropList::getFilter",
"H5Pget_filter2 returned H5Z_FILTER_ERROR");
- else
- return(filter_id);
+ else
+ return(filter_id);
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::getFilterById
-///\brief Returns information about a filter in a pipeline given the
-/// filter id
-///\param filter_id - IN: Filter to get
-///\param flags - OUT: General properties of the filter
-///\param cd_nelmts - IN/OUT: Number of elements in \a cd_values /Number
-/// of values defined by the filter
-///\param cd_values - OUT: Array to hold the data; allocated by the user
-///\param namelen - IN: Length of \a name
-///\param name - OUT: Name of the filter
-///\param filter_config - OUT: Flags indicating whether filter can encode/decode
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DSetCreatPropList::getFilterById
+///\brief Returns information about a filter in a pipeline given the
+/// filter id
+///\param filter_id - IN: Filter to get
+///\param flags - OUT: General properties of the filter
+///\param cd_nelmts - IN/OUT: Number of elements in \a cd_values /Number
+/// of values defined by the filter
+///\param cd_values - OUT: Array to hold the data; allocated by the user
+///\param namelen - IN: Length of \a name
+///\param name - OUT: Name of the filter
+///\param filter_config - OUT: Flags indicating whether filter can encode/decode
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::getFilterById(H5Z_filter_t filter_id,
- unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values,
- size_t namelen, char name[], unsigned int &filter_config) const
+ unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values,
+ size_t namelen, char name[], unsigned int &filter_config) const
{
- herr_t ret_value = H5Pget_filter_by_id2(id, filter_id, &flags, &cd_nelmts,
- cd_values, namelen, name, &filter_config);
- if (ret_value < 0)
- throw PropListIException("DSetCreatPropList::getFilterById",
+ herr_t ret_value = H5Pget_filter_by_id2(id, filter_id, &flags, &cd_nelmts,
+ cd_values, namelen, name, &filter_config);
+ if (ret_value < 0)
+ throw PropListIException("DSetCreatPropList::getFilterById",
"H5Pget_filter_by_id2 failed");
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::modifyFilter
-///\brief Modifies the specified filter
-///\param filter_id - IN: Filter to get
-///\param flags - OUT: General properties of the filter
-///\param cd_nelmts - IN: Number of elements in \a cd_values
-/// \n OUT: Number of values defined by the filter
-///\param cd_values - OUT: Array to hold the data; allocated by the user
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::modifyFilter
+///\brief Modifies the specified filter
+///\param filter_id - IN: Filter to get
+///\param flags - OUT: General properties of the filter
+///\param cd_nelmts - IN: Number of elements in \a cd_values
+/// \n OUT: Number of values defined by the filter
+///\param cd_values - OUT: Array to hold the data; allocated by the user
+///\exception H5::PropListIException
///\par Description
-/// The \a flags argument is a bit vector of the field:
-/// \c H5Z_FLAG_OPTIONAL(0x0001)
+/// The \a flags argument is a bit vector of the field:
+/// \c H5Z_FLAG_OPTIONAL(0x0001)
///\par
-/// If this bit is set then the filter is optional. If the filter
-/// fails during a DataSet::write() operation then the filter
-/// is just excluded from the pipeline for the chunk for which it
-/// failed; the filter will not participate in the pipeline
-/// during a DataSet::read() of the chunk. If this bit is clear
-/// and the filter fails then the entire I/O operation fails.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void DSetCreatPropList::modifyFilter( H5Z_filter_t filter_id, unsigned int
- flags, size_t cd_nelmts, const unsigned int cd_values[] ) const
+/// If this bit is set then the filter is optional. If the filter
+/// fails during a DataSet::write() operation then the filter
+/// is just excluded from the pipeline for the chunk for which it
+/// failed; the filter will not participate in the pipeline
+/// during a DataSet::read() of the chunk. If this bit is clear
+/// and the filter fails then the entire I/O operation fails.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void DSetCreatPropList::modifyFilter(H5Z_filter_t filter_id, unsigned int
+ flags, size_t cd_nelmts, const unsigned int cd_values[]) const
{
- herr_t ret_value = H5Pmodify_filter(id, filter_id, flags, cd_nelmts, cd_values);
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::modifyFilter",
+ herr_t ret_value = H5Pmodify_filter(id, filter_id, flags, cd_nelmts, cd_values);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::modifyFilter",
"H5Pmodify_filter failed");
- }
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::allFiltersAvail
-///\brief Queries whether all the filters set in this property list
-/// are available currently.
-///\return true if all filters available, and false if one or more
-/// filters not currently available
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DSetCreatPropList::allFiltersAvail
+///\brief Queries whether all the filters set in this property list
+/// are available currently.
+///\return true if all filters available, and false if one or more
+/// filters not currently available
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
bool DSetCreatPropList::allFiltersAvail() const
{
- htri_t ret_value = H5Pall_filters_avail(id);
- if( ret_value > 0 )
- return true;
- else if( ret_value == 0 )
- return false;
- else // Raise exception when H5Pall_filters_avail returns a negative value
- {
- throw PropListIException("DSetCreatPropList::allFiltersAvail", "H5Pall_filters_avail returned negative value");
- }
+ htri_t ret_value = H5Pall_filters_avail(id);
+ if (ret_value > 0)
+ return true;
+ else if (ret_value == 0)
+ return false;
+ else // Raise exception when H5Pall_filters_avail returns a negative value
+ {
+ throw PropListIException("DSetCreatPropList::allFiltersAvail", "H5Pall_filters_avail returned negative value");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::setShuffle
-///\brief Sets method of the shuffle filter
+// Function: DSetCreatPropList::setShuffle
+///\brief Sets method of the shuffle filter
///
-///\exception H5::PropListIException
+///\exception H5::PropListIException
///\par Description
-/// Please refer to the Reference Manual of \c H5Pset_shuffle for
-/// details.
+/// Please refer to the Reference Manual of \c H5Pset_shuffle for
+/// details.
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetShuffle
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setShuffle() const
{
- herr_t ret_value = H5Pset_shuffle(id);
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::setShuffle",
+ herr_t ret_value = H5Pset_shuffle(id);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::setShuffle",
"H5Pset_shuffle failed");
- }
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::getAllocTime
-///\brief Get space allocation time for this property.
-///\return Space allocation time.
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::getAllocTime
+///\brief Get space allocation time for this property.
+///\return Space allocation time.
+///\exception H5::PropListIException
///\par Description
-/// The values of space allocation time can be one of the
-/// followings:
-/// \li \c H5D_ALLOC_TIME_DEFAULT
-/// \li \c H5D_ALLOC_TIME_EARLY
-/// \li \c H5D_ALLOC_TIME_LATE
-/// \li \c H5D_ALLOC_TIME_INCR
-// Programmer Binh-Minh Ribler - 2000
+/// The values of space allocation time can be one of the
+/// followings:
+/// \li \c H5D_ALLOC_TIME_DEFAULT
+/// \li \c H5D_ALLOC_TIME_EARLY
+/// \li \c H5D_ALLOC_TIME_LATE
+/// \li \c H5D_ALLOC_TIME_INCR
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5D_alloc_time_t DSetCreatPropList::getAllocTime() const
{
- H5D_alloc_time_t alloc_time;
- herr_t ret_value = H5Pget_alloc_time(id, &alloc_time);
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::getAllocTime",
+ H5D_alloc_time_t alloc_time;
+ herr_t ret_value = H5Pget_alloc_time(id, &alloc_time);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::getAllocTime",
"H5Pget_alloc_time failed");
- }
- else
- return (alloc_time);
+ }
+ else
+ return (alloc_time);
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::getFillTime
-///\brief Gets fill value writing time.
-///\return Fill value writing time
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::getFillTime
+///\brief Gets fill value writing time.
+///\return Fill value writing time
+///\exception H5::PropListIException
///\par Description
-/// Valid values for fill value writing time include
-/// \li \c H5D_FILL_TIME_NEVER
-/// \li \c H5D_FILL_TIME_ALLOC.
-// Programmer Binh-Minh Ribler - 2000
+/// Valid values for fill value writing time include
+/// \li \c H5D_FILL_TIME_NEVER
+/// \li \c H5D_FILL_TIME_ALLOC.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5D_fill_time_t DSetCreatPropList::getFillTime() const
{
- H5D_fill_time_t fill_time;
- herr_t ret_value = H5Pget_fill_time(id, &fill_time);
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::getFillTime",
+ H5D_fill_time_t fill_time;
+ herr_t ret_value = H5Pget_fill_time(id, &fill_time);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::getFillTime",
"H5Pget_fill_time failed");
- }
- else
- return (fill_time);
+ }
+ else
+ return (fill_time);
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::setAllocTime
-///\brief Sets space allocation time for dataset during creation.
-///\param alloc_time - IN: Allocation time
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::setAllocTime
+///\brief Sets space allocation time for dataset during creation.
+///\param alloc_time - IN: Allocation time
+///\exception H5::PropListIException
///\par Description
-/// Valid values for space allocation time include:
-/// \li \c H5D_ALLOC_TIME_DEFAULT
-/// \li \c H5D_ALLOC_TIME_EARLY
-/// \li \c H5D_ALLOC_TIME_LATE
-/// \li \c H5D_ALLOC_TIME_INCR
-// Programmer Binh-Minh Ribler - 2000
+/// Valid values for space allocation time include:
+/// \li \c H5D_ALLOC_TIME_DEFAULT
+/// \li \c H5D_ALLOC_TIME_EARLY
+/// \li \c H5D_ALLOC_TIME_LATE
+/// \li \c H5D_ALLOC_TIME_INCR
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time) const
{
- herr_t ret_value = H5Pset_alloc_time(id, alloc_time);
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::setAllocTime",
+ herr_t ret_value = H5Pset_alloc_time(id, alloc_time);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::setAllocTime",
"H5Pset_alloc_time failed");
- }
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::setFillTime
-///\brief Sets fill value writing time for dataset.
-///\return Fill value writing time
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::setFillTime
+///\brief Sets fill value writing time for dataset.
+///\return Fill value writing time
+///\exception H5::PropListIException
///\par Description
-/// Valid values for fill value writing time include
-/// \li \c H5D_FILL_TIME_NEVER
-/// \li \c H5D_FILL_TIME_ALLOC.
-// Programmer Binh-Minh Ribler - 2000
+/// Valid values for fill value writing time include
+/// \li \c H5D_FILL_TIME_NEVER
+/// \li \c H5D_FILL_TIME_ALLOC.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time) const
{
- herr_t ret_value = H5Pset_fill_time(id, fill_time);
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::setFillTime",
+ herr_t ret_value = H5Pset_fill_time(id, fill_time);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::setFillTime",
"H5Pset_fill_time failed");
- }
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::setFletcher32
-///\brief Sets Fletcher32 checksum of EDC for this property list.
+// Function: DSetCreatPropList::setFletcher32
+///\brief Sets Fletcher32 checksum of EDC for this property list.
///
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - 2000
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setFletcher32() const
{
- herr_t ret_value = H5Pset_fletcher32(id);
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::setFletcher32",
+ herr_t ret_value = H5Pset_fletcher32(id);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::setFletcher32",
"H5Pset_fletcher32 failed");
- }
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::setExternal
-///\brief Adds an external file to the list of external files
-///\param name - IN: Name of the external file
-///\param offset - IN: Location where the data starts in the file
-///\param size - IN: Number of bytes reserved in the file for the data
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::setExternal
+///\brief Adds an external file to the list of external files
+///\param name - IN: Name of the external file
+///\param offset - IN: Location where the data starts in the file
+///\param size - IN: Number of bytes reserved in the file for the data
+///\exception H5::PropListIException
///\par Description
-/// If a dataset is splitted across multiple files then the files
-/// should be defined in order. The total size of the dataset is
-/// the sum of the \a size arguments for all the external files. If
-/// the total size is larger than the size of a dataset then the
-/// dataset can be extended (provided the data space also allows
-/// the extending).
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void DSetCreatPropList::setExternal( const char* name, off_t offset, hsize_t size ) const
+/// If a dataset is splitted across multiple files then the files
+/// should be defined in order. The total size of the dataset is
+/// the sum of the \a size arguments for all the external files. If
+/// the total size is larger than the size of a dataset then the
+/// dataset can be extended (provided the data space also allows
+/// the extending).
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void DSetCreatPropList::setExternal(const char* name, off_t offset, hsize_t size) const
{
- herr_t ret_value = H5Pset_external( id, name, offset, size );
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::setExternal",
+ herr_t ret_value = H5Pset_external(id, name, offset, size);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::setExternal",
"H5Pset_external failed");
- }
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::getExternalCount
-///\brief Returns the number of external files for a dataset
-///\return Number of external files
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: DSetCreatPropList::getExternalCount
+///\brief Returns the number of external files for a dataset
+///\return Number of external files
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int DSetCreatPropList::getExternalCount() const
{
- int num_ext_files = H5Pget_external_count( id );
- if( num_ext_files < 0 )
- {
- throw PropListIException("DSetCreatPropList::getExternalCount",
+ int num_ext_files = H5Pget_external_count(id);
+ if (num_ext_files < 0)
+ {
+ throw PropListIException("DSetCreatPropList::getExternalCount",
"H5Pget_external_count returns negative number of external files");
- }
- else
- return( num_ext_files );
+ }
+ else
+ return(num_ext_files);
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList::getExternal
-///\brief Returns information about an external file
-///\param idx - IN: Index of the external file, ranges [0-(N-1)] and
-/// returned by getExternalCount()
-///\param name_size - IN: Maximum length of \a name
-///\param name - OUT: Name of the external file
-///\param offset - OUT: Location to return an offset value
-///\param size - OUT: Location to return the size of the external file data
-///\exception H5::PropListIException
+// Function: DSetCreatPropList::getExternal
+///\brief Returns information about an external file
+///\param idx - IN: Index of the external file, ranges [0-(N-1)] and
+/// returned by getExternalCount()
+///\param name_size - IN: Maximum length of \a name
+///\param name - OUT: Name of the external file
+///\param offset - OUT: Location to return an offset value
+///\param size - OUT: Location to return the size of the external file data
+///\exception H5::PropListIException
///\par Description
-/// The parameter \a idx ranges [0..N-1] where N is returned by
-/// getExternalCount(). At most \a name_size characters are copied
-/// into the name array. If the external file name is longer than
-/// name_size with the null terminator, the return value is not
-/// null terminated (similar to strncpy()).
-/// If \a name_size is zero or \a name is a null pointer, the
-/// external file name will not be returned. If \a offset or
-/// \a size are null pointers then the corresponding information
-/// will not be returned.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void DSetCreatPropList::getExternal( unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const
+/// The parameter \a idx ranges [0..N-1] where N is returned by
+/// getExternalCount(). At most \a name_size characters are copied
+/// into the name array. If the external file name is longer than
+/// name_size with the null terminator, the return value is not
+/// null terminated (similar to strncpy()).
+/// If \a name_size is zero or \a name is a null pointer, the
+/// external file name will not be returned. If \a offset or
+/// \a size are null pointers then the corresponding information
+/// will not be returned.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size) const
{
- herr_t ret_value = H5Pget_external( id, idx, name_size, name, &offset, &size );
- if( ret_value < 0 )
- {
- throw PropListIException("DSetCreatPropList::getExternal",
+ herr_t ret_value = H5Pget_external(id, idx, name_size, name, &offset, &size);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetCreatPropList::getExternal",
"H5Pget_external failed");
- }
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetCreatPropList destructor
-///\brief Noop destructor.
+// Function: DSetCreatPropList destructor
+///\brief Noop destructor.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetCreatPropList::~DSetCreatPropList () {}
+DSetCreatPropList::~DSetCreatPropList() {}
} // end namespace
diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h
index 60ce1d5..b536709 100644
--- a/c++/src/H5DcreatProp.h
+++ b/c++/src/H5DcreatProp.h
@@ -29,105 +29,105 @@ class DataType;
*/
class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
public:
- ///\brief Default dataset creation property list.
- static const DSetCreatPropList& DEFAULT;
+ ///\brief Default dataset creation property list.
+ static const DSetCreatPropList& DEFAULT;
- // Creates a dataset creation property list.
- DSetCreatPropList();
+ // Creates a dataset creation property list.
+ DSetCreatPropList();
- // Queries whether all the filters set in this property list are
- // available currently.
- bool allFiltersAvail() const;
+ // Queries whether all the filters set in this property list are
+ // available currently.
+ bool allFiltersAvail() const;
- // Get space allocation time for this property.
- H5D_alloc_time_t getAllocTime() const;
+ // Get space allocation time for this property.
+ H5D_alloc_time_t getAllocTime() const;
- // Set space allocation time for dataset during creation.
- void setAllocTime(H5D_alloc_time_t alloc_time) const;
+ // Set space allocation time for dataset during creation.
+ void setAllocTime(H5D_alloc_time_t alloc_time) const;
- // Retrieves the size of the chunks used to store a chunked layout dataset.
- int getChunk( int max_ndims, hsize_t* dim ) const;
+ // Retrieves the size of the chunks used to store a chunked layout dataset.
+ int getChunk(int max_ndims, hsize_t* dim) const;
- // Sets the size of the chunks used to store a chunked layout dataset.
- void setChunk( int ndims, const hsize_t* dim ) const;
+ // Sets the size of the chunks used to store a chunked layout dataset.
+ void setChunk(int ndims, const hsize_t* dim) const;
- // Returns information about an external file.
- void getExternal( unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const;
+ // Returns information about an external file.
+ void getExternal(unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size) const;
- // Returns the number of external files for a dataset.
- int getExternalCount() const;
+ // Returns the number of external files for a dataset.
+ int getExternalCount() const;
- // Gets fill value writing time.
- H5D_fill_time_t getFillTime() const;
+ // Gets fill value writing time.
+ H5D_fill_time_t getFillTime() const;
- // Sets fill value writing time for dataset.
- void setFillTime(H5D_fill_time_t fill_time) const;
+ // Sets fill value writing time for dataset.
+ void setFillTime(H5D_fill_time_t fill_time) const;
- // Retrieves a dataset fill value.
- void getFillValue( const DataType& fvalue_type, void* value ) const;
+ // Retrieves a dataset fill value.
+ void getFillValue(const DataType& fvalue_type, void* value) const;
- // Sets a dataset fill value.
- void setFillValue( const DataType& fvalue_type, const void* value ) const;
+ // Sets a dataset fill value.
+ void setFillValue(const DataType& fvalue_type, const void* value) const;
- // Returns information about a filter in a pipeline.
- H5Z_filter_t getFilter(int filter_number, unsigned int& flags, size_t& cd_nelmts, unsigned int* cd_values, size_t namelen, char name[], unsigned int &filter_config) const;
+ // Returns information about a filter in a pipeline.
+ H5Z_filter_t getFilter(int filter_number, unsigned int& flags, size_t& cd_nelmts, unsigned int* cd_values, size_t namelen, char name[], unsigned int &filter_config) const;
- // Returns information about a filter in a pipeline given the filter id.
- void getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values, size_t namelen, char name[], unsigned int &filter_config) const;
+ // Returns information about a filter in a pipeline given the filter id.
+ void getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values, size_t namelen, char name[], unsigned int &filter_config) const;
- // Gets the layout of the raw data storage of the data that uses this
- // property list.
- H5D_layout_t getLayout() const;
+ // Gets the layout of the raw data storage of the data that uses this
+ // property list.
+ H5D_layout_t getLayout() const;
- // Sets the type of storage used to store the raw data for the
- // dataset that uses this property list.
- void setLayout(H5D_layout_t layout) const;
+ // Sets the type of storage used to store the raw data for the
+ // dataset that uses this property list.
+ void setLayout(H5D_layout_t layout) const;
- // Returns the number of filters in the pipeline.
- int getNfilters() const;
+ // Returns the number of filters in the pipeline.
+ int getNfilters() const;
- // Checks if fill value has been defined for this property.
- H5D_fill_value_t isFillValueDefined() const;
+ // Checks if fill value has been defined for this property.
+ H5D_fill_value_t isFillValueDefined() const;
- // Modifies the specified filter.
- void modifyFilter( H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[] ) const;
+ // Modifies the specified filter.
+ void modifyFilter(H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[]) const;
- // Remove one or all filters from the filter pipeline.
- void removeFilter( H5Z_filter_t filter_id) const;
+ // Remove one or all filters from the filter pipeline.
+ void removeFilter(H5Z_filter_t filter_id) const;
- // Sets compression method and compression level.
- void setDeflate( int level ) const;
+ // Sets compression method and compression level.
+ void setDeflate(int level) const;
- // Adds an external file to the list of external files.
- void setExternal( const char* name, off_t offset, hsize_t size ) const;
+ // Adds an external file to the list of external files.
+ void setExternal(const char* name, off_t offset, hsize_t size) const;
- // Adds a filter to the filter pipeline.
- void setFilter( H5Z_filter_t filter, unsigned int flags = 0, size_t cd_nelmts = 0, const unsigned int cd_values[] = NULL) const;
+ // Adds a filter to the filter pipeline.
+ void setFilter(H5Z_filter_t filter, unsigned int flags = 0, size_t cd_nelmts = 0, const unsigned int cd_values[] = NULL) const;
- // Sets Fletcher32 checksum of EDC for this property list.
- void setFletcher32() const;
+ // Sets Fletcher32 checksum of EDC for this property list.
+ void setFletcher32() const;
- // Sets method of the shuffle filter.
- void setShuffle() const;
+ // Sets method of the shuffle filter.
+ void setShuffle() const;
- // Sets SZIP compression method.
- void setSzip(unsigned int options_mask, unsigned int pixels_per_block) const;
+ // Sets SZIP compression method.
+ void setSzip(unsigned int options_mask, unsigned int pixels_per_block) const;
- // Sets N-bit compression method.
- void setNbit() const;
+ // Sets N-bit compression method.
+ void setNbit() const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DSetCreatPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("DSetCreatPropList"); }
- // Copy constructor: creates a copy of a DSetCreatPropList object.
- DSetCreatPropList(const DSetCreatPropList& orig);
+ // Copy constructor: creates a copy of a DSetCreatPropList object.
+ DSetCreatPropList(const DSetCreatPropList& orig);
- // Creates a copy of an existing dataset creation property list
- // using the property list id.
- DSetCreatPropList(const hid_t plist_id);
+ // Creates a copy of an existing dataset creation property list
+ // using the property list id.
+ DSetCreatPropList(const hid_t plist_id);
- // Noop destructor.
- virtual ~DSetCreatPropList();
+ // Noop destructor.
+ virtual ~DSetCreatPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -135,7 +135,7 @@ class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList {
static void deleteConstants();
private:
- static DSetCreatPropList* DEFAULT_;
+ static DSetCreatPropList* DEFAULT_;
// Creates the global constant, should only be used by the library
static DSetCreatPropList* getConstant();
diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp
index 8746d35..e018ff2 100644
--- a/c++/src/H5DxferProp.cpp
+++ b/c++/src/H5DxferProp.cpp
@@ -15,7 +15,7 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -36,7 +36,7 @@ DSetMemXferPropList* DSetMemXferPropList::DEFAULT_ = 0;
// Function: DSetMemXferPropList::getConstant
// Creates a DSetMemXferPropList object representing the HDF5
// constant H5P_DATASET_XFER, pointed to by
-// DSetMemXferPropList::DEFAULT_
+// DSetMemXferPropList::DEFAULT_
// exception H5::PropListIException
// Description
// If DSetMemXferPropList::DEFAULT_ already points to an allocated
@@ -76,25 +76,25 @@ void DSetMemXferPropList::deleteConstants()
}
//--------------------------------------------------------------------------
-// Purpose Constant for default dataset memory and transfer property list.
+// Purpose Constant for default dataset memory and transfer property list.
//--------------------------------------------------------------------------
const DSetMemXferPropList& DSetMemXferPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function DSetMemXferPropList default constructor
-///\brief Default constructor: creates a stub dataset memory and
-/// transfer property list object.
-// Programmer: Binh-Minh Ribler - 2000
+// Function DSetMemXferPropList default constructor
+///\brief Default constructor: creates a stub dataset memory and
+/// transfer property list object.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetMemXferPropList::DSetMemXferPropList() : PropList(H5P_DATASET_XFER) {}
//--------------------------------------------------------------------------
-// Function DSetMemXferPropList constructor
-///\brief Creates a dataset transfer property list with transform
-/// expression.
-// Programmer: Binh-Minh Ribler - 2000
+// Function DSetMemXferPropList constructor
+///\brief Creates a dataset transfer property list with transform
+/// expression.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetMemXferPropList::DSetMemXferPropList(const char* exp) : PropList(H5P_DATASET_XFER)
{
@@ -102,164 +102,164 @@ DSetMemXferPropList::DSetMemXferPropList(const char* exp) : PropList(H5P_DATASET
}
//--------------------------------------------------------------------------
-// Function DSetMemXferPropList copy constructor
-///\brief Copy constructor: makes a copy of the original
-/// DSetMemXferPropList object
-///\param original - IN: Original dataset memory and transfer property
-/// list object to copy
-// Programmer: Binh-Minh Ribler - 2000
+// Function DSetMemXferPropList copy constructor
+///\brief Copy constructor: makes a copy of the original
+/// DSetMemXferPropList object
+///\param original - IN: Original dataset memory and transfer property
+/// list object to copy
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList& original ) : PropList( original ) {}
+DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList& original) : PropList(original ) {}
//--------------------------------------------------------------------------
-// Function DSetMemXferPropList overloaded constructor
-///\brief Creates a DSetMemXferPropList object using the id of an
-/// existing DSetMemXferPropList.
-///\param plist_id - IN: Id of an existing dataset memory and transfer
-/// property list
-// Programmer: Binh-Minh Ribler - 2000
+// Function DSetMemXferPropList overloaded constructor
+///\brief Creates a DSetMemXferPropList object using the id of an
+/// existing DSetMemXferPropList.
+///\param plist_id - IN: Id of an existing dataset memory and transfer
+/// property list
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetMemXferPropList::DSetMemXferPropList(const hid_t plist_id) : PropList(plist_id) {}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::setBuffer
-///\brief Sets type conversion and background buffers.
-///\param size - IN: Size, in bytes, of the type conversion and background buffers
-///\param tconv - IN: Pointer to application-allocated type conversion buffer
-///\param bkg - IN: Pointer to application-allocated background buffer
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - 2000
+// Function: DSetMemXferPropList::setBuffer
+///\brief Sets type conversion and background buffers.
+///\param size - IN: Size, in bytes, of the type conversion and background buffers
+///\param tconv - IN: Pointer to application-allocated type conversion buffer
+///\param bkg - IN: Pointer to application-allocated background buffer
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setBuffer( size_t size, void* tconv, void* bkg ) const
+void DSetMemXferPropList::setBuffer(size_t size, void* tconv, void* bkg) const
{
- herr_t ret_value = H5Pset_buffer( id, size, tconv, bkg );
- if( ret_value < 0 )
- {
- throw PropListIException("DSetMemXferPropList::setBuffer",
- "H5Pset_buffer failed");
- }
+ herr_t ret_value = H5Pset_buffer(id, size, tconv, bkg);
+ if(ret_value < 0)
+ {
+ throw PropListIException("DSetMemXferPropList::setBuffer",
+ "H5Pset_buffer failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::getBuffer
-///\brief Reads buffer settings.
-///\param tconv - OUT: Pointer to application-allocated type conversion buf
-///\param bkg - OUT: Pointer to application-allocated background buffer
-///\return Buffer size, in bytes
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - 2000
+// Function: DSetMemXferPropList::getBuffer
+///\brief Reads buffer settings.
+///\param tconv - OUT: Pointer to application-allocated type conversion buf
+///\param bkg - OUT: Pointer to application-allocated background buffer
+///\return Buffer size, in bytes
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-size_t DSetMemXferPropList::getBuffer( void** tconv, void** bkg ) const
+size_t DSetMemXferPropList::getBuffer(void** tconv, void** bkg) const
{
- size_t buffer_size = H5Pget_buffer( id, tconv, bkg );
- if( buffer_size == 0 )
- {
- throw PropListIException("DSetMemXferPropList::getBuffer",
- "H5Pget_buffer returned 0 for buffer size - failure");
- }
- return( buffer_size );
+ size_t buffer_size = H5Pget_buffer(id, tconv, bkg);
+ if(buffer_size == 0)
+ {
+ throw PropListIException("DSetMemXferPropList::getBuffer",
+ "H5Pget_buffer returned 0 for buffer size - failure");
+ }
+ return(buffer_size);
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::setPreserve
-///\brief Sets the dataset transfer property list status to true or false.
-///\param status - IN: Status to set, true or false
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - 2000
+// Function: DSetMemXferPropList::setPreserve
+///\brief Sets the dataset transfer property list status to true or false.
+///\param status - IN: Status to set, true or false
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setPreserve( bool status ) const
+void DSetMemXferPropList::setPreserve(bool status) const
{
- herr_t ret_value = H5Pset_preserve( id, (hbool_t) status );
- if( ret_value < 0 )
- {
- throw PropListIException("DSetMemXferPropList::setPreserve",
- "H5Pset_preserve failed");
- }
+ herr_t ret_value = H5Pset_preserve(id, (hbool_t) status);
+ if(ret_value < 0)
+ {
+ throw PropListIException("DSetMemXferPropList::setPreserve",
+ "H5Pset_preserve failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::getPreserve
-///\brief Checks status of the dataset transfer property list.
-///\return Status of the dataset transfer property list
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - 2000
+// Function: DSetMemXferPropList::getPreserve
+///\brief Checks status of the dataset transfer property list.
+///\return Status of the dataset transfer property list
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
bool DSetMemXferPropList::getPreserve() const
{
- int ret_value = H5Pget_preserve( id );
- if( ret_value > 0 )
- return true;
- else if( ret_value == 0 )
- return false;
- else
- {
- throw PropListIException("DSetMemXferPropList::getPreserve",
- "H5Pget_preserve returned negative value for status");
- }
+ int ret_value = H5Pget_preserve(id);
+ if(ret_value > 0)
+ return true;
+ else if(ret_value == 0)
+ return false;
+ else
+ {
+ throw PropListIException("DSetMemXferPropList::getPreserve",
+ "H5Pget_preserve returned negative value for status");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::setBtreeRatios
-///\brief Sets B-tree split ratios for a dataset transfer property list.
-///\param left - IN: B-tree split ratio for left-most nodes
-///\param middle - IN: B-tree split ratio for right-most nodes and lone nodes
-///\param right - IN: B-tree split ratio for all other nodes
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - 2000
+// Function: DSetMemXferPropList::setBtreeRatios
+///\brief Sets B-tree split ratios for a dataset transfer property list.
+///\param left - IN: B-tree split ratio for left-most nodes
+///\param middle - IN: B-tree split ratio for right-most nodes and lone nodes
+///\param right - IN: B-tree split ratio for all other nodes
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setBtreeRatios( double left, double middle, double right ) const
+void DSetMemXferPropList::setBtreeRatios(double left, double middle, double right) const
{
- herr_t ret_value = H5Pset_btree_ratios( id, left, middle, right );
- if( ret_value < 0 )
- {
- throw PropListIException("DSetMemXferPropList::setBtreeRatios",
- "H5Pset_btree_ratios failed");
- }
+ herr_t ret_value = H5Pset_btree_ratios(id, left, middle, right);
+ if(ret_value < 0)
+ {
+ throw PropListIException("DSetMemXferPropList::setBtreeRatios",
+ "H5Pset_btree_ratios failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::getBtreeRatios
-///\brief Gets B-tree split ratios for a dataset transfer property list.
-///\param left - OUT: B-tree split ratio for left-most nodes
-///\param middle - OUT: B-tree split ratio for right-most nodes and lone nodes
-///\param right - OUT: B-tree split ratio for all other nodes
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - 2000
+// Function: DSetMemXferPropList::getBtreeRatios
+///\brief Gets B-tree split ratios for a dataset transfer property list.
+///\param left - OUT: B-tree split ratio for left-most nodes
+///\param middle - OUT: B-tree split ratio for right-most nodes and lone nodes
+///\param right - OUT: B-tree split ratio for all other nodes
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::getBtreeRatios( double& left, double& middle, double& right ) const
+void DSetMemXferPropList::getBtreeRatios(double& left, double& middle, double& right) const
{
- herr_t ret_value = H5Pget_btree_ratios( id, &left, &middle, &right );
- if( ret_value < 0 )
- {
- throw PropListIException("DSetMemXferPropList::getBtreeRatios",
- "H5Pget_btree_ratios failed");
- }
+ herr_t ret_value = H5Pget_btree_ratios(id, &left, &middle, &right);
+ if(ret_value < 0)
+ {
+ throw PropListIException("DSetMemXferPropList::getBtreeRatios",
+ "H5Pget_btree_ratios failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::setDataTransform
-///\brief Sets data transform expression.
-///\param expression - IN: null-terminated data transform expression (char*)
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - Mar, 2014
+// Function: DSetMemXferPropList::setDataTransform
+///\brief Sets data transform expression.
+///\param expression - IN: null-terminated data transform expression (char*)
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
void DSetMemXferPropList::setDataTransform(const char* expression) const
{
- herr_t ret_value = H5Pset_data_transform( id, expression);
- if( ret_value < 0 )
- {
- throw PropListIException("DSetMemXferPropList::setDataTransform",
- "H5Pset_data_transform failed");
- }
+ herr_t ret_value = H5Pset_data_transform(id, expression);
+ if(ret_value < 0)
+ {
+ throw PropListIException("DSetMemXferPropList::setDataTransform",
+ "H5Pset_data_transform failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::setDataTransform
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes a reference to a \c H5std_string for the expression.
-///\param expression - IN: H5std_string data transform expression
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - Mar, 2014
+// Function: DSetMemXferPropList::setDataTransform
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes a reference to a \c H5std_string for the expression.
+///\param expression - IN: H5std_string data transform expression
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
void DSetMemXferPropList::setDataTransform(const H5std_string& expression) const
{
@@ -267,13 +267,13 @@ void DSetMemXferPropList::setDataTransform(const H5std_string& expression) const
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::getDataTransform
-///\brief Sets data transform expression.
-///\param exp - OUT: buffer for data transform expression (char*)
-///\param buf_size - IN: size of buffer for expression, including the
-/// null terminator
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - Mar, 2014
+// Function: DSetMemXferPropList::getDataTransform
+///\brief Sets data transform expression.
+///\param exp - OUT: buffer for data transform expression (char*)
+///\param buf_size - IN: size of buffer for expression, including the
+/// null terminator
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const
{
@@ -285,8 +285,8 @@ ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const
// H5Pget_data_transform returns a negative value, raise an exception
if (exp_len < 0)
{
- throw PropListIException("DSetMemXferPropList::getDataTransform",
- "H5Pget_data_transform failed");
+ throw PropListIException("DSetMemXferPropList::getDataTransform",
+ "H5Pget_data_transform failed");
}
// H5Pget_data_transform will put a null terminator at the end of the
@@ -298,11 +298,11 @@ ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::getDataTransform
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes no parameter and returns a \c H5std_string for the expression.
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - Mar, 2014
+// Function: DSetMemXferPropList::getDataTransform
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes no parameter and returns a \c H5std_string for the expression.
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
H5std_string DSetMemXferPropList::getDataTransform() const
{
@@ -340,226 +340,226 @@ H5std_string DSetMemXferPropList::getDataTransform() const
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::getTypeConvCB
-///\brief Sets an exception handling callback for datatype conversion
-/// for a dataset transfer property list.
-///\param op - IN: User's function
-///\param user_data - IN: User's data
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: DSetMemXferPropList::getTypeConvCB
+///\brief Sets an exception handling callback for datatype conversion
+/// for a dataset transfer property list.
+///\param op - IN: User's function
+///\param user_data - IN: User's data
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setTypeConvCB( H5T_conv_except_func_t op, void *user_data) const
+void DSetMemXferPropList::setTypeConvCB(H5T_conv_except_func_t op, void *user_data) const
{
- herr_t ret_value = H5Pset_type_conv_cb( id, op, user_data);
- if( ret_value < 0 )
- {
- throw PropListIException("DSetMemXferPropList::setTypeConvCB",
- "H5Pset_type_conv_cb failed");
- }
+ herr_t ret_value = H5Pset_type_conv_cb(id, op, user_data);
+ if(ret_value < 0)
+ {
+ throw PropListIException("DSetMemXferPropList::setTypeConvCB",
+ "H5Pset_type_conv_cb failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::getTypeConvCB
-///\brief Gets the exception handling callback function and data.
-///\param op - IN: Retrieved user function
-///\param user_data - IN: Retrieved user data
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: DSetMemXferPropList::getTypeConvCB
+///\brief Gets the exception handling callback function and data.
+///\param op - IN: Retrieved user function
+///\param user_data - IN: Retrieved user data
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void DSetMemXferPropList::getTypeConvCB( H5T_conv_except_func_t *op, void **user_data) const
+void DSetMemXferPropList::getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const
{
- herr_t ret_value = H5Pget_type_conv_cb( id, op, user_data);
- if( ret_value < 0 )
- {
- throw PropListIException("DSetMemXferPropList::getTypeConvCB",
- "H5Pget_type_conv_cb failed");
- }
+ herr_t ret_value = H5Pget_type_conv_cb(id, op, user_data);
+ if(ret_value < 0)
+ {
+ throw PropListIException("DSetMemXferPropList::getTypeConvCB",
+ "H5Pget_type_conv_cb failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::setVlenMemManager
-///\brief Sets the memory manager for variable-length datatype allocation.
-///\param alloc_func - IN: User's allocate routine
-///\param alloc_info - IN: User's allocation parameters
-///\param free_func - IN: User's free routine
-///\param free_info - IN: User's free parameters
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - 2000
+// Function: DSetMemXferPropList::setVlenMemManager
+///\brief Sets the memory manager for variable-length datatype allocation.
+///\param alloc_func - IN: User's allocate routine
+///\param alloc_info - IN: User's allocation parameters
+///\param free_func - IN: User's free routine
+///\param free_info - IN: User's free parameters
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::setVlenMemManager( H5MM_allocate_t alloc_func, void* alloc_info, H5MM_free_t free_func, void* free_info ) const
+void DSetMemXferPropList::setVlenMemManager(H5MM_allocate_t alloc_func, void* alloc_info, H5MM_free_t free_func, void* free_info) const
{
- herr_t ret_value = H5Pset_vlen_mem_manager( id, alloc_func, alloc_info,
- free_func, free_info );
- if( ret_value < 0 )
- {
- throw PropListIException("DSetMemXferPropList::setVlenMemManager",
- "H5Pset_vlen_mem_manager failed");
- }
+ herr_t ret_value = H5Pset_vlen_mem_manager(id, alloc_func, alloc_info,
+ free_func, free_info);
+ if(ret_value < 0)
+ {
+ throw PropListIException("DSetMemXferPropList::setVlenMemManager",
+ "H5Pset_vlen_mem_manager failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::setVlenMemManager
-///\brief Sets the memory manager for variable-length datatype
-/// allocation - system \c malloc and \c free will be used.
+// Function: DSetMemXferPropList::setVlenMemManager
+///\brief Sets the memory manager for variable-length datatype
+/// allocation - system \c malloc and \c free will be used.
///
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - 2000
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetMemXferPropList::setVlenMemManager() const
{
- setVlenMemManager( NULL, NULL, NULL, NULL );
+ setVlenMemManager(NULL, NULL, NULL, NULL);
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::getVlenMemManager
-///\brief Gets the memory manager for variable-length datatype allocation
-///\param alloc_func - OUT: User's allocate routine
-///\param alloc_info - OUT: User's allocation parameters
-///\param free_func - OUT: User's free routine
-///\param free_info - OUT: User's free parameters
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - 2000
+// Function: DSetMemXferPropList::getVlenMemManager
+///\brief Gets the memory manager for variable-length datatype allocation
+///\param alloc_func - OUT: User's allocate routine
+///\param alloc_info - OUT: User's allocation parameters
+///\param free_func - OUT: User's free routine
+///\param free_info - OUT: User's free parameters
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void DSetMemXferPropList::getVlenMemManager( H5MM_allocate_t& alloc_func, void** alloc_info, H5MM_free_t& free_func, void** free_info ) const
+void DSetMemXferPropList::getVlenMemManager(H5MM_allocate_t& alloc_func, void** alloc_info, H5MM_free_t& free_func, void** free_info) const
{
- herr_t ret_value = H5Pget_vlen_mem_manager( id, &alloc_func, alloc_info, &free_func, free_info );
- if( ret_value < 0 )
- {
- throw PropListIException("DSetMemXferPropList::getVlenMemManager",
- "H5Pget_vlen_mem_manager failed");
- }
+ herr_t ret_value = H5Pget_vlen_mem_manager(id, &alloc_func, alloc_info, &free_func, free_info);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetMemXferPropList::getVlenMemManager",
+ "H5Pget_vlen_mem_manager failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::setSmallDataBlockSize
-///\brief Sets the size of a contiguous block reserved for small data.
-///\param size - IN: Maximum size, in bytes, of the small data block.
-///\exception H5::PropListIException
+// Function: DSetMemXferPropList::setSmallDataBlockSize
+///\brief Sets the size of a contiguous block reserved for small data.
+///\param size - IN: Maximum size, in bytes, of the small data block.
+///\exception H5::PropListIException
///\par Description
-/// For detail, please refer to the C layer Reference Manual at:
+/// For detail, please refer to the C layer Reference Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSmallData
-// Programmer: Binh-Minh Ribler - April, 2004
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size) const
{
- herr_t ret_value = H5Pset_small_data_block_size(id, size);
- if (ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setSmallDataBlockSize",
- "H5Pset_small_data_block_size failed");
- }
+ herr_t ret_value = H5Pset_small_data_block_size(id, size);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetMemXferPropList::setSmallDataBlockSize",
+ "H5Pset_small_data_block_size failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::getSmallDataBlockSize
-///\brief Returns the current small data block size setting.
-///\return Size of the small data block, in bytes
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: DSetMemXferPropList::getSmallDataBlockSize
+///\brief Returns the current small data block size setting.
+///\return Size of the small data block, in bytes
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
hsize_t DSetMemXferPropList::getSmallDataBlockSize() const
{
- hsize_t size;
- herr_t ret_value = H5Pget_small_data_block_size(id, &size);
- if (ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::getSmallDataBlockSize",
- "H5Pget_small_data_block_size failed");
- }
- return(size);
+ hsize_t size;
+ herr_t ret_value = H5Pget_small_data_block_size(id, &size);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetMemXferPropList::getSmallDataBlockSize",
+ "H5Pget_small_data_block_size failed");
+ }
+ return(size);
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::setHyperVectorSize
-///\brief Sets number of I/O vectors to be read/written in hyperslab I/O.
+// Function: DSetMemXferPropList::setHyperVectorSize
+///\brief Sets number of I/O vectors to be read/written in hyperslab I/O.
///
-///\exception H5::PropListIException
+///\exception H5::PropListIException
///\par Description
-/// For information, please refer to the C layer Reference
-/// Manual at:
+/// For information, please refer to the C layer Reference
+/// Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetHyperVectorSize
-// Programmer: Binh-Minh Ribler - April, 2004
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void DSetMemXferPropList::setHyperVectorSize(size_t vector_size) const
{
- herr_t ret_value = H5Pset_hyper_vector_size(id, vector_size);
- if (ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setHyperVectorSize",
- "H5Pset_hyper_vector_size failed");
- }
+ herr_t ret_value = H5Pset_hyper_vector_size(id, vector_size);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetMemXferPropList::setHyperVectorSize",
+ "H5Pset_hyper_vector_size failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::getHyperVectorSize
-///\brief Returns the number of I/O vectors to be read/written in
-/// hyperslab I/O.
-///\return Number of I/O vectors
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: DSetMemXferPropList::getHyperVectorSize
+///\brief Returns the number of I/O vectors to be read/written in
+/// hyperslab I/O.
+///\return Number of I/O vectors
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
size_t DSetMemXferPropList::getHyperVectorSize() const
{
- size_t vector_size;
- herr_t ret_value = H5Pget_hyper_vector_size(id, &vector_size);
- if (ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::getHyperVectorSize",
- "H5Pget_hyper_vector_size failed");
- }
- return(vector_size);
+ size_t vector_size;
+ herr_t ret_value = H5Pget_hyper_vector_size(id, &vector_size);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetMemXferPropList::getHyperVectorSize",
+ "H5Pget_hyper_vector_size failed");
+ }
+ return(vector_size);
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::setEDCCheck
-///\brief Enables or disables error-detecting for a dataset reading
-/// process.
-///\param check - IN: Specifies whether error detection is enabled or
-/// disabled
-///\exception H5::PropListIException
+// Function: DSetMemXferPropList::setEDCCheck
+///\brief Enables or disables error-detecting for a dataset reading
+/// process.
+///\param check - IN: Specifies whether error detection is enabled or
+/// disabled
+///\exception H5::PropListIException
///\par Description
-/// The error detection algorithm used is the algorithm previously
-/// specified in the corresponding dataset creation property
-/// list. This function does not affect the use of error
-/// detection in the writing process.
+/// The error detection algorithm used is the algorithm previously
+/// specified in the corresponding dataset creation property
+/// list. This function does not affect the use of error
+/// detection in the writing process.
///\par
-/// Valid values are as follows:
-/// \li \c H5Z_ENABLE_EDC (default)
-/// \li \c H5Z_DISABLE_EDC
-// Programmer: Binh-Minh Ribler - April, 2004
+/// Valid values are as follows:
+/// \li \c H5Z_ENABLE_EDC (default)
+/// \li \c H5Z_DISABLE_EDC
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check) const
{
- herr_t ret_value = H5Pset_edc_check(id, check);
- if (ret_value < 0)
- {
- throw PropListIException("DSetMemXferPropList::setEDCCheck",
- "H5Pset_edc_check failed");
- }
+ herr_t ret_value = H5Pset_edc_check(id, check);
+ if (ret_value < 0)
+ {
+ throw PropListIException("DSetMemXferPropList::setEDCCheck",
+ "H5Pset_edc_check failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList::getEDCCheck
-///\brief Determines whether error-detection is enabled for dataset reads.
-///\return \c H5Z_ENABLE_EDC or \c H5Z_DISABLE_EDC
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: DSetMemXferPropList::getEDCCheck
+///\brief Determines whether error-detection is enabled for dataset reads.
+///\return \c H5Z_ENABLE_EDC or \c H5Z_DISABLE_EDC
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
H5Z_EDC_t DSetMemXferPropList::getEDCCheck() const
{
- H5Z_EDC_t check = H5Pget_edc_check(id);
- if (check < 0)
- {
- throw PropListIException("DSetMemXferPropList::getEDCCheck",
- "H5Pget_edc_check failed");
- }
- return(check);
+ H5Z_EDC_t check = H5Pget_edc_check(id);
+ if (check < 0)
+ {
+ throw PropListIException("DSetMemXferPropList::getEDCCheck",
+ "H5Pget_edc_check failed");
+ }
+ return(check);
}
//--------------------------------------------------------------------------
-// Function: DSetMemXferPropList destructor
-///\brief Noop destructor.
-// Programmer Binh-Minh Ribler - 2000
+// Function: DSetMemXferPropList destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetMemXferPropList::~DSetMemXferPropList() {}
diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h
index 42194fb..f1c363f 100644
--- a/c++/src/H5DxferProp.h
+++ b/c++/src/H5DxferProp.h
@@ -27,93 +27,93 @@ namespace H5 {
*/
class H5_DLLCPP DSetMemXferPropList : public PropList {
public:
- ///\brief Default dataset memory and transfer property list.
- static const DSetMemXferPropList& DEFAULT;
+ ///\brief Default dataset memory and transfer property list.
+ static const DSetMemXferPropList& DEFAULT;
- // Creates a dataset memory and transfer property list.
- DSetMemXferPropList();
+ // Creates a dataset memory and transfer property list.
+ DSetMemXferPropList();
- // Creates a dataset transform property list.
- DSetMemXferPropList(const char* expression);
+ // Creates a dataset transform property list.
+ DSetMemXferPropList(const char* expression);
- // Sets type conversion and background buffers.
- void setBuffer( size_t size, void* tconv, void* bkg ) const;
+ // Sets type conversion and background buffers.
+ void setBuffer(size_t size, void* tconv, void* bkg) const;
- // Reads buffer settings.
- size_t getBuffer( void** tconv, void** bkg ) const;
+ // Reads buffer settings.
+ size_t getBuffer(void** tconv, void** bkg) const;
- // Sets B-tree split ratios for a dataset transfer property list.
- void setBtreeRatios( double left, double middle, double right ) const;
+ // Sets B-tree split ratios for a dataset transfer property list.
+ void setBtreeRatios(double left, double middle, double right) const;
- // Gets B-tree split ratios for a dataset transfer property list.
- void getBtreeRatios( double& left, double& middle, double& right ) const;
+ // Gets B-tree split ratios for a dataset transfer property list.
+ void getBtreeRatios(double& left, double& middle, double& right) const;
- // Sets data transform expression.
- void setDataTransform(const char* expression) const;
- void setDataTransform(const H5std_string& expression) const;
+ // Sets data transform expression.
+ void setDataTransform(const char* expression) const;
+ void setDataTransform(const H5std_string& expression) const;
- // Gets data transform expression.
- ssize_t getDataTransform(char* exp, size_t buf_size=0) const;
- H5std_string getDataTransform() const;
+ // Gets data transform expression.
+ ssize_t getDataTransform(char* exp, size_t buf_size=0) const;
+ H5std_string getDataTransform() const;
- // Sets the dataset transfer property list status to TRUE or FALSE.
- void setPreserve( bool status ) const;
+ // Sets the dataset transfer property list status to TRUE or FALSE.
+ void setPreserve(bool status) const;
- // Checks status of the dataset transfer property list.
- bool getPreserve() const;
+ // Checks status of the dataset transfer property list.
+ bool getPreserve() const;
- // Sets an exception handling callback for datatype conversion.
- void setTypeConvCB( H5T_conv_except_func_t op, void *user_data) const;
+ // Sets an exception handling callback for datatype conversion.
+ void setTypeConvCB(H5T_conv_except_func_t op, void *user_data) const;
- // Gets the exception handling callback for datatype conversion.
- void getTypeConvCB( H5T_conv_except_func_t *op, void **user_data) const;
+ // Gets the exception handling callback for datatype conversion.
+ void getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const;
- // Sets the memory manager for variable-length datatype
- // allocation in H5Dread and H5Dvlen_reclaim.
- void setVlenMemManager( H5MM_allocate_t alloc, void* alloc_info,
- H5MM_free_t free, void* free_info ) const;
+ // Sets the memory manager for variable-length datatype
+ // allocation in H5Dread and H5Dvlen_reclaim.
+ void setVlenMemManager(H5MM_allocate_t alloc, void* alloc_info,
+ H5MM_free_t free, void* free_info) const;
- // alloc and free are set to NULL, indicating that system
- // malloc and free are to be used.
- void setVlenMemManager() const;
+ // alloc and free are set to NULL, indicating that system
+ // malloc and free are to be used.
+ void setVlenMemManager() const;
- // Gets the memory manager for variable-length datatype
- // allocation in H5Dread and H5Tvlen_reclaim.
- void getVlenMemManager( H5MM_allocate_t& alloc, void** alloc_info,
- H5MM_free_t& free, void** free_info ) const;
+ // Gets the memory manager for variable-length datatype
+ // allocation in H5Dread and H5Tvlen_reclaim.
+ void getVlenMemManager(H5MM_allocate_t& alloc, void** alloc_info,
+ H5MM_free_t& free, void** free_info) const;
- // Sets the size of a contiguous block reserved for small data.
- void setSmallDataBlockSize(hsize_t size) const;
+ // Sets the size of a contiguous block reserved for small data.
+ void setSmallDataBlockSize(hsize_t size) const;
- // Returns the current small data block size setting.
- hsize_t getSmallDataBlockSize() const;
+ // Returns the current small data block size setting.
+ hsize_t getSmallDataBlockSize() const;
- // Sets number of I/O vectors to be read/written in hyperslab I/O.
- void setHyperVectorSize(size_t vector_size) const;
+ // Sets number of I/O vectors to be read/written in hyperslab I/O.
+ void setHyperVectorSize(size_t vector_size) const;
- // Returns the number of I/O vectors to be read/written in
- // hyperslab I/O.
- size_t getHyperVectorSize() const;
+ // Returns the number of I/O vectors to be read/written in
+ // hyperslab I/O.
+ size_t getHyperVectorSize() const;
- // Enables or disables error-detecting for a dataset reading
- // process.
- void setEDCCheck(H5Z_EDC_t check) const;
+ // Enables or disables error-detecting for a dataset reading
+ // process.
+ void setEDCCheck(H5Z_EDC_t check) const;
- // Determines whether error-detection is enabled for dataset reads.
- H5Z_EDC_t getEDCCheck() const;
+ // Determines whether error-detection is enabled for dataset reads.
+ H5Z_EDC_t getEDCCheck() const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("DSetMemXferPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("DSetMemXferPropList"); }
- // Copy constructor: makes a copy of a DSetMemXferPropList object.
- DSetMemXferPropList(const DSetMemXferPropList& orig);
+ // Copy constructor: makes a copy of a DSetMemXferPropList object.
+ DSetMemXferPropList(const DSetMemXferPropList& orig);
- // Creates a copy of an existing dataset memory and transfer
- // property list using the property list id.
- DSetMemXferPropList(const hid_t plist_id);
+ // Creates a copy of an existing dataset memory and transfer
+ // property list using the property list id.
+ DSetMemXferPropList(const hid_t plist_id);
- // Noop destructor
- virtual ~DSetMemXferPropList();
+ // Noop destructor
+ virtual ~DSetMemXferPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -121,7 +121,7 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
static void deleteConstants();
private:
- static DSetMemXferPropList* DEFAULT_;
+ static DSetMemXferPropList* DEFAULT_;
// Creates the global constant, should only be used by the library
static DSetMemXferPropList* getConstant();
diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp
index 5e1f0bd..49f60e6 100644
--- a/c++/src/H5EnumType.cpp
+++ b/c++/src/H5EnumType.cpp
@@ -15,7 +15,7 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -37,230 +37,230 @@
namespace H5 {
//--------------------------------------------------------------------------
-// Function: EnumType default constructor
-///\brief Default constructor: Creates a stub datatype
-// Programmer Binh-Minh Ribler - 2000
+// Function: EnumType default constructor
+///\brief Default constructor: Creates a stub datatype
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
EnumType::EnumType() : DataType() {}
//--------------------------------------------------------------------------
-// Function: EnumType overloaded constructor
-///\brief Creates an EnumType object using the id of an existing datatype.
-///\param existing_id - IN: Id of an existing datatype
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: EnumType overloaded constructor
+///\brief Creates an EnumType object using the id of an existing datatype.
+///\param existing_id - IN: Id of an existing datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType::EnumType( const hid_t existing_id ) : DataType( existing_id ) {}
+EnumType::EnumType(const hid_t existing_id) : DataType( existing_id ) {}
//--------------------------------------------------------------------------
-// Function: EnumType copy constructor
-///\brief Copy constructor: makes a copy of the original EnumType object.
-// Programmer Binh-Minh Ribler - 2000
+// Function: EnumType copy constructor
+///\brief Copy constructor: makes a copy of the original EnumType object.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType::EnumType( const EnumType& original ) : DataType( original ) {}
+EnumType::EnumType(const EnumType& original) : DataType( original ) {}
//--------------------------------------------------------------------------
-// Function: EnumType overloaded constructor
-///\brief Creates an empty enumeration datatype given a size, in bytes.
-///\param size - IN: Number of bytes in the datatype to create
-///\exception H5::DataTypeIException
+// Function: EnumType overloaded constructor
+///\brief Creates an empty enumeration datatype given a size, in bytes.
+///\param size - IN: Number of bytes in the datatype to create
+///\exception H5::DataTypeIException
// Description
-// The DataType constructor calls the C API H5Tcreate to create
-// the enum datatype.
-// Programmer Binh-Minh Ribler - 2000
+// The DataType constructor calls the C API H5Tcreate to create
+// the enum datatype.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType::EnumType( size_t size ) : DataType( H5T_ENUM, size ) {}
+EnumType::EnumType(size_t size) : DataType( H5T_ENUM, size ) {}
//--------------------------------------------------------------------------
-// Function: EnumType overloaded constructor
-///\brief Gets the enum datatype of the specified dataset.
-///\param dataset - IN: Dataset that this enum datatype associates with
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: EnumType overloaded constructor
+///\brief Gets the enum datatype of the specified dataset.
+///\param dataset - IN: Dataset that this enum datatype associates with
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType::EnumType( const DataSet& dataset ) : DataType()
+EnumType::EnumType(const DataSet& dataset) : DataType()
{
- // Calls C function H5Dget_type to get the id of the datatype
- id = H5Dget_type( dataset.getId() );
+ // Calls C function H5Dget_type to get the id of the datatype
+ id = H5Dget_type(dataset.getId());
- // If the datatype id is not valid, throw an exception
- if( id < 0 )
- {
- throw DataSetIException("EnumType constructor", "H5Dget_type failed");
- }
+ // If the datatype id is not valid, throw an exception
+ if (id < 0)
+ {
+ throw DataSetIException("EnumType constructor", "H5Dget_type failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: EnumType overloaded constructor
-///\brief Creates a new enum datatype based on an integer datatype.
-///\param data_type - IN: Base datatype
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: EnumType overloaded constructor
+///\brief Creates a new enum datatype based on an integer datatype.
+///\param data_type - IN: Base datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-EnumType::EnumType( const IntType& data_type ) : DataType()
+EnumType::EnumType(const IntType& data_type) : DataType()
{
- // Calls C function H5Tenum_create to get the id of the datatype
- id = H5Tenum_create( data_type.getId() );
+ // Calls C function H5Tenum_create to get the id of the datatype
+ id = H5Tenum_create(data_type.getId());
- // If the datatype id is not valid, throw an exception
- if( id < 0 )
- {
- throw DataSetIException("EnumType constructor", "H5Tenum_create failed");
- }
+ // If the datatype id is not valid, throw an exception
+ if (id < 0)
+ {
+ throw DataSetIException("EnumType constructor", "H5Tenum_create failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: EnumType overloaded constructor
-///\brief Creates an EnumType instance by opening an HDF5 enum datatype
-/// given its name, provided as a C character string.
-///\param dtype_name - IN: Enum datatype name
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Dec 2016
+// Function: EnumType overloaded constructor
+///\brief Creates an EnumType instance by opening an HDF5 enum datatype
+/// given its name, provided as a C character string.
+///\param dtype_name - IN: Enum datatype name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openEnumType(const char*) to
-// improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openEnumType(const char*) to
+// improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
EnumType::EnumType(const H5Location& loc, const char *dtype_name) : DataType()
{
- id = p_opentype(loc, dtype_name);
+ id = p_opentype(loc, dtype_name);
}
//--------------------------------------------------------------------------
-// Function: EnumType overloaded constructor
-///\brief Creates an EnumType instance by opening an HDF5 enum datatype
-/// given its name, provided as an \c H5std_string.
-///\param dtype_name - IN: Enum datatype name
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Dec 2016
+// Function: EnumType overloaded constructor
+///\brief Creates an EnumType instance by opening an HDF5 enum datatype
+/// given its name, provided as an \c H5std_string.
+///\param dtype_name - IN: Enum datatype name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openEnumType(const H5std_string&)
-// to improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openEnumType(const H5std_string&)
+// to improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
EnumType::EnumType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
{
- id = p_opentype(loc, dtype_name.c_str());
+ id = p_opentype(loc, dtype_name.c_str());
}
//--------------------------------------------------------------------------
-// Function: EnumType::insert
-///\brief Inserts a new member to this enumeration datatype.
-///\param name - IN: Name of the new member
-///\param value - IN: Pointer to the value of the new member
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: EnumType::insert
+///\brief Inserts a new member to this enumeration datatype.
+///\param name - IN: Name of the new member
+///\param value - IN: Pointer to the value of the new member
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void EnumType::insert( const char* name, void *value ) const
+void EnumType::insert(const char* name, void *value) const
{
- // Calls C routine H5Tenum_insert to insert the new enum datatype member.
- herr_t ret_value = H5Tenum_insert( id, name, value );
- if( ret_value < 0 )
- {
- throw DataTypeIException("EnumType::insert", "H5Tenum_insert failed");
- }
+ // Calls C routine H5Tenum_insert to insert the new enum datatype member.
+ herr_t ret_value = H5Tenum_insert(id, name, value);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException("EnumType::insert", "H5Tenum_insert failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: EnumType::insert
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in the type of
-/// argument \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: EnumType::insert
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in the type of
+/// argument \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void EnumType::insert( const H5std_string& name, void *value ) const
+void EnumType::insert(const H5std_string& name, void *value) const
{
- insert( name.c_str(), value );
+ insert(name.c_str(), value);
}
//--------------------------------------------------------------------------
-// Function: EnumType::nameOf
-///\brief Returns the symbol name corresponding to a specified member
-/// of this enumeration datatype.
-///\param value - IN: Pointer to the value of the enum datatype
-///\param size - IN: Size for the name
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: EnumType::nameOf
+///\brief Returns the symbol name corresponding to a specified member
+/// of this enumeration datatype.
+///\param value - IN: Pointer to the value of the enum datatype
+///\param size - IN: Size for the name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string EnumType::nameOf( void *value, size_t size ) const
+H5std_string EnumType::nameOf(void *value, size_t size) const
{
- char* name_C = new char[size+1]; // temporary C-string for C API
- HDmemset(name_C, 0, size+1); // clear buffer
+ char* name_C = new char[size+1]; // temporary C-string for C API
+ HDmemset(name_C, 0, size+1); // clear buffer
- // Calls C routine H5Tenum_nameof to get the name of the specified enum type
- herr_t ret_value = H5Tenum_nameof( id, value, name_C, size );
+ // Calls C routine H5Tenum_nameof to get the name of the specified enum type
+ herr_t ret_value = H5Tenum_nameof(id, value, name_C, size);
- // If H5Tenum_nameof returns a negative value, raise an exception,
- if( ret_value < 0 )
- {
+ // If H5Tenum_nameof returns a negative value, raise an exception,
+ if (ret_value < 0)
+ {
delete []name_C;
- throw DataTypeIException("EnumType::nameOf", "H5Tenum_nameof failed");
- }
- // otherwise, create the string to hold the datatype name and return it
- H5std_string name(name_C);
- delete []name_C;
- return( name );
+ throw DataTypeIException("EnumType::nameOf", "H5Tenum_nameof failed");
+ }
+ // otherwise, create the string to hold the datatype name and return it
+ H5std_string name(name_C);
+ delete []name_C;
+ return(name);
}
//--------------------------------------------------------------------------
-// Function: EnumType::valueOf
-///\brief Retrieves the value corresponding to a member of this
-/// enumeration datatype, given the member's name.
-///\param name - IN: Name of the queried member
-///\param value - OUT: Pointer to the retrieved value
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: EnumType::valueOf
+///\brief Retrieves the value corresponding to a member of this
+/// enumeration datatype, given the member's name.
+///\param name - IN: Name of the queried member
+///\param value - OUT: Pointer to the retrieved value
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void EnumType::valueOf( const char* name, void *value ) const
+void EnumType::valueOf(const char* name, void *value) const
{
- // Calls C routine H5Tenum_valueof to get the enum datatype value
- herr_t ret_value = H5Tenum_valueof( id, name, value );
- if( ret_value < 0 )
- {
- throw DataTypeIException("EnumType::valueOf", "H5Tenum_valueof failed");
- }
+ // Calls C routine H5Tenum_valueof to get the enum datatype value
+ herr_t ret_value = H5Tenum_valueof(id, name, value);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException("EnumType::valueOf", "H5Tenum_valueof failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: EnumType::valueOf
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in the type of
-/// argument \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: EnumType::valueOf
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in the type of
+/// argument \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void EnumType::valueOf( const H5std_string& name, void *value ) const
+void EnumType::valueOf(const H5std_string& name, void *value) const
{
- valueOf( name.c_str(), value );
+ valueOf(name.c_str(), value);
}
//--------------------------------------------------------------------------
-// Function: EnumType::getMemberIndex
-///\brief Returns the index of a member in this enumeration datatype.
-///\param name - IN: Name of the queried member
-///\return Index of the member if it exists. Index will have the value
-/// between 0 and \c N-1, where \c N is the value returned by the
-/// member function \c EnumType::getNmembers.
-///\exception H5::DataTypeIException
+// Function: EnumType::getMemberIndex
+///\brief Returns the index of a member in this enumeration datatype.
+///\param name - IN: Name of the queried member
+///\return Index of the member if it exists. Index will have the value
+/// between 0 and \c N-1, where \c N is the value returned by the
+/// member function \c EnumType::getNmembers.
+///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 16, 2002
//--------------------------------------------------------------------------
int EnumType::getMemberIndex(const char *name) const
{
- int member_index = H5Tget_member_index(id, name);
- if( member_index < 0 )
- {
- throw DataTypeIException("EnumType::getMemberIndex",
+ int member_index = H5Tget_member_index(id, name);
+ if (member_index < 0)
+ {
+ throw DataTypeIException("EnumType::getMemberIndex",
"H5Tget_member_index returns negative value");
- }
- return( member_index );
+ }
+ return(member_index);
}
//--------------------------------------------------------------------------
-// Function: EnumType::getMemberIndex
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in the type of
-/// argument \a name.
+// Function: EnumType::getMemberIndex
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in the type of
+/// argument \a name.
// Programmer Binh-Minh Ribler - May 16, 2002
//--------------------------------------------------------------------------
int EnumType::getMemberIndex(const H5std_string& name) const
@@ -269,46 +269,46 @@ int EnumType::getMemberIndex(const H5std_string& name) const
}
//--------------------------------------------------------------------------
-// Function: EnumType::getNmembers
-///\brief Returns the number of members in this enumeration datatype.
-///\return Number of members
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - May, 2004
+// Function: EnumType::getNmembers
+///\brief Returns the number of members in this enumeration datatype.
+///\return Number of members
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
int EnumType::getNmembers() const
{
- int num_members = H5Tget_nmembers( id );
- if( num_members < 0 )
- {
- throw DataTypeIException("EnumType::getNmembers",
+ int num_members = H5Tget_nmembers(id);
+ if (num_members < 0)
+ {
+ throw DataTypeIException("EnumType::getNmembers",
"H5Tget_nmembers returns negative number of members");
- }
- return( num_members );
+ }
+ return(num_members);
}
//--------------------------------------------------------------------------
-// Function: EnumType::getMemberValue
-///\brief Retrieves the value of a member in this enumeration datatype,
-/// given the member's index.
-///\param memb_no - IN: Index of the queried member
-///\param value - OUT: Pointer to the retrieved value
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: EnumType::getMemberValue
+///\brief Retrieves the value of a member in this enumeration datatype,
+/// given the member's index.
+///\param memb_no - IN: Index of the queried member
+///\param value - OUT: Pointer to the retrieved value
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void EnumType::getMemberValue( unsigned memb_no, void *value ) const
+void EnumType::getMemberValue(unsigned memb_no, void *value) const
{
- // Call C routine H5Tget_member_value to get the datatype member's value
- hid_t ret_value = H5Tget_member_value( id, memb_no, value );
- if( ret_value < 0 )
- {
- throw DataTypeIException("EnumType::getMemberValue", "H5Tget_member_value failed");
- }
+ // Call C routine H5Tget_member_value to get the datatype member's value
+ hid_t ret_value = H5Tget_member_value(id, memb_no, value);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException("EnumType::getMemberValue", "H5Tget_member_value failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: EnumType destructor
-///\brief Properly terminates access to this enum datatype.
-// Programmer Binh-Minh Ribler - 2000
+// Function: EnumType destructor
+///\brief Properly terminates access to this enum datatype.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
EnumType::~EnumType() {}
diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h
index 054811b..2fbe2cd 100644
--- a/c++/src/H5EnumType.h
+++ b/c++/src/H5EnumType.h
@@ -28,56 +28,56 @@ namespace H5 {
class H5_DLLCPP EnumType : public DataType {
public:
- // Creates an empty enumeration datatype based on a native signed
- // integer type, whose size is given by size.
- EnumType( size_t size );
+ // Creates an empty enumeration datatype based on a native signed
+ // integer type, whose size is given by size.
+ EnumType(size_t size);
- // Gets the enum datatype of the specified dataset
- EnumType( const DataSet& dataset ); // H5Dget_type
+ // Gets the enum datatype of the specified dataset
+ EnumType(const DataSet& dataset); // H5Dget_type
- // Creates a new enum datatype based on an integer datatype
- EnumType( const IntType& data_type ); // H5Tenum_create
+ // Creates a new enum datatype based on an integer datatype
+ EnumType(const IntType& data_type); // H5Tenum_create
- // Constructors that open an enum datatype, given a location.
- EnumType(const H5Location& loc, const char* name);
- EnumType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open an enum datatype, given a location.
+ EnumType(const H5Location& loc, const char* name);
+ EnumType(const H5Location& loc, const H5std_string& name);
- // Returns the number of members in this enumeration datatype.
- int getNmembers () const;
+ // Returns the number of members in this enumeration datatype.
+ int getNmembers () const;
- // Returns the index of a member in this enumeration data type.
- int getMemberIndex(const char* name) const;
- int getMemberIndex(const H5std_string& name) const;
+ // Returns the index of a member in this enumeration data type.
+ int getMemberIndex(const char* name) const;
+ int getMemberIndex(const H5std_string& name) const;
- // Returns the value of an enumeration datatype member
- void getMemberValue( unsigned memb_no, void *value ) const;
+ // Returns the value of an enumeration datatype member
+ void getMemberValue(unsigned memb_no, void *value) const;
- // Inserts a new member to this enumeration type.
- void insert( const char* name, void *value ) const;
- void insert( const H5std_string& name, void *value ) const;
+ // Inserts a new member to this enumeration type.
+ void insert(const char* name, void *value) const;
+ void insert(const H5std_string& name, void *value) const;
- // Returns the symbol name corresponding to a specified member
- // of this enumeration datatype.
- H5std_string nameOf( void *value, size_t size ) const;
+ // Returns the symbol name corresponding to a specified member
+ // of this enumeration datatype.
+ H5std_string nameOf(void *value, size_t size) const;
- // Returns the value corresponding to a specified member of this
- // enumeration datatype.
- void valueOf( const char* name, void *value ) const;
- void valueOf( const H5std_string& name, void *value ) const;
+ // Returns the value corresponding to a specified member of this
+ // enumeration datatype.
+ void valueOf(const char* name, void *value) const;
+ void valueOf(const H5std_string& name, void *value) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("EnumType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("EnumType"); }
- // Default constructor
- EnumType();
+ // Default constructor
+ EnumType();
- // Creates an enumeration datatype using an existing id
- EnumType( const hid_t existing_id );
+ // Creates an enumeration datatype using an existing id
+ EnumType(const hid_t existing_id);
- // Copy constructor: makes a copy of the original EnumType object.
- EnumType( const EnumType& original );
+ // Copy constructor: makes a copy of the original EnumType object.
+ EnumType(const EnumType& original);
- virtual ~EnumType();
+ virtual ~EnumType();
};
}
#endif // __H5EnumType_H
diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp
index 335bb20..0316f64 100644
--- a/c++/src/H5Exception.cpp
+++ b/c++/src/H5Exception.cpp
@@ -23,207 +23,207 @@ namespace H5 {
const char Exception::DEFAULT_MSG[] = "No detailed information provided";
//--------------------------------------------------------------------------
-// Function: Exception default constructor
-///\brief Default constructor.
-// Programmer Binh-Minh Ribler - 2000
+// Function: Exception default constructor
+///\brief Default constructor.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
Exception::Exception() : detail_message(""), func_name("") {}
//--------------------------------------------------------------------------
-// Function: Exception overloaded constructor
-///\brief Creates an exception with the name of the function,
-/// in which the failure occurs, and an optional detailed message.
-///\param func - IN: Name of the function where failure occurs
-///\param message - IN: Message on the failure
-// Programmer Binh-Minh Ribler - 2000
+// Function: Exception overloaded constructor
+///\brief Creates an exception with the name of the function,
+/// in which the failure occurs, and an optional detailed message.
+///\param func - IN: Name of the function where failure occurs
+///\param message - IN: Message on the failure
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
Exception::Exception(const H5std_string& func, const H5std_string& message) : detail_message(message), func_name(func) {}
//--------------------------------------------------------------------------
-// Function: Exception copy constructor
-///\brief Copy constructor: makes a copy of the original Exception object.
-///\param orig - IN: Exception instance to copy
-// Programmer Binh-Minh Ribler - 2000
+// Function: Exception copy constructor
+///\brief Copy constructor: makes a copy of the original Exception object.
+///\param orig - IN: Exception instance to copy
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Exception::Exception( const Exception& orig ) : detail_message(orig.detail_message), func_name(orig.func_name) {}
+Exception::Exception(const Exception& orig) : detail_message(orig.detail_message), func_name(orig.func_name) {}
//--------------------------------------------------------------------------
-// Function: Exception::getMajorString
-///\brief Returns a text string that describes the error
-/// specified by a major error number.
-///\param err_major - IN: Major error number
-///\return Major error string
+// Function: Exception::getMajorString
+///\brief Returns a text string that describes the error
+/// specified by a major error number.
+///\param err_major - IN: Major error number
+///\return Major error string
///\par Description
-/// In the failure case, the string "Invalid major error number"
-/// will be returned.
-// Programmer Binh-Minh Ribler - 2000
+/// In the failure case, the string "Invalid major error number"
+/// will be returned.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string Exception::getMajorString( hid_t err_major ) const
+H5std_string Exception::getMajorString(hid_t err_major) const
{
- // Preliminary call to H5Eget_msg() to get the length of the message
- ssize_t mesg_size = H5Eget_msg(err_major, NULL, NULL, 0);
-
- // If H5Eget_msg() returns a negative value, raise an exception,
- if( mesg_size < 0 )
- throw IdComponentException("Exception::getMajorString",
- "H5Eget_msg failed");
-
- // Call H5Eget_msg again to get the actual message
- char* mesg_C = new char[mesg_size+1]; // temporary C-string for C API
- mesg_size = H5Eget_msg(err_major, NULL, mesg_C, mesg_size+1);
-
- // Check for failure again
- if( mesg_size < 0 )
- {
- delete []mesg_C;
- throw IdComponentException("Exception::getMajorString",
- "H5Eget_msg failed");
- }
-
- // Convert the C error description and return
- H5std_string major_str(mesg_C);
- delete []mesg_C;
- return( major_str );
+ // Preliminary call to H5Eget_msg() to get the length of the message
+ ssize_t mesg_size = H5Eget_msg(err_major, NULL, NULL, 0);
+
+ // If H5Eget_msg() returns a negative value, raise an exception,
+ if (mesg_size < 0)
+ throw IdComponentException("Exception::getMajorString",
+ "H5Eget_msg failed");
+
+ // Call H5Eget_msg again to get the actual message
+ char* mesg_C = new char[mesg_size+1]; // temporary C-string for C API
+ mesg_size = H5Eget_msg(err_major, NULL, mesg_C, mesg_size+1);
+
+ // Check for failure again
+ if (mesg_size < 0)
+ {
+ delete []mesg_C;
+ throw IdComponentException("Exception::getMajorString",
+ "H5Eget_msg failed");
+ }
+
+ // Convert the C error description and return
+ H5std_string major_str(mesg_C);
+ delete []mesg_C;
+ return(major_str);
}
//--------------------------------------------------------------------------
-// Function: Exception::getMinorString
-///\brief Returns a text string that describes the error
-/// specified by a minor error number.
-///\param err_minor - IN: Minor error number
-///\return Minor error string
+// Function: Exception::getMinorString
+///\brief Returns a text string that describes the error
+/// specified by a minor error number.
+///\param err_minor - IN: Minor error number
+///\return Minor error string
///\par Description
-/// In the failure case, the string "Invalid minor error number"
-/// will be returned.
-// Programmer Binh-Minh Ribler - 2000
+/// In the failure case, the string "Invalid minor error number"
+/// will be returned.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string Exception::getMinorString( hid_t err_minor ) const
+H5std_string Exception::getMinorString(hid_t err_minor) const
{
- // Preliminary call to H5Eget_msg() to get the length of the message
- ssize_t mesg_size = H5Eget_msg(err_minor, NULL, NULL, 0);
-
- // If H5Eget_msg() returns a negative value, raise an exception,
- if( mesg_size < 0 )
- throw IdComponentException("Exception::getMinorString",
- "H5Eget_msg failed");
-
- // Call H5Eget_msg again to get the actual message
- char* mesg_C = new char[mesg_size+1]; // temporary C-string for C API
- mesg_size = H5Eget_msg(err_minor, NULL, mesg_C, mesg_size+1);
-
- // Check for failure again
- if( mesg_size < 0 )
- {
- delete []mesg_C;
- throw IdComponentException("Exception::getMinorString",
- "H5Eget_msg failed");
- }
-
- // Convert the C error description and return
- H5std_string minor_str(mesg_C);
- delete []mesg_C;
- return( minor_str );
+ // Preliminary call to H5Eget_msg() to get the length of the message
+ ssize_t mesg_size = H5Eget_msg(err_minor, NULL, NULL, 0);
+
+ // If H5Eget_msg() returns a negative value, raise an exception,
+ if (mesg_size < 0)
+ throw IdComponentException("Exception::getMinorString",
+ "H5Eget_msg failed");
+
+ // Call H5Eget_msg again to get the actual message
+ char* mesg_C = new char[mesg_size+1]; // temporary C-string for C API
+ mesg_size = H5Eget_msg(err_minor, NULL, mesg_C, mesg_size+1);
+
+ // Check for failure again
+ if (mesg_size < 0)
+ {
+ delete []mesg_C;
+ throw IdComponentException("Exception::getMinorString",
+ "H5Eget_msg failed");
+ }
+
+ // Convert the C error description and return
+ H5std_string minor_str(mesg_C);
+ delete []mesg_C;
+ return(minor_str);
}
//--------------------------------------------------------------------------
-// Function: Exception::setAutoPrint
-///\brief Turns on the automatic error printing.
-///\param func - IN: Function to be called upon an error condition
-///\param client_data - IN: Data passed to the error function
+// Function: Exception::setAutoPrint
+///\brief Turns on the automatic error printing.
+///\param func - IN: Function to be called upon an error condition
+///\param client_data - IN: Data passed to the error function
///\par Description
-/// When the library is first initialized the auto printing
-/// function, \a func, is set to the C API \c H5Eprint and
-/// \a client_data is the standard error stream pointer, \c stderr.
-/// Automatic stack traversal is always in the \c H5E_WALK_DOWNWARD
-/// direction.
+/// When the library is first initialized the auto printing
+/// function, \a func, is set to the C API \c H5Eprint and
+/// \a client_data is the standard error stream pointer, \c stderr.
+/// Automatic stack traversal is always in the \c H5E_WALK_DOWNWARD
+/// direction.
///\par
-/// Users are encouraged to write their own more specific error
-/// handlers
-// Programmer Binh-Minh Ribler - 2000
+/// Users are encouraged to write their own more specific error
+/// handlers
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Exception::setAutoPrint( H5E_auto2_t& func, void* client_data )
+void Exception::setAutoPrint(H5E_auto2_t& func, void* client_data)
{
- // calls the C API routine H5Eset_auto to set the auto printing to
- // the specified function.
- herr_t ret_value = H5Eset_auto2( H5E_DEFAULT, func, client_data );
- if( ret_value < 0 )
- throw Exception( "Exception::setAutoPrint", "H5Eset_auto failed" );
+ // calls the C API routine H5Eset_auto to set the auto printing to
+ // the specified function.
+ herr_t ret_value = H5Eset_auto2(H5E_DEFAULT, func, client_data);
+ if (ret_value < 0)
+ throw Exception("Exception::setAutoPrint", "H5Eset_auto failed");
}
//--------------------------------------------------------------------------
-// Function: Exception::dontPrint
-///\brief Turns off the automatic error printing from the C library.
-// Programmer Binh-Minh Ribler - 2000
+// Function: Exception::dontPrint
+///\brief Turns off the automatic error printing from the C library.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void Exception::dontPrint()
{
- // calls the C API routine H5Eset_auto with NULL parameters to turn
- // off the automatic error printing.
- herr_t ret_value = H5Eset_auto2( H5E_DEFAULT, NULL, NULL );
- if( ret_value < 0 )
- throw Exception( "Exception::dontPrint", "H5Eset_auto failed" );
+ // calls the C API routine H5Eset_auto with NULL parameters to turn
+ // off the automatic error printing.
+ herr_t ret_value = H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+ if (ret_value < 0)
+ throw Exception("Exception::dontPrint", "H5Eset_auto failed");
}
//--------------------------------------------------------------------------
-// Function: Exception::getAutoPrint
-///\brief Retrieves the current settings for the automatic error
-/// stack traversal function and its data.
-///\param func - OUT: Current setting for the function to be
-/// called upon an error condition
-///\param client_data - OUT: Current setting for the data passed to
-/// the error function
-// Programmer Binh-Minh Ribler - 2000
+// Function: Exception::getAutoPrint
+///\brief Retrieves the current settings for the automatic error
+/// stack traversal function and its data.
+///\param func - OUT: Current setting for the function to be
+/// called upon an error condition
+///\param client_data - OUT: Current setting for the data passed to
+/// the error function
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Exception::getAutoPrint( H5E_auto2_t& func, void** client_data )
+void Exception::getAutoPrint(H5E_auto2_t& func, void** client_data)
{
- // calls the C API routine H5Eget_auto to get the current setting of
- // the automatic error printing
- herr_t ret_value = H5Eget_auto2( H5E_DEFAULT, &func, client_data );
- if( ret_value < 0 )
- throw Exception( "Exception::getAutoPrint", "H5Eget_auto failed" );
+ // calls the C API routine H5Eget_auto to get the current setting of
+ // the automatic error printing
+ herr_t ret_value = H5Eget_auto2(H5E_DEFAULT, &func, client_data);
+ if (ret_value < 0)
+ throw Exception("Exception::getAutoPrint", "H5Eget_auto failed");
}
//--------------------------------------------------------------------------
-// Function: Exception::clearErrorStack
-///\brief Clears the error stack for the current thread.
+// Function: Exception::clearErrorStack
+///\brief Clears the error stack for the current thread.
///\par Description
-/// The stack is also cleared whenever a C API function is
-/// called, with certain exceptions (for instance, \c H5Eprint).
-// Programmer Binh-Minh Ribler - 2000
+/// The stack is also cleared whenever a C API function is
+/// called, with certain exceptions (for instance, \c H5Eprint).
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void Exception::clearErrorStack()
{
- // calls the C API routine H5Eclear to clear the error stack
- herr_t ret_value = H5Eclear2(H5E_DEFAULT);
- if( ret_value < 0 )
- throw Exception( "Exception::clearErrorStack", "H5Eclear failed" );
+ // calls the C API routine H5Eclear to clear the error stack
+ herr_t ret_value = H5Eclear2(H5E_DEFAULT);
+ if (ret_value < 0)
+ throw Exception("Exception::clearErrorStack", "H5Eclear failed");
}
//--------------------------------------------------------------------------
-// Function: Exception::walkErrorStack
-///\brief Walks the error stack for the current thread, calling the
-/// specified function.
-///\param direction - IN: Direction in which the error stack is to be walked
-///\param func - IN: Function to be called for each error encountered
-///\param client_data - IN: Data passed to the error function
+// Function: Exception::walkErrorStack
+///\brief Walks the error stack for the current thread, calling the
+/// specified function.
+///\param direction - IN: Direction in which the error stack is to be walked
+///\param func - IN: Function to be called for each error encountered
+///\param client_data - IN: Data passed to the error function
///\par Description
-/// Valid values for \a direction include:
-/// \li \c H5E_WALK_UPWARD - begin with the most specific error
-/// and end at the API
-/// \li \c H5E_WALK_DOWNWARD - begin at the API and end at the
-/// inner-most function where the error was first detected
+/// Valid values for \a direction include:
+/// \li \c H5E_WALK_UPWARD - begin with the most specific error
+/// and end at the API
+/// \li \c H5E_WALK_DOWNWARD - begin at the API and end at the
+/// inner-most function where the error was first detected
///\par
-/// The function specified by \a func will be called for each
-/// error in the error stack. The \c H5E_walk_t prototype is as
-/// follows:
+/// The function specified by \a func will be called for each
+/// error in the error stack. The \c H5E_walk_t prototype is as
+/// follows:
///\code
/// typedef herr_t (*H5E_walk_t)(int n, H5E_error_t *err_desc, void *client_data)
/// int n - Indexed position of the error in the stack; it begins at zero
-/// regardless of stack traversal direction
+/// regardless of stack traversal direction
/// H5E_error_t *err_desc - Pointer to a data structure describing the
-/// error. This structure is listed below.
+/// error. This structure is listed below.
/// void *client_data - Pointer to client data in the format expected by
-/// the user-defined function.
+/// the user-defined function.
///\endcode
///\par
/// Data structure to describe the error:
@@ -238,87 +238,87 @@ void Exception::clearErrorStack()
/// const char *desc; //optional supplied description
/// } H5E_error2_t;
///\endcode
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void Exception::walkErrorStack( H5E_direction_t direction, H5E_walk2_t func, void* client_data )
+void Exception::walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void* client_data)
{
- // calls the C API routine H5Ewalk to walk the error stack
- herr_t ret_value = H5Ewalk2( H5E_DEFAULT, direction, func, client_data );
- if( ret_value < 0 )
- throw Exception( "Exception::walkErrorStack", "H5Ewalk failed" );
+ // calls the C API routine H5Ewalk to walk the error stack
+ herr_t ret_value = H5Ewalk2(H5E_DEFAULT, direction, func, client_data);
+ if (ret_value < 0)
+ throw Exception("Exception::walkErrorStack", "H5Ewalk failed");
}
//--------------------------------------------------------------------------
-// Function: Exception::getDetailMsg
-///\brief Returns the detailed message set at the time the exception
-/// is thrown.
-///\return Text message - \c H5std_string
-// Programmer Binh-Minh Ribler - 2000
+// Function: Exception::getDetailMsg
+///\brief Returns the detailed message set at the time the exception
+/// is thrown.
+///\return Text message - \c H5std_string
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5std_string Exception::getDetailMsg() const
{
- return(detail_message);
+ return(detail_message);
}
//--------------------------------------------------------------------------
-// Function: Exception::getCDetailMsg
-///\brief Returns the detailed message set at the time the exception
-/// is thrown.
-///\return Text message - \c char pointer
-// Programmer Binh-Minh Ribler - 2000
+// Function: Exception::getCDetailMsg
+///\brief Returns the detailed message set at the time the exception
+/// is thrown.
+///\return Text message - \c char pointer
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
const char* Exception::getCDetailMsg() const
{
- return(detail_message.c_str());
+ return(detail_message.c_str());
}
//--------------------------------------------------------------------------
-// Function: Exception::getFuncName
-///\brief Returns the name of the function, where the exception is thrown.
-///\return Text message - \c H5std_string
-// Programmer Binh-Minh Ribler - 2000
+// Function: Exception::getFuncName
+///\brief Returns the name of the function, where the exception is thrown.
+///\return Text message - \c H5std_string
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5std_string Exception::getFuncName() const
{
- return(func_name);
+ return(func_name);
}
//--------------------------------------------------------------------------
-// Function: Exception::getCFuncName
-///\brief Returns the name of the function, where the exception is thrown.
-///\return Text message - \c char pointer
-// Programmer Binh-Minh Ribler - 2000
+// Function: Exception::getCFuncName
+///\brief Returns the name of the function, where the exception is thrown.
+///\return Text message - \c char pointer
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
const char* Exception::getCFuncName() const
{
- return(func_name.c_str());
+ return(func_name.c_str());
}
//--------------------------------------------------------------------------
-// Function: Exception::printErrorStack (static)
-///\brief Prints the error stack in a default manner.
-///\param stream - IN: File pointer, default to stderr
-///\param err_stack - IN: Error stack ID, default to H5E_DEFAULT(0)
-// Programmer Binh-Minh Ribler - 2000
+// Function: Exception::printErrorStack (static)
+///\brief Prints the error stack in a default manner.
+///\param stream - IN: File pointer, default to stderr
+///\param err_stack - IN: Error stack ID, default to H5E_DEFAULT(0)
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void Exception::printErrorStack(FILE* stream, hid_t err_stack)
{
herr_t ret_value = H5Eprint2(err_stack, stream);
- if( ret_value < 0 )
- throw Exception( "Printing error stack", "H5Eprint2 failed" );
+ if (ret_value < 0)
+ throw Exception("Printing error stack", "H5Eprint2 failed");
}
//--------------------------------------------------------------------------
-// Function: Exception::printError
-// Purpose: Prints the error stack in a default manner. This member
-// function is replaced by the static function printErrorStack
-// and will be removed from the next major release.
-// Parameter stream - IN: File pointer
-// Programmer Binh-Minh Ribler - 2000
+// Function: Exception::printError
+// Purpose: Prints the error stack in a default manner. This member
+// function is replaced by the static function printErrorStack
+// and will be removed from the next major release.
+// Parameter stream - IN: File pointer
+// Programmer Binh-Minh Ribler - 2000
// Description:
-// This function can be removed in next major release.
-// -BMR, 2014/04/24
-// Removed from documentation. -BMR, 2016/03/23
+// This function can be removed in next major release.
+// -BMR, 2014/04/24
+// Removed from documentation. -BMR, 2016/03/23
//--------------------------------------------------------------------------
void Exception::printError(FILE* stream) const
{
@@ -326,285 +326,285 @@ void Exception::printError(FILE* stream) const
}
//--------------------------------------------------------------------------
-// Function: Exception destructor
-///\brief Noop destructor
-// Programmer Binh-Minh Ribler - 2000
+// Function: Exception destructor
+///\brief Noop destructor
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
Exception::~Exception() throw() {}
//--------------------------------------------------------------------------
-// Subclass: FileIException
-// Programmer Binh-Minh Ribler - 2000
+// Subclass: FileIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
-// Function: FileIException default constructor
-///\brief Default constructor.
+// Function: FileIException default constructor
+///\brief Default constructor.
//--------------------------------------------------------------------------
FileIException::FileIException():Exception(){}
//--------------------------------------------------------------------------
-// Function: FileIException overloaded constructor
-///\brief Creates a FileIException with the name of the function,
-/// in which the failure occurs, and an optional detailed message.
-///\param func - IN: Name of the function where failure occurs
-///\param message - IN: Message on the failure
+// Function: FileIException overloaded constructor
+///\brief Creates a FileIException with the name of the function,
+/// in which the failure occurs, and an optional detailed message.
+///\param func - IN: Name of the function where failure occurs
+///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
FileIException::FileIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
-// Function: FileIException destructor
-///\brief Noop destructor.
+// Function: FileIException destructor
+///\brief Noop destructor.
//--------------------------------------------------------------------------
FileIException::~FileIException() throw() {}
//--------------------------------------------------------------------------
-// Subclass: GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Subclass: GroupIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
-// Function: GroupIException default constructor
-///\brief Default constructor.
+// Function: GroupIException default constructor
+///\brief Default constructor.
//--------------------------------------------------------------------------
GroupIException::GroupIException():Exception(){}
//--------------------------------------------------------------------------
-// Function: GroupIException overloaded constructor
-///\brief Creates a GroupIException with the name of the function,
-/// in which the failure occurs, and an optional detailed message.
-///\param func - IN: Name of the function where failure occurs
-///\param message - IN: Message on the failure
+// Function: GroupIException overloaded constructor
+///\brief Creates a GroupIException with the name of the function,
+/// in which the failure occurs, and an optional detailed message.
+///\param func - IN: Name of the function where failure occurs
+///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
GroupIException::GroupIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
-// Function: GroupIException destructor
-///\brief Noop destructor.
+// Function: GroupIException destructor
+///\brief Noop destructor.
//--------------------------------------------------------------------------
GroupIException::~GroupIException() throw() {}
//--------------------------------------------------------------------------
-// Subclass: DataSpaceIException
-// Programmer Binh-Minh Ribler - 2000
+// Subclass: DataSpaceIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
-// Function: DataSpaceIException default constructor
-///\brief Default constructor.
+// Function: DataSpaceIException default constructor
+///\brief Default constructor.
//--------------------------------------------------------------------------
DataSpaceIException::DataSpaceIException():Exception(){}
//--------------------------------------------------------------------------
-// Function: DataSpaceIException overloaded constructor
-///\brief Creates a DataSpaceIException with the name of the function,
-/// in which the failure occurs, and an optional detailed message.
-///\param func - IN: Name of the function where failure occurs
-///\param message - IN: Message on the failure
+// Function: DataSpaceIException overloaded constructor
+///\brief Creates a DataSpaceIException with the name of the function,
+/// in which the failure occurs, and an optional detailed message.
+///\param func - IN: Name of the function where failure occurs
+///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
DataSpaceIException::DataSpaceIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
-// Function: DataSpaceIException destructor
-///\brief Noop destructor.
+// Function: DataSpaceIException destructor
+///\brief Noop destructor.
//--------------------------------------------------------------------------
DataSpaceIException::~DataSpaceIException() throw() {}
//--------------------------------------------------------------------------
-// Subclass: DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Subclass: DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
-// Function: DataTypeIException default constructor
-///\brief Default constructor.
+// Function: DataTypeIException default constructor
+///\brief Default constructor.
//--------------------------------------------------------------------------
DataTypeIException::DataTypeIException():Exception(){}
//--------------------------------------------------------------------------
-// Function: DataTypeIException overloaded constructor
-///\brief Creates a DataTypeIException with the name of the function,
-/// in which the failure occurs, and an optional detailed message.
-///\param func - IN: Name of the function where failure occurs
-///\param message - IN: Message on the failure
+// Function: DataTypeIException overloaded constructor
+///\brief Creates a DataTypeIException with the name of the function,
+/// in which the failure occurs, and an optional detailed message.
+///\param func - IN: Name of the function where failure occurs
+///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
DataTypeIException::DataTypeIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
-// Function: DataTypeIException destructor
-///\brief Noop destructor.
+// Function: DataTypeIException destructor
+///\brief Noop destructor.
//--------------------------------------------------------------------------
DataTypeIException::~DataTypeIException() throw() {}
//--------------------------------------------------------------------------
-// Subclass: ObjHeaderIException
-// Programmer Binh-Minh Ribler - 2000
+// Subclass: ObjHeaderIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
-// Function: ObjHeaderIException default constructor
-///\brief Default constructor.
+// Function: ObjHeaderIException default constructor
+///\brief Default constructor.
//--------------------------------------------------------------------------
ObjHeaderIException::ObjHeaderIException():Exception(){}
//--------------------------------------------------------------------------
-// Function: ObjHeaderIException overloaded constructor
-///\brief Creates an ObjHeaderIException with the name of the function,
-/// in which the failure occurs, and an optional detailed message.
-///\param func - IN: Name of the function where failure occurs
-///\param message - IN: Message on the failure
+// Function: ObjHeaderIException overloaded constructor
+///\brief Creates an ObjHeaderIException with the name of the function,
+/// in which the failure occurs, and an optional detailed message.
+///\param func - IN: Name of the function where failure occurs
+///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
ObjHeaderIException::ObjHeaderIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
-// Function: ObjHeaderIException destructor
-///\brief Noop destructor.
+// Function: ObjHeaderIException destructor
+///\brief Noop destructor.
//--------------------------------------------------------------------------
ObjHeaderIException::~ObjHeaderIException() throw() {}
//--------------------------------------------------------------------------
-// Subclass: PropListIException
-// Programmer Binh-Minh Ribler - 2000
+// Subclass: PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
-// Function: PropListIException default constructor
-///\brief Default constructor.
+// Function: PropListIException default constructor
+///\brief Default constructor.
//--------------------------------------------------------------------------
PropListIException::PropListIException():Exception(){}
//--------------------------------------------------------------------------
-// Function: PropListIException overloaded constructor
-///\brief Creates a PropListIException with the name of the function,
-/// in which the failure occurs, and an optional detailed message.
-///\param func - IN: Name of the function where failure occurs
-///\param message - IN: Message on the failure
+// Function: PropListIException overloaded constructor
+///\brief Creates a PropListIException with the name of the function,
+/// in which the failure occurs, and an optional detailed message.
+///\param func - IN: Name of the function where failure occurs
+///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
PropListIException::PropListIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
-// Function: PropListIException destructor
-///\brief Noop destructor.
+// Function: PropListIException destructor
+///\brief Noop destructor.
//--------------------------------------------------------------------------
PropListIException::~PropListIException() throw() {}
//--------------------------------------------------------------------------
-// Subclass: DataSetIException
-// Programmer Binh-Minh Ribler - 2000
+// Subclass: DataSetIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
-// Function: DataSetIException default constructor
-///\brief Default constructor.
+// Function: DataSetIException default constructor
+///\brief Default constructor.
//--------------------------------------------------------------------------
DataSetIException::DataSetIException():Exception(){}
//--------------------------------------------------------------------------
-// Function: DataSetIException overloaded constructor
-///\brief Creates a DataSetIException with the name of the function,
-/// in which the failure occurs, and an optional detailed message.
-///\param func - IN: Name of the function where failure occurs
-///\param message - IN: Message on the failure
+// Function: DataSetIException overloaded constructor
+///\brief Creates a DataSetIException with the name of the function,
+/// in which the failure occurs, and an optional detailed message.
+///\param func - IN: Name of the function where failure occurs
+///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
DataSetIException::DataSetIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
-// Function: DataSetIException destructor
-///\brief Noop destructor.
+// Function: DataSetIException destructor
+///\brief Noop destructor.
//--------------------------------------------------------------------------
DataSetIException::~DataSetIException() throw() {}
//--------------------------------------------------------------------------
-// Subclass: AttributeIException
-// Programmer Binh-Minh Ribler - 2000
+// Subclass: AttributeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
-// Function: AttributeIException default constructor
-///\brief Default constructor.
+// Function: AttributeIException default constructor
+///\brief Default constructor.
//--------------------------------------------------------------------------
AttributeIException::AttributeIException():Exception(){}
//--------------------------------------------------------------------------
-// Function: AttributeIException overloaded constructor
-///\brief Creates an AttributeIException with the name of the function,
-/// in which the failure occurs, and an optional detailed message.
-///\param func - IN: Name of the function where failure occurs
-///\param message - IN: Message on the failure
+// Function: AttributeIException overloaded constructor
+///\brief Creates an AttributeIException with the name of the function,
+/// in which the failure occurs, and an optional detailed message.
+///\param func - IN: Name of the function where failure occurs
+///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
AttributeIException::AttributeIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
-// Function: AttributeIException destructor
-///\brief Noop destructor.
+// Function: AttributeIException destructor
+///\brief Noop destructor.
//--------------------------------------------------------------------------
AttributeIException::~AttributeIException() throw() {}
//--------------------------------------------------------------------------
-// Subclass: ReferenceException
-// Programmer Binh-Minh Ribler - 2000
+// Subclass: ReferenceException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
-// Function: ReferenceException default constructor
-///\brief Default constructor.
+// Function: ReferenceException default constructor
+///\brief Default constructor.
//--------------------------------------------------------------------------
ReferenceException::ReferenceException():Exception(){}
//--------------------------------------------------------------------------
-// Function: ReferenceException overloaded constructor
-///\brief Creates a ReferenceException with the name of the function,
-/// in which the failure occurs, and an optional detailed message.
-///\param func - IN: Name of the function where failure occurs
-///\param message - IN: Message on the failure
+// Function: ReferenceException overloaded constructor
+///\brief Creates a ReferenceException with the name of the function,
+/// in which the failure occurs, and an optional detailed message.
+///\param func - IN: Name of the function where failure occurs
+///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
ReferenceException::ReferenceException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
-// Function: ReferenceException destructor
-///\brief Noop destructor.
+// Function: ReferenceException destructor
+///\brief Noop destructor.
//--------------------------------------------------------------------------
ReferenceException::~ReferenceException() throw() {}
//--------------------------------------------------------------------------
-// Subclass: LibraryIException
-// Programmer Binh-Minh Ribler - 2000
+// Subclass: LibraryIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
-// Function: LibraryIException default constructor
-///\brief Default constructor.
+// Function: LibraryIException default constructor
+///\brief Default constructor.
//--------------------------------------------------------------------------
LibraryIException::LibraryIException():Exception(){}
//--------------------------------------------------------------------------
-// Function: LibraryIException overloaded constructor
-///\brief Creates a LibraryIException with the name of the function,
-/// in which the failure occurs, and an optional detailed message.
-///\param func - IN: Name of the function where failure occurs
-///\param message - IN: Message on the failure
+// Function: LibraryIException overloaded constructor
+///\brief Creates a LibraryIException with the name of the function,
+/// in which the failure occurs, and an optional detailed message.
+///\param func - IN: Name of the function where failure occurs
+///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
LibraryIException::LibraryIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
-// Function: LibraryIException destructor
-///\brief Noop destructor.
+// Function: LibraryIException destructor
+///\brief Noop destructor.
//--------------------------------------------------------------------------
LibraryIException::~LibraryIException() throw() {}
//--------------------------------------------------------------------------
-// Subclass: LocationException
-// Programmer Binh-Minh Ribler - 2014
+// Subclass: LocationException
+// Programmer Binh-Minh Ribler - 2014
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
-// Function: LocationException default constructor
-///\brief Default constructor.
+// Function: LocationException default constructor
+///\brief Default constructor.
//--------------------------------------------------------------------------
LocationException::LocationException():Exception(){}
//--------------------------------------------------------------------------
-// Function: LocationException overloaded constructor
-///\brief Creates a LocationException with the name of the function,
-/// in which the failure occurs, and an optional detailed message.
-///\param func - IN: Name of the function where failure occurs
-///\param message - IN: Message on the failure
+// Function: LocationException overloaded constructor
+///\brief Creates a LocationException with the name of the function,
+/// in which the failure occurs, and an optional detailed message.
+///\param func - IN: Name of the function where failure occurs
+///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
LocationException::LocationException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
-// Function: LocationException destructor
-///\brief Noop destructor.
+// Function: LocationException destructor
+///\brief Noop destructor.
//--------------------------------------------------------------------------
LocationException::~LocationException() throw() {}
//--------------------------------------------------------------------------
-// Subclass: IdComponentException
-// Programmer Binh-Minh Ribler - 2000
+// Subclass: IdComponentException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
-// Function: IdComponentException default constructor
-///\brief Default constructor.
+// Function: IdComponentException default constructor
+///\brief Default constructor.
//--------------------------------------------------------------------------
IdComponentException::IdComponentException(): Exception() {}
//--------------------------------------------------------------------------
-// Function: IdComponentException overloaded constructor
-///\brief Creates a IdComponentException with the name of the function,
-/// in which the failure occurs, and an optional detailed message.
-///\param func - IN: Name of the function where failure occurs
-///\param message - IN: Message on the failure
+// Function: IdComponentException overloaded constructor
+///\brief Creates a IdComponentException with the name of the function,
+/// in which the failure occurs, and an optional detailed message.
+///\param func - IN: Name of the function where failure occurs
+///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
IdComponentException::IdComponentException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
-// Function: IdComponentException destructor
-///\brief Noop destructor.
+// Function: IdComponentException destructor
+///\brief Noop destructor.
//--------------------------------------------------------------------------
IdComponentException::~IdComponentException() throw() {}
diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h
index 7112995..1f85711 100644
--- a/c++/src/H5Exception.h
+++ b/c++/src/H5Exception.h
@@ -33,147 +33,147 @@ namespace H5 {
*/
class H5_DLLCPP Exception {
public:
- // Creates an exception with a function name where the failure occurs
- // and an optional detailed message
- Exception(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ // Creates an exception with a function name where the failure occurs
+ // and an optional detailed message
+ Exception(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- // Returns a character string that describes the error specified by
- // a major error number.
- H5std_string getMajorString( hid_t err_major_id ) const;
+ // Returns a character string that describes the error specified by
+ // a major error number.
+ H5std_string getMajorString(hid_t err_major_id) const;
- // Returns a character string that describes the error specified by
- // a minor error number.
- H5std_string getMinorString( hid_t err_minor_id ) const;
+ // Returns a character string that describes the error specified by
+ // a minor error number.
+ H5std_string getMinorString(hid_t err_minor_id) const;
- // Returns the detailed message set at the time the exception is thrown
- H5std_string getDetailMsg() const;
- const char* getCDetailMsg() const; // C string of detailed message
- H5std_string getFuncName() const; // function name as a string object
- const char* getCFuncName() const; // function name as a char string
+ // Returns the detailed message set at the time the exception is thrown
+ H5std_string getDetailMsg() const;
+ const char* getCDetailMsg() const; // C string of detailed message
+ H5std_string getFuncName() const; // function name as a string object
+ const char* getCFuncName() const; // function name as a char string
- // Turns on the automatic error printing.
- static void setAutoPrint( H5E_auto2_t& func, void* client_data);
+ // Turns on the automatic error printing.
+ static void setAutoPrint(H5E_auto2_t& func, void* client_data);
- // Turns off the automatic error printing.
- static void dontPrint();
+ // Turns off the automatic error printing.
+ static void dontPrint();
- // Retrieves the current settings for the automatic error stack
- // traversal function and its data.
- static void getAutoPrint( H5E_auto2_t& func, void** client_data);
+ // Retrieves the current settings for the automatic error stack
+ // traversal function and its data.
+ static void getAutoPrint(H5E_auto2_t& func, void** client_data);
- // Clears the error stack for the current thread.
- static void clearErrorStack();
+ // Clears the error stack for the current thread.
+ static void clearErrorStack();
- // Walks the error stack for the current thread, calling the
- // specified function.
- static void walkErrorStack( H5E_direction_t direction,
- H5E_walk2_t func, void* client_data);
+ // Walks the error stack for the current thread, calling the
+ // specified function.
+ static void walkErrorStack(H5E_direction_t direction,
+ H5E_walk2_t func, void* client_data);
- // Prints the error stack in a default manner.
- static void printErrorStack(FILE* stream = stderr,
- hid_t err_stack = H5E_DEFAULT); // Static
- virtual void printError(FILE* stream = NULL) const;
+ // Prints the error stack in a default manner.
+ static void printErrorStack(FILE* stream = stderr,
+ hid_t err_stack = H5E_DEFAULT);
+ virtual void printError(FILE* stream = NULL) const;
- // Default constructor
- Exception();
+ // Default constructor
+ Exception();
- // copy constructor
- Exception( const Exception& orig);
+ // copy constructor
+ Exception(const Exception& orig);
- // virtual Destructor
- virtual ~Exception() throw();
+ // virtual Destructor
+ virtual ~Exception() throw();
protected:
- // Default value for detail_message
- static const char DEFAULT_MSG[];
+ // Default value for detail_message
+ static const char DEFAULT_MSG[];
private:
- H5std_string detail_message;
- H5std_string func_name;
+ H5std_string detail_message;
+ H5std_string func_name;
};
class H5_DLLCPP FileIException : public Exception {
public:
- FileIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- FileIException();
- virtual ~FileIException() throw();
+ FileIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ FileIException();
+ virtual ~FileIException() throw();
};
class H5_DLLCPP GroupIException : public Exception {
public:
- GroupIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- GroupIException();
- virtual ~GroupIException() throw();
+ GroupIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ GroupIException();
+ virtual ~GroupIException() throw();
};
class H5_DLLCPP DataSpaceIException : public Exception {
public:
- DataSpaceIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- DataSpaceIException();
- virtual ~DataSpaceIException() throw();
+ DataSpaceIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ DataSpaceIException();
+ virtual ~DataSpaceIException() throw();
};
class H5_DLLCPP DataTypeIException : public Exception {
public:
- DataTypeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- DataTypeIException();
- virtual ~DataTypeIException() throw();
+ DataTypeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ DataTypeIException();
+ virtual ~DataTypeIException() throw();
};
class H5_DLLCPP ObjHeaderIException : public Exception {
public:
- ObjHeaderIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- ObjHeaderIException();
- virtual ~ObjHeaderIException() throw();
+ ObjHeaderIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ ObjHeaderIException();
+ virtual ~ObjHeaderIException() throw();
};
class H5_DLLCPP PropListIException : public Exception {
public:
- PropListIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- PropListIException();
- virtual ~PropListIException() throw();
+ PropListIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ PropListIException();
+ virtual ~PropListIException() throw();
};
class H5_DLLCPP DataSetIException : public Exception {
public:
- DataSetIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- DataSetIException();
- virtual ~DataSetIException() throw();
+ DataSetIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ DataSetIException();
+ virtual ~DataSetIException() throw();
};
class H5_DLLCPP AttributeIException : public Exception {
public:
- AttributeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- AttributeIException();
- virtual ~AttributeIException() throw();
+ AttributeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ AttributeIException();
+ virtual ~AttributeIException() throw();
};
class H5_DLLCPP ReferenceException : public Exception {
public:
- ReferenceException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- ReferenceException();
- virtual ~ReferenceException() throw();
+ ReferenceException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ ReferenceException();
+ virtual ~ReferenceException() throw();
};
class H5_DLLCPP LibraryIException : public Exception {
public:
- LibraryIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- LibraryIException();
- virtual ~LibraryIException() throw();
+ LibraryIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ LibraryIException();
+ virtual ~LibraryIException() throw();
};
class H5_DLLCPP LocationException : public Exception {
public:
- LocationException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- LocationException();
- virtual ~LocationException() throw();
+ LocationException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ LocationException();
+ virtual ~LocationException() throw();
};
class H5_DLLCPP IdComponentException : public Exception {
public:
- IdComponentException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
- IdComponentException();
- virtual ~IdComponentException() throw();
+ IdComponentException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
+ IdComponentException();
+ virtual ~IdComponentException() throw();
};
}
diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp
index c3919da..1ab812c 100644
--- a/c++/src/H5FaccProp.cpp
+++ b/c++/src/H5FaccProp.cpp
@@ -63,7 +63,7 @@ FileAccPropList* FileAccPropList::getConstant()
//--------------------------------------------------------------------------
// Function: FileAccPropList::deleteConstants
-// Purpose: Deletes the constant object that FileAccPropList::DEFAULT_
+// Purpose Deletes the constant object that FileAccPropList::DEFAULT_
// points to.
// exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2015
@@ -75,271 +75,271 @@ void FileAccPropList::deleteConstants()
}
//--------------------------------------------------------------------------
-// Purpose: Constant for default property
+// Purpose Constant for default property
//--------------------------------------------------------------------------
const FileAccPropList& FileAccPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: Default Constructor
-///\brief Creates a file access property list
-// Programmer: Binh-Minh Ribler - 2000
+// Function: Default Constructor
+///\brief Creates a file access property list
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FileAccPropList::FileAccPropList() : PropList( H5P_FILE_ACCESS ) {}
+FileAccPropList::FileAccPropList() : PropList(H5P_FILE_ACCESS) {}
//--------------------------------------------------------------------------
-// Function: FileAccPropList copy constructor
-///\brief Copy Constructor: makes a copy of the original
-///\param original - IN: FileAccPropList instance to copy
-// Programmer: Binh-Minh Ribler - 2000
+// Function: FileAccPropList copy constructor
+///\brief Copy Constructor: makes a copy of the original
+///\param original - IN: FileAccPropList instance to copy
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
FileAccPropList::FileAccPropList(const FileAccPropList& original) : PropList(original) {}
//--------------------------------------------------------------------------
-// Function: FileAccPropList overloaded constructor
-///\brief Creates a file access property list using the id of an
-/// existing one.
-// Programmer: Binh-Minh Ribler - 2000
+// Function: FileAccPropList overloaded constructor
+///\brief Creates a file access property list using the id of an
+/// existing one.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
FileAccPropList::FileAccPropList(const hid_t plist_id) : PropList(plist_id) {}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setStdio
-///\brief Modifies this property list to use the \c H5FD_STDIO driver.
+// Function: FileAccPropList::setStdio
+///\brief Modifies this property list to use the \c H5FD_STDIO driver.
///
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setStdio() const
{
- herr_t ret_value = H5Pset_fapl_stdio(id);
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::setStdio", "H5Pset_fapl_stdio failed");
- }
+ herr_t ret_value = H5Pset_fapl_stdio(id);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::setStdio", "H5Pset_fapl_stdio failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::getDriver
-///\brief Return the ID of the low-level file driver.
-///\return A low-level driver ID which is the same ID used when the
-/// driver was set for the property list. The driver ID is
-/// only valid as long as the file driver remains registered.
-/// Valid driver identifiers can be found at:
+// Function: FileAccPropList::getDriver
+///\brief Return the ID of the low-level file driver.
+///\return A low-level driver ID which is the same ID used when the
+/// driver was set for the property list. The driver ID is
+/// only valid as long as the file driver remains registered.
+/// Valid driver identifiers can be found at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetDriver
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
hid_t FileAccPropList::getDriver() const
{
- hid_t driver = H5Pget_driver(id);
- if (driver < 0)
- {
- throw PropListIException("FileAccPropList::getDriver", "H5Pget_driver failed");
- }
+ hid_t driver = H5Pget_driver(id);
+ if (driver < 0)
+ {
+ throw PropListIException("FileAccPropList::getDriver", "H5Pget_driver failed");
+ }
return(driver);
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setDriver
-///\brief Set file driver for this property list.
-///\param new_driver_id - IN: File driver
-///\param new_driver_info - IN: Struct containing the driver-specific properites
-///\exception H5::PropListIException
+// Function: FileAccPropList::setDriver
+///\brief Set file driver for this property list.
+///\param new_driver_id - IN: File driver
+///\param new_driver_info - IN: Struct containing the driver-specific properites
+///\exception H5::PropListIException
///\par Description
-/// For a list of valid driver identifiers, please see the C
-/// layer Reference Manual at:
+/// For a list of valid driver identifiers, please see the C
+/// layer Reference Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetDriver
-// Programmer: Binh-Minh Ribler - April, 2004
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info) const
{
- herr_t ret_value = H5Pset_driver(id, new_driver_id, new_driver_info);
- if (ret_value < 0)
- {
- throw PropListIException("FileAccPropList::setDriver", "H5Pset_driver failed");
- }
+ herr_t ret_value = H5Pset_driver(id, new_driver_id, new_driver_info);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::setDriver", "H5Pset_driver failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setFamilyOffset
-///\brief Sets offset for family driver.
-///\param offset - IN: offset value
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: FileAccPropList::setFamilyOffset
+///\brief Sets offset for family driver.
+///\param offset - IN: offset value
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setFamilyOffset(hsize_t offset) const
{
- herr_t ret_value = H5Pset_family_offset(id, offset);
- if (ret_value < 0)
- {
- throw PropListIException("FileAccPropList::setFamilyOffset", "H5Pset_family_offset failed");
- }
+ herr_t ret_value = H5Pset_family_offset(id, offset);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::setFamilyOffset", "H5Pset_family_offset failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::getFamilyOffset
-///\brief Get offset for family driver.
-///\return Offset for family driver
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: FileAccPropList::getFamilyOffset
+///\brief Get offset for family driver.
+///\return Offset for family driver
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
hsize_t FileAccPropList::getFamilyOffset() const
{
- hsize_t offset;
- herr_t ret_value = H5Pget_family_offset(id, &offset);
- if (ret_value < 0)
- {
- throw PropListIException("FileAccPropList::getFamilyOffset", "H5Pget_family_offset failed");
- }
+ hsize_t offset;
+ herr_t ret_value = H5Pget_family_offset(id, &offset);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::getFamilyOffset", "H5Pget_family_offset failed");
+ }
return(offset);
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setCore
-///\brief Modifies this file access property list to use the \c H5FD_CORE
-/// driver.
-///\param increment - IN: Specifies how much memory to increase each
-/// time more memory is needed, in bytes
-///\param backing_store - IN: Indicating whether to write the file
-/// contents to disk when the file is closed
-///\exception H5::PropListIException
+// Function: FileAccPropList::setCore
+///\brief Modifies this file access property list to use the \c H5FD_CORE
+/// driver.
+///\param increment - IN: Specifies how much memory to increase each
+/// time more memory is needed, in bytes
+///\param backing_store - IN: Indicating whether to write the file
+/// contents to disk when the file is closed
+///\exception H5::PropListIException
///\par Description
-/// For more details on the use of \c H5FD_CORE driver, please
-/// refer to
+/// For more details on the use of \c H5FD_CORE driver, please
+/// refer to
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplCore
-// Programmer: Binh-Minh Ribler - April, 2004
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setCore (size_t increment, hbool_t backing_store) const
{
- herr_t ret_value = H5Pset_fapl_core (id, increment, backing_store);
- if (ret_value < 0)
- {
- throw PropListIException ("FileAccPropList::setCore", "H5Pset_fapl_core failed");
- }
+ herr_t ret_value = H5Pset_fapl_core (id, increment, backing_store);
+ if (ret_value < 0)
+ {
+ throw PropListIException ("FileAccPropList::setCore", "H5Pset_fapl_core failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::getCore
-///\brief Queries core file driver properties.
-///\param increment - OUT: Size of memory increment, in bytes
-///\param backing_store - OUT: Indicating whether to write the file
-/// contents to disk when the file is closed
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: FileAccPropList::getCore
+///\brief Queries core file driver properties.
+///\param increment - OUT: Size of memory increment, in bytes
+///\param backing_store - OUT: Indicating whether to write the file
+/// contents to disk when the file is closed
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::getCore (size_t& increment, hbool_t& backing_store) const
{
- herr_t ret_value = H5Pget_fapl_core(id, &increment, &backing_store);
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::getCore", "H5Pget_fapl_core failed");
- }
+ herr_t ret_value = H5Pget_fapl_core(id, &increment, &backing_store);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::getCore", "H5Pget_fapl_core failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setFamily
-///\brief Sets this file access property list to use the family driver.
-///\param memb_size - IN: Size in bytes of each file member
-///\param memb_plist - IN: File access property list to be used for
-/// each family member
-///\exception H5::PropListIException
+// Function: FileAccPropList::setFamily
+///\brief Sets this file access property list to use the family driver.
+///\param memb_size - IN: Size in bytes of each file member
+///\param memb_plist - IN: File access property list to be used for
+/// each family member
+///\exception H5::PropListIException
///\par Description
-/// Note that \a memb_size is used only when creating a new file.
-// Programmer: Binh-Minh Ribler - April, 2004
+/// Note that \a memb_size is used only when creating a new file.
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setFamily( hsize_t memb_size, const FileAccPropList& memb_plist ) const
+void FileAccPropList::setFamily(hsize_t memb_size, const FileAccPropList& memb_plist) const
{
- herr_t ret_value = H5Pset_fapl_family (id, memb_size, memb_plist.getId() );
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::setFamily", "H5Pset_fapl_family failed");
- }
+ herr_t ret_value = H5Pset_fapl_family (id, memb_size, memb_plist.getId());
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::setFamily", "H5Pset_fapl_family failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::getFamily
-///\brief Returns information about the family file access property
-/// list.
-///\param memb_size - OUT: Size in bytes of each file member
-///\param memb_plist - OUT: Retrieved file access property list for each
-/// file member
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: FileAccPropList::getFamily
+///\brief Returns information about the family file access property
+/// list.
+///\param memb_size - OUT: Size in bytes of each file member
+///\param memb_plist - OUT: Retrieved file access property list for each
+/// file member
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::getFamily(hsize_t& memb_size, FileAccPropList& memb_plist) const
{
- hid_t memb_plist_id;
- herr_t ret_value = H5Pget_fapl_family( id, &memb_size, &memb_plist_id );
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed");
- }
- memb_plist.p_setId(memb_plist_id);
+ hid_t memb_plist_id;
+ herr_t ret_value = H5Pget_fapl_family(id, &memb_size, &memb_plist_id);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed");
+ }
+ memb_plist.p_setId(memb_plist_id);
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::getFamily
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in what arguments it
-/// accepts and its return value.
-///\param memb_size - OUT: Size in bytes of each file member
-///\return The file access property list for each file member
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: FileAccPropList::getFamily
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts and its return value.
+///\param memb_size - OUT: Size in bytes of each file member
+///\return The file access property list for each file member
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
FileAccPropList FileAccPropList::getFamily(hsize_t& memb_size) const
{
- hid_t memb_plist_id;
- herr_t ret_value = H5Pget_fapl_family( id, &memb_size, &memb_plist_id );
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed");
- }
- FileAccPropList memb_plist(memb_plist_id);
- return(memb_plist);
-}
-
-//--------------------------------------------------------------------------
-// Function: FileAccPropList::setSplit
-///\brief Emulates the old split file driver, which stored meta data
-/// in one file and raw data in another file.
-///\param meta_plist - IN: File access plist for the metadata file
-///\param raw_plist - IN: File access plist for the raw data file
-///\param meta_ext - IN: Metadata filename extension as \c char*
-///\param raw_ext - IN: Raw data filename extension as \c char*
-///\exception H5::PropListIException
+ hid_t memb_plist_id;
+ herr_t ret_value = H5Pget_fapl_family(id, &memb_size, &memb_plist_id);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed");
+ }
+ FileAccPropList memb_plist(memb_plist_id);
+ return(memb_plist);
+}
+
+//--------------------------------------------------------------------------
+// Function: FileAccPropList::setSplit
+///\brief Emulates the old split file driver, which stored meta data
+/// in one file and raw data in another file.
+///\param meta_plist - IN: File access plist for the metadata file
+///\param raw_plist - IN: File access plist for the raw data file
+///\param meta_ext - IN: Metadata filename extension as \c char*
+///\param raw_ext - IN: Raw data filename extension as \c char*
+///\exception H5::PropListIException
///\par Description
-/// Temporary - For information, please refer to:
+/// Temporary - For information, please refer to:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplSplit
-// Programmer: Binh-Minh Ribler - April, 2004
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext ) const
-{
- hid_t meta_pid = meta_plist.getId();
- hid_t raw_pid = raw_plist.getId();
- herr_t ret_value = H5Pset_fapl_split( id, meta_ext, meta_pid, raw_ext, raw_pid );
- if( ret_value < 0 )
+void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext) const
{
- throw PropListIException("FileAccPropList::setSplit", "H5Pset_fapl_split failed");
- }
+ hid_t meta_pid = meta_plist.getId();
+ hid_t raw_pid = raw_plist.getId();
+ herr_t ret_value = H5Pset_fapl_split(id, meta_ext, meta_pid, raw_ext, raw_pid);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::setSplit", "H5Pset_fapl_split failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setSplit
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes character arguments as \c H5std_string.
-///\param meta_plist - IN: File access plist for the metadata file
-///\param raw_plist - IN: File access plist for the raw data file
-///\param meta_ext - IN: Metadata filename extension as \c H5std_string
-///\param raw_ext - IN: Raw data filename extension as \c H5std_string
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: FileAccPropList::setSplit
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes character arguments as \c H5std_string.
+///\param meta_plist - IN: File access plist for the metadata file
+///\param raw_plist - IN: File access plist for the raw data file
+///\param meta_ext - IN: Metadata filename extension as \c H5std_string
+///\param raw_ext - IN: Raw data filename extension as \c H5std_string
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext ) const
+void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext) const
{
- setSplit( meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str() );
+ setSplit(meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str());
}
// Stream Virtual File Driver had been removed from the main library.
@@ -347,402 +347,402 @@ void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccP
// -BMR, March, 2012
//--------------------------------------------------------------------------
-// Function: FileAccPropList::getSieveBufSize
-///\brief Returns the current settings for the data sieve buffer size
-/// property from this property list.
-///\return Data sieve buffer size, in bytes
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: FileAccPropList::getSieveBufSize
+///\brief Returns the current settings for the data sieve buffer size
+/// property from this property list.
+///\return Data sieve buffer size, in bytes
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
size_t FileAccPropList::getSieveBufSize() const
{
- size_t bufsize;
- herr_t ret_value = H5Pget_sieve_buf_size(id, &bufsize);
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed");
- }
- return(bufsize);
+ size_t bufsize;
+ herr_t ret_value = H5Pget_sieve_buf_size(id, &bufsize);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed");
+ }
+ return(bufsize);
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setSieveBufSize
-///\brief Sets the maximum size of the data sieve buffer.
-///\param bufsize - IN: Maximum size, in bytes, of data sieve buffer
-///\exception H5::PropListIException
+// Function: FileAccPropList::setSieveBufSize
+///\brief Sets the maximum size of the data sieve buffer.
+///\param bufsize - IN: Maximum size, in bytes, of data sieve buffer
+///\exception H5::PropListIException
///\par Description
-/// For detail on data sieving, please refer to
+/// For detail on data sieving, please refer to
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSieveBufSize
-// Programmer: Binh-Minh Ribler - April, 2004
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setSieveBufSize(size_t bufsize) const
{
- herr_t ret_value = H5Pset_sieve_buf_size(id, bufsize);
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed");
- }
+ herr_t ret_value = H5Pset_sieve_buf_size(id, bufsize);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setMetaBlockSize
-///\brief Sets the minimum size of metadata block allocations.
-///\param block_size - IN: Minimum size, in bytes, of metadata
-/// block allocations
-///\exception H5::PropListIException
+// Function: FileAccPropList::setMetaBlockSize
+///\brief Sets the minimum size of metadata block allocations.
+///\param block_size - IN: Minimum size, in bytes, of metadata
+/// block allocations
+///\exception H5::PropListIException
///\par Description
-/// For more detail, please see the C layer Reference Manual at:
+/// For more detail, please see the C layer Reference Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetMetaBlockSize
-// Programmer: Binh-Minh Ribler - April, 2004
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setMetaBlockSize(hsize_t &block_size) const
{
- herr_t ret_value = H5Pset_meta_block_size(id, block_size);
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::setMetaBlockSize", "H5Pset_meta_block_size failed");
- }
+ herr_t ret_value = H5Pset_meta_block_size(id, block_size);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::setMetaBlockSize", "H5Pset_meta_block_size failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::getMetaBlockSize
-///\brief Returns the current metadata block size setting.
-///\return Metadata block size
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: FileAccPropList::getMetaBlockSize
+///\brief Returns the current metadata block size setting.
+///\return Metadata block size
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
hsize_t FileAccPropList::getMetaBlockSize() const
{
- hsize_t block_size;
- herr_t ret_value = H5Pget_meta_block_size(id, &block_size);
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::getMetaBlockSize", "H5Pget_meta_block_size failed");
- }
- return(block_size);
+ hsize_t block_size;
+ herr_t ret_value = H5Pget_meta_block_size(id, &block_size);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::getMetaBlockSize", "H5Pget_meta_block_size failed");
+ }
+ return(block_size);
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setLog
-///\brief Modifies this file access property list to use the logging
-/// driver.
-///\param logfile - IN: Name of the log file
-///\param flags - IN: Flags specifying the types of logging activity
-///\param buf_size - IN: Size of the logging buffer
-///\exception H5::PropListIException
+// Function: FileAccPropList::setLog
+///\brief Modifies this file access property list to use the logging
+/// driver.
+///\param logfile - IN: Name of the log file
+///\param flags - IN: Flags specifying the types of logging activity
+///\param buf_size - IN: Size of the logging buffer
+///\exception H5::PropListIException
///\par Description
-/// For detail on \a flags, please refer to
+/// For detail on \a flags, please refer to
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplLog
-// Programmer: Binh-Minh Ribler - April, 2004
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_size) const
{
- herr_t ret_value = H5Pset_fapl_log(id, logfile, flags, buf_size);
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::setLog", "H5Pset_fapl_log failed");
- }
+ herr_t ret_value = H5Pset_fapl_log(id, logfile, flags, buf_size);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::setLog", "H5Pset_fapl_log failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setLog
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in what arguments it
-/// accepts.
-///\param logfile - IN: Name of the log file - string
-///\param flags - IN: Flags specifying the types of logging activity
-///\param buf_size - IN: Size of the logging buffer
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: FileAccPropList::setLog
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts.
+///\param logfile - IN: Name of the log file - string
+///\param flags - IN: Flags specifying the types of logging activity
+///\param buf_size - IN: Size of the logging buffer
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setLog(const H5std_string& logfile, unsigned flags, size_t buf_size) const
{
- setLog(logfile.c_str(), flags, buf_size);
+ setLog(logfile.c_str(), flags, buf_size);
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setSec2
-///\brief Modifies this file access property list to use the sec2
-/// driver.
+// Function: FileAccPropList::setSec2
+///\brief Modifies this file access property list to use the sec2
+/// driver.
///
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setSec2() const
{
- herr_t ret_value = H5Pset_fapl_sec2(id);
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::setSec2", "H5Pset_fapl_sec2 failed");
- }
+ herr_t ret_value = H5Pset_fapl_sec2(id);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::setSec2", "H5Pset_fapl_sec2 failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setAlignment
-///\brief Sets the alignment properties of this property list.
-///\param threshold - IN: Threshold value for file object size
-///\param alignment - IN: Alignment value
-///\exception H5::PropListIException
+// Function: FileAccPropList::setAlignment
+///\brief Sets the alignment properties of this property list.
+///\param threshold - IN: Threshold value for file object size
+///\param alignment - IN: Alignment value
+///\exception H5::PropListIException
///\par Description
-/// The parameter \a threshold must have a non-negative value.
-/// Note that setting the threshold value to 0 (zero) has the
-/// effect of a special case, forcing everything to be aligned.
-/// The parameter \a alignment must have a positive value.
+/// The parameter \a threshold must have a non-negative value.
+/// Note that setting the threshold value to 0 (zero) has the
+/// effect of a special case, forcing everything to be aligned.
+/// The parameter \a alignment must have a positive value.
///
-/// For detail on \a setting alignment, please refer to
+/// For detail on \a setting alignment, please refer to
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetAlignment
-// Programmer: Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileAccPropList::setAlignment( hsize_t threshold, hsize_t alignment ) const
+void FileAccPropList::setAlignment(hsize_t threshold, hsize_t alignment) const
{
- herr_t ret_value = H5Pset_alignment( id, threshold, alignment );
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::setAlignment", "H5Pset_alignment failed");
- }
+ herr_t ret_value = H5Pset_alignment(id, threshold, alignment);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::setAlignment", "H5Pset_alignment failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::getAlignment
-///\brief Returns the current settings for alignment properties from
-/// this property list.
-///\param threshold - OUT: Retrieved threshold value for file object size
-///\param alignment - OUT: Retrieved alignment value
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - 2000
+// Function: FileAccPropList::getAlignment
+///\brief Returns the current settings for alignment properties from
+/// this property list.
+///\param threshold - OUT: Retrieved threshold value for file object size
+///\param alignment - OUT: Retrieved alignment value
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileAccPropList::getAlignment( hsize_t &threshold, hsize_t &alignment ) const
+void FileAccPropList::getAlignment(hsize_t &threshold, hsize_t &alignment) const
{
- herr_t ret_value = H5Pget_alignment( id, &threshold, &alignment );
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::getAlignment", "H5Pget_alignment failed");
- }
+ herr_t ret_value = H5Pget_alignment(id, &threshold, &alignment);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::getAlignment", "H5Pget_alignment failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setMultiType
-///\brief Sets data type for \c MULTI driver.
-///\param dtype - IN: Type of data
-///\exception H5::PropListIException
+// Function: FileAccPropList::setMultiType
+///\brief Sets data type for \c MULTI driver.
+///\param dtype - IN: Type of data
+///\exception H5::PropListIException
///\par Description
-/// More details and valid values for \a dtype can be found at:
+/// More details and valid values for \a dtype can be found at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetMultiType
-// Programmer: Binh-Minh Ribler - April, 2004
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setMultiType(H5FD_mem_t dtype) const
{
- herr_t ret_value = H5Pset_multi_type(id, dtype);
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::setMultiType", "H5Pset_multi_type failed");
- }
+ herr_t ret_value = H5Pset_multi_type(id, dtype);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::setMultiType", "H5Pset_multi_type failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::getMultiType
-///\brief Returns the data type property for \c MULTI driver.
-///\return The data type property
-///\exception H5::PropListIException
+// Function: FileAccPropList::getMultiType
+///\brief Returns the data type property for \c MULTI driver.
+///\return The data type property
+///\exception H5::PropListIException
///\par Description
-/// More details and possible returned values can be found at:
+/// More details and possible returned values can be found at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetMultiType
-// Programmer: Binh-Minh Ribler - April, 2004
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
H5FD_mem_t FileAccPropList::getMultiType() const
{
- H5FD_mem_t dtype;
- herr_t ret_value = H5Pget_multi_type(id, &dtype);
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::getMultiType", "H5Pget_multi_type failed");
- }
- return(dtype);
+ H5FD_mem_t dtype;
+ herr_t ret_value = H5Pget_multi_type(id, &dtype);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::getMultiType", "H5Pget_multi_type failed");
+ }
+ return(dtype);
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setCache
-///\brief Sets the meta data cache and raw data chunk cache parameters.
-///\param mdc_nelmts - IN: Number of elements in the meta data cache
-///\param rdcc_nelmts - IN: Number of elements in the raw data chunk cache
-///\param rdcc_nbytes - IN: Total size of the raw data chunk cache, in bytes
-///\param rdcc_w0 - IN: Preemption policy
-///\exception H5::PropListIException
+// Function: FileAccPropList::setCache
+///\brief Sets the meta data cache and raw data chunk cache parameters.
+///\param mdc_nelmts - IN: Number of elements in the meta data cache
+///\param rdcc_nelmts - IN: Number of elements in the raw data chunk cache
+///\param rdcc_nbytes - IN: Total size of the raw data chunk cache, in bytes
+///\param rdcc_w0 - IN: Preemption policy
+///\exception H5::PropListIException
///\par Description
-/// The argument \a rdcc_w0 should hold a value between 0 and 1
-/// inclusive. This value indicates how much chunks that have
-/// been fully read are favored for preemption. A value of zero
-/// means fully read chunks are treated no differently than other
-/// chunks (the preemption is strictly LRU) while a value of one
-/// means fully read chunks are always preempted before other chunks.
-// Programmer: Binh-Minh Ribler - 2000
+/// The argument \a rdcc_w0 should hold a value between 0 and 1
+/// inclusive. This value indicates how much chunks that have
+/// been fully read are favored for preemption. A value of zero
+/// means fully read chunks are treated no differently than other
+/// chunks (the preemption is strictly LRU) while a value of one
+/// means fully read chunks are always preempted before other chunks.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileAccPropList::setCache( int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0 ) const
+void FileAccPropList::setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0) const
{
- herr_t ret_value = H5Pset_cache( id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0 );
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::setCache", "H5Pset_cache failed");
- }
+ herr_t ret_value = H5Pset_cache(id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::setCache", "H5Pset_cache failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::getCache
-///\brief Queries the meta data cache and raw data chunk cache parameters.
-///\param mdc_nelmts - OUT: Number of elements in the meta data cache
-///\param rdcc_nelmts - OUT: Number of elements in the raw data chunk cache
-///\param rdcc_nbytes - OUT: Total size of the raw data chunk cache, in bytes
-///\param rdcc_w0 - OUT: Preemption policy
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - 2000
+// Function: FileAccPropList::getCache
+///\brief Queries the meta data cache and raw data chunk cache parameters.
+///\param mdc_nelmts - OUT: Number of elements in the meta data cache
+///\param rdcc_nelmts - OUT: Number of elements in the raw data chunk cache
+///\param rdcc_nbytes - OUT: Total size of the raw data chunk cache, in bytes
+///\param rdcc_w0 - OUT: Preemption policy
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileAccPropList::getCache( int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0 ) const
+void FileAccPropList::getCache(int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0) const
{
- herr_t ret_value = H5Pget_cache( id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0 );
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::getCache", "H5Pget_cache failed");
- }
+ herr_t ret_value = H5Pget_cache(id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::getCache", "H5Pget_cache failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setFcloseDegree
-///\brief Sets the degree for the file close behavior.
-///\param degree - IN:
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: FileAccPropList::setFcloseDegree
+///\brief Sets the degree for the file close behavior.
+///\param degree - IN:
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void FileAccPropList::setFcloseDegree(H5F_close_degree_t degree) const
{
- herr_t ret_value = H5Pset_fclose_degree(id, degree);
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::setFcloseDegree", "H5Pset_fclose_degree failed");
- }
+ herr_t ret_value = H5Pset_fclose_degree(id, degree);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::setFcloseDegree", "H5Pset_fclose_degree failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::getFcloseDegree
-///\brief Returns the degree for the file close behavior.
-///\return The degree for the file close behavior
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - April, 2004
+// Function: FileAccPropList::getFcloseDegree
+///\brief Returns the degree for the file close behavior.
+///\return The degree for the file close behavior
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
H5F_close_degree_t FileAccPropList::getFcloseDegree() const
{
- H5F_close_degree_t degree;
- herr_t ret_value = H5Pget_fclose_degree(id, &degree);
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::getFcloseDegree", "H5Pget_fclose_degree failed");
- }
- return(degree);
+ H5F_close_degree_t degree;
+ herr_t ret_value = H5Pget_fclose_degree(id, &degree);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::getFcloseDegree", "H5Pget_fclose_degree failed");
+ }
+ return(degree);
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setGcReferences
-///\brief Sets garbage collecting references flag.
-///\param gc_ref - IN: Flag setting reference garbage collection to
-/// on (1) or off (0).
-///\exception H5::PropListIException
+// Function: FileAccPropList::setGcReferences
+///\brief Sets garbage collecting references flag.
+///\param gc_ref - IN: Flag setting reference garbage collection to
+/// on (1) or off (0).
+///\exception H5::PropListIException
///\par Description
-/// For detail on \a fapl, please refer to
+/// For detail on \a fapl, please refer to
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetGCReferences
-// Programmer: Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileAccPropList::setGcReferences( unsigned gc_ref ) const
+void FileAccPropList::setGcReferences(unsigned gc_ref) const
{
- herr_t ret_value = H5Pset_gc_references( id, gc_ref );
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::setGcReferences", "H5Pset_gc_references failed");
- }
+ herr_t ret_value = H5Pset_gc_references(id, gc_ref);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::setGcReferences", "H5Pset_gc_references failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::getGcReferences
-///\brief Returns the garbage collecting references setting.
-///\return Garbage collecting references setting, 0 (off) or 1 (on)
-///\exception H5::PropListIException
-// Programmer: Binh-Minh Ribler - 2000
+// Function: FileAccPropList::getGcReferences
+///\brief Returns the garbage collecting references setting.
+///\return Garbage collecting references setting, 0 (off) or 1 (on)
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
unsigned FileAccPropList::getGcReferences() const
{
- unsigned gc_ref;
+ unsigned gc_ref;
- // the name of this routine will be changed to H5Pget_gc_references???
- herr_t ret_value = H5Pget_gc_references( id, &gc_ref );
- if( ret_value < 0 )
- {
- throw PropListIException("FileAccPropList::getGcReferences", "H5Pget_gc_references failed");
- }
- return( gc_ref );
+ // the name of this routine will be changed to H5Pget_gc_references???
+ herr_t ret_value = H5Pget_gc_references(id, &gc_ref);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileAccPropList::getGcReferences", "H5Pget_gc_references failed");
+ }
+ return(gc_ref);
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::setLibverBounds
-///\brief Sets bounds on versions of library format to be used when creating
-/// or writing objects.
-///\param libver_low - IN: Earliest version of the library that will be
-/// used for creating or writing objects
-///\param libver_high - IN: Latest version of the library that will be
-///\exception H5::PropListIException
+// Function: FileAccPropList::setLibverBounds
+///\brief Sets bounds on versions of library format to be used when creating
+/// or writing objects.
+///\param libver_low - IN: Earliest version of the library that will be
+/// used for creating or writing objects
+///\param libver_high - IN: Latest version of the library that will be
+///\exception H5::PropListIException
///\par Description
-/// Valid values of \a libver_low are as follows:
-/// \li \c H5F_LIBVER_EARLIEST (Default)
-/// \li \c H5F_LIBVER_18
-/// \li \c H5F_LIBVER_LATEST
+/// Valid values of \a libver_low are as follows:
+/// \li \c H5F_LIBVER_EARLIEST (Default)
+/// \li \c H5F_LIBVER_18
+/// \li \c H5F_LIBVER_LATEST
///
-/// Valid values of \a libver_high are as follows:
-/// \li \c H5F_LIBVER_18
-/// \li \c H5F_LIBVER_LATEST (Default)
+/// Valid values of \a libver_high are as follows:
+/// \li \c H5F_LIBVER_18
+/// \li \c H5F_LIBVER_LATEST (Default)
///
-/// For more details, please refer to
+/// For more details, please refer to
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetLibverBounds
-// Programmer: Binh-Minh Ribler - March, 2015
+// Programmer Binh-Minh Ribler - March, 2015
//--------------------------------------------------------------------------
void FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const
{
herr_t ret_value = H5Pset_libver_bounds(id, libver_low, libver_high);
if (ret_value < 0)
{
- throw PropListIException("FileAccPropList::setLibverBounds", "H5Pset_libver_bounds failed");
+ throw PropListIException("FileAccPropList::setLibverBounds", "H5Pset_libver_bounds failed");
}
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList::getLibverBounds
-///\brief Gets the current settings for the library version format bounds
-/// from a file access property list.
-///\param libver_low - OUT: Earliest version of the library that will be
-/// used for creating or writing objects
-///\param libver_high - OUT: Latest version of the library that will be
-/// used for creating or writing objects
-///\exception H5::PropListIException
+// Function: FileAccPropList::getLibverBounds
+///\brief Gets the current settings for the library version format bounds
+/// from a file access property list.
+///\param libver_low - OUT: Earliest version of the library that will be
+/// used for creating or writing objects
+///\param libver_high - OUT: Latest version of the library that will be
+/// used for creating or writing objects
+///\exception H5::PropListIException
///\par Description
-/// On success, the argument \a libver_low can have the following
-/// values:
-/// \li \c H5F_LIBVER_EARLIEST
-/// \li \c H5F_LIBVER_18
-/// \li \c H5F_LIBVER_LATEST
+/// On success, the argument \a libver_low can have the following
+/// values:
+/// \li \c H5F_LIBVER_EARLIEST
+/// \li \c H5F_LIBVER_18
+/// \li \c H5F_LIBVER_LATEST
///
-/// and \a libver_high:
-/// \li \c H5F_LIBVER_18
-/// \li \c H5F_LIBVER_LATEST
-// Programmer: Binh-Minh Ribler - March, 2015
+/// and \a libver_high:
+/// \li \c H5F_LIBVER_18
+/// \li \c H5F_LIBVER_LATEST
+// Programmer Binh-Minh Ribler - March, 2015
//--------------------------------------------------------------------------
void FileAccPropList::getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& libver_high) const
{
herr_t ret_value = H5Pget_libver_bounds(id, &libver_low, &libver_high);
- if( ret_value < 0 )
+ if (ret_value < 0)
{
- throw PropListIException("FileAccPropList::getLibverBounds", "H5Pget_libver_bounds failed");
+ throw PropListIException("FileAccPropList::getLibverBounds", "H5Pget_libver_bounds failed");
}
}
//--------------------------------------------------------------------------
-// Function: FileAccPropList destructor
-///\brief Noop destructor
-// Programmer Binh-Minh Ribler - 2000
+// Function: FileAccPropList destructor
+///\brief Noop destructor
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
FileAccPropList::~FileAccPropList() {}
diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h
index aec5fcc..ae7c7f9 100644
--- a/c++/src/H5FaccProp.h
+++ b/c++/src/H5FaccProp.h
@@ -27,121 +27,121 @@ namespace H5 {
*/
class H5_DLLCPP FileAccPropList : public PropList {
public:
- ///\brief Default file access property list.
- static const FileAccPropList& DEFAULT;
+ ///\brief Default file access property list.
+ static const FileAccPropList& DEFAULT;
- // Creates a file access property list.
- FileAccPropList();
+ // Creates a file access property list.
+ FileAccPropList();
- // Modifies this property list to use the H5FD_STDIO driver
- void setStdio() const;
+ // Modifies this property list to use the H5FD_STDIO driver
+ void setStdio() const;
- // Set file driver for this property list
- void setDriver(hid_t new_driver_id, const void *new_driver_info) const;
+ // Set file driver for this property list
+ void setDriver(hid_t new_driver_id, const void *new_driver_info) const;
- // Returns a low-level file driver identifier.
- hid_t getDriver() const;
+ // Returns a low-level file driver identifier.
+ hid_t getDriver() const;
- // Sets offset for family driver.
- void setFamilyOffset(hsize_t offset) const;
+ // Sets offset for family driver.
+ void setFamilyOffset(hsize_t offset) const;
- // Gets offset for family driver.
- hsize_t getFamilyOffset() const;
+ // Gets offset for family driver.
+ hsize_t getFamilyOffset() const;
- // Modifies this file access property list to use the sec2 driver.
- void setSec2() const;
+ // Modifies this file access property list to use the sec2 driver.
+ void setSec2() const;
- // Modifies this file access property list to use the H5FD_CORE
- // driver.
- void setCore (size_t increment, hbool_t backing_store) const;
+ // Modifies this file access property list to use the H5FD_CORE
+ // driver.
+ void setCore (size_t increment, hbool_t backing_store) const;
- // Queries H5FD_CORE driver properties.
- void getCore (size_t& increment, hbool_t& backing_store) const;
+ // Queries H5FD_CORE driver properties.
+ void getCore (size_t& increment, hbool_t& backing_store) const;
- // Sets this file access properties list to the family driver.
- void setFamily( hsize_t memb_size, const FileAccPropList& memb_plist ) const;
+ // Sets this file access properties list to the family driver.
+ void setFamily(hsize_t memb_size, const FileAccPropList& memb_plist) const;
- // Returns information about the family file access property list.
- void getFamily(hsize_t& memb_size, FileAccPropList& memb_plist) const;
- FileAccPropList getFamily(hsize_t& memb_size) const;
+ // Returns information about the family file access property list.
+ void getFamily(hsize_t& memb_size, FileAccPropList& memb_plist) const;
+ FileAccPropList getFamily(hsize_t& memb_size) const;
- // Emulates the old split file driver,
- void setSplit(const FileAccPropList& meta_plist,
- const FileAccPropList& raw_plist,
- const char* meta_ext = ".meta",
- const char* raw_ext = ".raw" ) const;
- void setSplit(const FileAccPropList& meta_plist,
- const FileAccPropList& raw_plist,
- const H5std_string& meta_ext = ".meta",
- const H5std_string& raw_ext = ".raw") const;
+ // Emulates the old split file driver,
+ void setSplit(const FileAccPropList& meta_plist,
+ const FileAccPropList& raw_plist,
+ const char* meta_ext = ".meta",
+ const char* raw_ext = ".raw") const;
+ void setSplit(const FileAccPropList& meta_plist,
+ const FileAccPropList& raw_plist,
+ const H5std_string& meta_ext = ".meta",
+ const H5std_string& raw_ext = ".raw") const;
- // Sets the maximum size of the data sieve buffer.
- void setSieveBufSize(size_t bufsize) const;
+ // Sets the maximum size of the data sieve buffer.
+ void setSieveBufSize(size_t bufsize) const;
- // Returns the current settings for the data sieve buffer size
- // property
- size_t getSieveBufSize() const;
+ // Returns the current settings for the data sieve buffer size
+ // property
+ size_t getSieveBufSize() const;
- // Sets the minimum size of metadata block allocations.
- void setMetaBlockSize(hsize_t &block_size) const;
+ // Sets the minimum size of metadata block allocations.
+ void setMetaBlockSize(hsize_t &block_size) const;
- // Returns the current metadata block size setting.
- hsize_t getMetaBlockSize() const;
+ // Returns the current metadata block size setting.
+ hsize_t getMetaBlockSize() const;
- // Modifies this file access property list to use the logging driver.
- void setLog(const char *logfile, unsigned flags, size_t buf_size) const;
- void setLog(const H5std_string& logfile, unsigned flags, size_t buf_size) const;
+ // Modifies this file access property list to use the logging driver.
+ void setLog(const char *logfile, unsigned flags, size_t buf_size) const;
+ void setLog(const H5std_string& logfile, unsigned flags, size_t buf_size) const;
- // Sets alignment properties of this file access property list
- void setAlignment( hsize_t threshold = 1, hsize_t alignment = 1 ) const;
+ // Sets alignment properties of this file access property list
+ void setAlignment(hsize_t threshold = 1, hsize_t alignment = 1) const;
- // Retrieves the current settings for alignment properties from
- // this property list.
- void getAlignment( hsize_t& threshold, hsize_t& alignment ) const;
+ // Retrieves the current settings for alignment properties from
+ // this property list.
+ void getAlignment(hsize_t& threshold, hsize_t& alignment) const;
- // Sets data type for multi driver.
- void setMultiType(H5FD_mem_t dtype) const;
+ // Sets data type for multi driver.
+ void setMultiType(H5FD_mem_t dtype) const;
- // Returns the data type property for MULTI driver.
- H5FD_mem_t getMultiType() const;
+ // Returns the data type property for MULTI driver.
+ H5FD_mem_t getMultiType() const;
- // Sets the meta data cache and raw data chunk cache parameters.
- void setCache( int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0 ) const;
+ // Sets the meta data cache and raw data chunk cache parameters.
+ void setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0) const;
- // Queries the meta data cache and raw data chunk cache parameters.
- void getCache( int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0 ) const;
+ // Queries the meta data cache and raw data chunk cache parameters.
+ void getCache(int& mdc_nelmts, size_t& rdcc_nelmts, size_t& rdcc_nbytes, double& rdcc_w0) const;
- // Sets the degree for the file close behavior.
- void setFcloseDegree(H5F_close_degree_t degree) const;
+ // Sets the degree for the file close behavior.
+ void setFcloseDegree(H5F_close_degree_t degree) const;
- // Returns the degree for the file close behavior.
- H5F_close_degree_t getFcloseDegree() const;
+ // Returns the degree for the file close behavior.
+ H5F_close_degree_t getFcloseDegree() const;
- // Sets garbage collecting references flag.
- void setGcReferences( unsigned gc_ref = 0 ) const;
+ // Sets garbage collecting references flag.
+ void setGcReferences(unsigned gc_ref = 0) const;
- // Returns garbage collecting references setting.
- unsigned getGcReferences() const;
+ // Returns garbage collecting references setting.
+ unsigned getGcReferences() const;
- // Sets bounds on versions of library format to be used when creating
- // or writing objects.
- void setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const;
+ // Sets bounds on versions of library format to be used when creating
+ // or writing objects.
+ void setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const;
- // Gets the current settings for the library version format bounds.
- void getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& libver_high) const;
+ // Gets the current settings for the library version format bounds.
+ void getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& libver_high) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("FileAccPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("FileAccPropList"); }
- // Copy constructor: creates a copy of a FileAccPropList object.
- FileAccPropList( const FileAccPropList& original );
+ // Copy constructor: creates a copy of a FileAccPropList object.
+ FileAccPropList(const FileAccPropList& original);
- // Creates a copy of an existing file access property list
- // using the property list id.
- FileAccPropList (const hid_t plist_id);
+ // Creates a copy of an existing file access property list
+ // using the property list id.
+ FileAccPropList (const hid_t plist_id);
- // Noop destructor
- virtual ~FileAccPropList();
+ // Noop destructor
+ virtual ~FileAccPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp
index ed6064f..c490f26 100644
--- a/c++/src/H5FcreatProp.cpp
+++ b/c++/src/H5FcreatProp.cpp
@@ -33,7 +33,7 @@ FileCreatPropList* FileCreatPropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: FileCreatPropList::getConstant
-// Purpose: Creates a FileCreatPropList object representing the HDF5
+// Purpose Creates a FileCreatPropList object representing the HDF5
// constant H5P_FILE_ACCESS, pointed to by FileCreatPropList::DEFAULT_
// exception H5::PropListIException
// Description
@@ -62,7 +62,7 @@ FileCreatPropList* FileCreatPropList::getConstant()
//--------------------------------------------------------------------------
// Function: FileCreatPropList::deleteConstants
-// Purpose: Deletes the constant object that FileCreatPropList::DEFAULT_
+// Purpose Deletes the constant object that FileCreatPropList::DEFAULT_
// points to.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
@@ -73,302 +73,302 @@ void FileCreatPropList::deleteConstants()
}
//--------------------------------------------------------------------------
-// Purpose Constant for default property
+// Purpose Constant for default property
//--------------------------------------------------------------------------
const FileCreatPropList& FileCreatPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: FileCreatPropList default constructor
-///\brief Default constructor: Creates a file create property list
-// Programmer Binh-Minh Ribler - 2000
+// Function: FileCreatPropList default constructor
+///\brief Default constructor: Creates a file create property list
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FileCreatPropList::FileCreatPropList() : PropList( H5P_FILE_CREATE ) {}
+FileCreatPropList::FileCreatPropList() : PropList(H5P_FILE_CREATE) {}
//--------------------------------------------------------------------------
-// Function: FileCreatPropList copy constructor
-///\brief Copy constructor: makes a copy of the original
-/// FileCreatPropList object.
-///\param original - IN: FileCreatPropList instance to copy
-// Programmer Binh-Minh Ribler - 2000
+// Function: FileCreatPropList copy constructor
+///\brief Copy constructor: makes a copy of the original
+/// FileCreatPropList object.
+///\param original - IN: FileCreatPropList instance to copy
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FileCreatPropList::FileCreatPropList( const FileCreatPropList& original ) : PropList( original ) {}
+FileCreatPropList::FileCreatPropList(const FileCreatPropList& original) : PropList( original ) {}
//--------------------------------------------------------------------------
-// Function: FileCreatPropList overloaded constructor
-///\brief Creates a file creation property list using the id of an
-/// existing one.
-///\param plist_id - IN: FileCreatPropList id to use
-// Programmer Binh-Minh Ribler - 2000
+// Function: FileCreatPropList overloaded constructor
+///\brief Creates a file creation property list using the id of an
+/// existing one.
+///\param plist_id - IN: FileCreatPropList id to use
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
FileCreatPropList::FileCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
-// Function: FileCreatPropList::getVersion
-///\brief Retrieves version information for various parts of a file.
-///\param super - OUT: The file super block.
-///\param freelist - OUT: The global free list.
-///\param stab - OUT: The root symbol table entry.
-///\param shhdr - OUT: Shared object headers.
-///\exception H5::PropListIException
+// Function: FileCreatPropList::getVersion
+///\brief Retrieves version information for various parts of a file.
+///\param super - OUT: The file super block.
+///\param freelist - OUT: The global free list.
+///\param stab - OUT: The root symbol table entry.
+///\param shhdr - OUT: Shared object headers.
+///\exception H5::PropListIException
///\par Description
-/// Any (or even all) of the output arguments can be null pointers.
-// Programmer Binh-Minh Ribler - 2000
+/// Any (or even all) of the output arguments can be null pointers.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void FileCreatPropList::getVersion(unsigned& super, unsigned& freelist, unsigned& stab, unsigned& shhdr) const
{
- herr_t ret_value = H5Pget_version( id, &super, &freelist, &stab, &shhdr );
- if( ret_value < 0 )
- {
- throw PropListIException("FileCreatPropList::getVersion",
- "H5Pget_version failed");
- }
+ herr_t ret_value = H5Pget_version(id, &super, &freelist, &stab, &shhdr);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileCreatPropList::getVersion",
+ "H5Pget_version failed");
+ }
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
-// Function: FileCreatPropList::setUserblock
-///\brief Sets the user block size field of this file creation property list.
-///\param size - IN: User block size to be set, in bytes
-///\exception H5::PropListIException
+// Function: FileCreatPropList::setUserblock
+///\brief Sets the user block size field of this file creation property list.
+///\param size - IN: User block size to be set, in bytes
+///\exception H5::PropListIException
///\par Description
-/// The default user block size is 0; it may be set to any power
-/// of 2 equal to 512 or greater (512, 1024, 2048, etc.)
-// Programmer Binh-Minh Ribler - 2000
+/// The default user block size is 0; it may be set to any power
+/// of 2 equal to 512 or greater (512, 1024, 2048, etc.)
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::setUserblock( hsize_t size ) const
+void FileCreatPropList::setUserblock(hsize_t size) const
{
- herr_t ret_value = H5Pset_userblock( id, size);
- if( ret_value < 0 )
- {
- throw PropListIException("FileCreatPropList::setUserblock",
- "H5Pset_userblock failed");
- }
+ herr_t ret_value = H5Pset_userblock(id, size);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileCreatPropList::setUserblock",
+ "H5Pset_userblock failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileCreatPropList::getUserblock
-///\brief Returns the user block size of this file creation property list.
-///\return User block size
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: FileCreatPropList::getUserblock
+///\brief Returns the user block size of this file creation property list.
+///\return User block size
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
hsize_t FileCreatPropList::getUserblock() const
{
- hsize_t userblock_size;
- herr_t ret_value = H5Pget_userblock( id, &userblock_size );
- if( ret_value < 0 )
- {
- throw PropListIException("FileCreatPropList::getUserblock",
- "H5Pget_userblock failed");
- }
- return( userblock_size );
+ hsize_t userblock_size;
+ herr_t ret_value = H5Pget_userblock(id, &userblock_size);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileCreatPropList::getUserblock",
+ "H5Pget_userblock failed");
+ }
+ return(userblock_size);
}
//--------------------------------------------------------------------------
-// Function: FileCreatPropList::setSizes
-///\brief Sets the byte size of the offsets and lengths used to
-/// address objects in an HDF5 file.
-///\param sizeof_addr - IN: Size of an object offset in bytes
-///\param sizeof_size - IN: Size of an object length in bytes.
-///\exception H5::PropListIException
+// Function: FileCreatPropList::setSizes
+///\brief Sets the byte size of the offsets and lengths used to
+/// address objects in an HDF5 file.
+///\param sizeof_addr - IN: Size of an object offset in bytes
+///\param sizeof_size - IN: Size of an object length in bytes.
+///\exception H5::PropListIException
///\par Description
-/// For information on setting sizes, please refer to the
-/// C layer Reference Manual at:
+/// For information on setting sizes, please refer to the
+/// C layer Reference Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSizes
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::setSizes( size_t sizeof_addr, size_t sizeof_size ) const
+void FileCreatPropList::setSizes(size_t sizeof_addr, size_t sizeof_size) const
{
- herr_t ret_value = H5Pset_sizes( id, sizeof_addr, sizeof_size );
- if( ret_value < 0 )
- {
- throw PropListIException("FileCreatPropList::setSizes",
- "H5Pset_sizes failed");
- }
+ herr_t ret_value = H5Pset_sizes(id, sizeof_addr, sizeof_size);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileCreatPropList::setSizes",
+ "H5Pset_sizes failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileCreatPropList::getSizes
-///\brief Retrieves the size of the offsets and lengths used in an
-/// HDF5 file.
+// Function: FileCreatPropList::getSizes
+///\brief Retrieves the size of the offsets and lengths used in an
+/// HDF5 file.
///
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - 2000
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::getSizes( size_t& sizeof_addr, size_t& sizeof_size ) const
+void FileCreatPropList::getSizes(size_t& sizeof_addr, size_t& sizeof_size) const
{
- herr_t ret_value = H5Pget_sizes( id, &sizeof_addr, &sizeof_size );
- if( ret_value < 0 )
- {
- throw PropListIException("FileCreatPropList::getSizes",
- "H5Pget_sizes failed");
- }
+ herr_t ret_value = H5Pget_sizes(id, &sizeof_addr, &sizeof_size);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileCreatPropList::getSizes",
+ "H5Pget_sizes failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileCreatPropList::setSymk
-///\brief Sets the size of parameters used to control the symbol table
-/// nodes.
-///\param ik - IN: Symbol table tree rank
-///\param lk - IN: Symbol table node size
-///\exception H5::PropListIException
+// Function: FileCreatPropList::setSymk
+///\brief Sets the size of parameters used to control the symbol table
+/// nodes.
+///\param ik - IN: Symbol table tree rank
+///\param lk - IN: Symbol table node size
+///\exception H5::PropListIException
///\par Description
-/// For information, please see the C layer Reference Manual at:
+/// For information, please see the C layer Reference Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSymK
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::setSymk( unsigned ik, unsigned lk ) const
+void FileCreatPropList::setSymk(unsigned ik, unsigned lk) const
{
- herr_t ret_value = H5Pset_sym_k( id, ik, lk );
- if( ret_value < 0 )
- {
- throw PropListIException("FileCreatPropList::setSymk",
- "H5Pset_sym_k failed");
- }
+ herr_t ret_value = H5Pset_sym_k(id, ik, lk);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileCreatPropList::setSymk",
+ "H5Pset_sym_k failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileCreatPropList::getSymk
-///\brief Retrieves the size of the symbol table B-tree 1/2 rank and
-/// the symbol table leaf node 1/2 size.
+// Function: FileCreatPropList::getSymk
+///\brief Retrieves the size of the symbol table B-tree 1/2 rank and
+/// the symbol table leaf node 1/2 size.
///
-///\exception H5::PropListIException
+///\exception H5::PropListIException
///\par Description
-/// For information, please see
+/// For information, please see
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetSymK
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::getSymk( unsigned& ik, unsigned& lk ) const
+void FileCreatPropList::getSymk(unsigned& ik, unsigned& lk) const
{
- herr_t ret_value = H5Pget_sym_k( id, &ik, &lk );
- if( ret_value < 0 )
- {
- throw PropListIException("FileCreatPropList::getSymk",
- "H5Pget_sym_k failed");
- }
+ herr_t ret_value = H5Pget_sym_k(id, &ik, &lk);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileCreatPropList::getSymk",
+ "H5Pget_sym_k failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileCreatPropList::setIstorek
-///\brief Sets the size of the parameter used to control the B-trees
-/// for indexing chunked datasets.
-///\param ik - IN: 1/2 rank of chunked storage B-tree
-///\exception H5::PropListIException
+// Function: FileCreatPropList::setIstorek
+///\brief Sets the size of the parameter used to control the B-trees
+/// for indexing chunked datasets.
+///\param ik - IN: 1/2 rank of chunked storage B-tree
+///\exception H5::PropListIException
///\par Description
-/// For information, please see the C layer Reference Manual at:
+/// For information, please see the C layer Reference Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetIstoreK
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FileCreatPropList::setIstorek( unsigned ik ) const
+void FileCreatPropList::setIstorek(unsigned ik) const
{
- herr_t ret_value = H5Pset_istore_k( id, ik );
- if( ret_value < 0 )
- {
- throw PropListIException("FileCreatPropList::setIstorek",
- "H5Pset_istore_k failed");
- }
+ herr_t ret_value = H5Pset_istore_k(id, ik);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileCreatPropList::setIstorek",
+ "H5Pset_istore_k failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileCreatPropList::getIstorek
-///\brief Returns the 1/2 rank of an indexed storage B-tree.
-///\return 1/2 rank of chunked storage B-tree
-///\exception H5::PropListIException
+// Function: FileCreatPropList::getIstorek
+///\brief Returns the 1/2 rank of an indexed storage B-tree.
+///\return 1/2 rank of chunked storage B-tree
+///\exception H5::PropListIException
///\par Description
-/// For information, please see
+/// For information, please see
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetIstoreK
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
unsigned FileCreatPropList::getIstorek() const
{
- unsigned ik;
- herr_t ret_value = H5Pget_istore_k( id, &ik );
- if( ret_value < 0 )
- {
- throw PropListIException("FileCreatPropList::getIstorek",
- "H5Pget_istore_k failed");
- }
- return( ik );
+ unsigned ik;
+ herr_t ret_value = H5Pget_istore_k(id, &ik);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileCreatPropList::getIstorek",
+ "H5Pget_istore_k failed");
+ }
+ return(ik);
}
//--------------------------------------------------------------------------
-// Function: FileCreatPropList::setFileSpace
-///\brief Sets the strategy and the threshold value that the library
-/// will employ in managing file space.
-///\param strategy - IN: Strategy for file space management
-///\param threshold - IN: Free-space section threshold. The library
-/// default is 1, which is to track all free-space sections.
-///\exception H5::PropListIException
+// Function: FileCreatPropList::setFileSpace
+///\brief Sets the strategy and the threshold value that the library
+/// will employ in managing file space.
+///\param strategy - IN: Strategy for file space management
+///\param threshold - IN: Free-space section threshold. The library
+/// default is 1, which is to track all free-space sections.
+///\exception H5::PropListIException
///\par Description
-/// If the given strategy is zero, the property will not be
-/// changed and the existing strategy will be retained.
-/// If the given threshold value is zero, the property will not be
-/// changed and the existing threshold will be retained.
-/// Valid values of \a libver_low are as follows:
-/// \li \c H5F_FILE_SPACE_ALL (Default)
-/// \li \c H5F_FILE_SPACE_ALL_PERSIST
-/// \li \c H5F_FILE_SPACE_AGGR_VFD
-/// \li \c H5F_FILE_SPACE_VFD
-/// For information, please see the C layer Reference Manual at:
+/// If the given strategy is zero, the property will not be
+/// changed and the existing strategy will be retained.
+/// If the given threshold value is zero, the property will not be
+/// changed and the existing threshold will be retained.
+/// Valid values of \a libver_low are as follows:
+/// \li \c H5F_FILE_SPACE_ALL (Default)
+/// \li \c H5F_FILE_SPACE_ALL_PERSIST
+/// \li \c H5F_FILE_SPACE_AGGR_VFD
+/// \li \c H5F_FILE_SPACE_VFD
+/// For information, please see the C layer Reference Manual at:
/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFileSpace
-// Programmer Binh-Minh Ribler - Feb, 2017
+// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
void FileCreatPropList::setFileSpace(H5F_file_space_type_t strategy, hsize_t threshold) const
{
- herr_t ret_value = H5Pset_file_space(id, strategy, threshold);
- if( ret_value < 0 )
- {
- throw PropListIException("FileCreatPropList::setFileSpace",
- "H5Pset_file_space failed");
- }
+ herr_t ret_value = H5Pset_file_space(id, strategy, threshold);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileCreatPropList::setFileSpace",
+ "H5Pset_file_space failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FileCreatPropList::getFileSpaceStrategy
-///\brief Returns the strategy that the library uses in managing file space.
-///\return The strategy value
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - Feb, 2017
+// Function: FileCreatPropList::getFileSpaceStrategy
+///\brief Returns the strategy that the library uses in managing file space.
+///\return The strategy value
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
H5F_file_space_type_t FileCreatPropList::getFileSpaceStrategy() const
{
- H5F_file_space_type_t strategy = H5F_FILE_SPACE_ALL;
- herr_t ret_value = H5Pget_file_space(id, &strategy, NULL);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::getFileSpaceStrategy",
- "H5Pget_file_space for strategy failed");
- }
- return(strategy);
+ H5F_file_space_type_t strategy = H5F_FILE_SPACE_ALL;
+ herr_t ret_value = H5Pget_file_space(id, &strategy, NULL);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileCreatPropList::getFileSpaceStrategy",
+ "H5Pget_file_space for strategy failed");
+ }
+ return(strategy);
}
//--------------------------------------------------------------------------
-// Function: FileCreatPropList::getFileSpaceThreshold
-///\brief Returns the threshold value that the library uses in tracking
-/// free space sections.
-///\return The threshold value
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - Feb, 2017
+// Function: FileCreatPropList::getFileSpaceThreshold
+///\brief Returns the threshold value that the library uses in tracking
+/// free space sections.
+///\return The threshold value
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
hsize_t FileCreatPropList::getFileSpaceThreshold() const
{
- hsize_t threshold = 0;
- herr_t ret_value = H5Pget_file_space(id, NULL, &threshold);
- if (ret_value < 0)
- {
- throw PropListIException("FileCreatPropList::getFileSpaceThreshold",
- "H5Pget_file_space for threshold failed");
- }
- return(threshold);
+ hsize_t threshold = 0;
+ herr_t ret_value = H5Pget_file_space(id, NULL, &threshold);
+ if (ret_value < 0)
+ {
+ throw PropListIException("FileCreatPropList::getFileSpaceThreshold",
+ "H5Pget_file_space for threshold failed");
+ }
+ return(threshold);
}
//--------------------------------------------------------------------------
-// Function: FileCreatPropList destructor
-///\brief Noop destructor.
-// Programmer Binh-Minh Ribler - 2000
+// Function: FileCreatPropList destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
FileCreatPropList::~FileCreatPropList() {}
diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h
index cadff8b..1bbaabf 100644
--- a/c++/src/H5FcreatProp.h
+++ b/c++/src/H5FcreatProp.h
@@ -27,78 +27,78 @@ namespace H5 {
*/
class H5_DLLCPP FileCreatPropList : public PropList {
public:
- ///\brief Default file creation property list.
- static const FileCreatPropList& DEFAULT;
+ ///\brief Default file creation property list.
+ static const FileCreatPropList& DEFAULT;
- // Creates a file create property list.
- FileCreatPropList();
+ // Creates a file create property list.
+ FileCreatPropList();
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Retrieves version information for various parts of a file.
- void getVersion( unsigned& super, unsigned& freelist, unsigned& stab, unsigned& shhdr ) const;
+ // Retrieves version information for various parts of a file.
+ void getVersion(unsigned& super, unsigned& freelist, unsigned& stab, unsigned& shhdr) const;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Sets the userblock size field of a file creation property list.
- void setUserblock( hsize_t size ) const;
+ // Sets the userblock size field of a file creation property list.
+ void setUserblock(hsize_t size) const;
- // Gets the size of a user block in this file creation property list.
- hsize_t getUserblock() const;
+ // Gets the size of a user block in this file creation property list.
+ hsize_t getUserblock() const;
- // Retrieves the size-of address and size quantities stored in a
- // file according to this file creation property list.
- void getSizes( size_t& sizeof_addr, size_t& sizeof_size ) const;
+ // Retrieves the size-of address and size quantities stored in a
+ // file according to this file creation property list.
+ void getSizes(size_t& sizeof_addr, size_t& sizeof_size) const;
- // Sets file size-of addresses and sizes.
- void setSizes( size_t sizeof_addr = 4, size_t sizeof_size = 4 ) const;
+ // Sets file size-of addresses and sizes.
+ void setSizes(size_t sizeof_addr = 4, size_t sizeof_size = 4) const;
- // Retrieves the size of the symbol table B-tree 1/2 rank and the
- // symbol table leaf node 1/2 size.
- void getSymk( unsigned& int_nodes_k, unsigned& leaf_nodes_k ) const;
+ // Retrieves the size of the symbol table B-tree 1/2 rank and the
+ // symbol table leaf node 1/2 size.
+ void getSymk(unsigned& int_nodes_k, unsigned& leaf_nodes_k) const;
- // Sets the size of parameters used to control the symbol table nodes.
- void setSymk( unsigned int_nodes_k, unsigned leaf_nodes_k ) const;
+ // Sets the size of parameters used to control the symbol table nodes.
+ void setSymk(unsigned int_nodes_k, unsigned leaf_nodes_k) const;
- // Returns the 1/2 rank of an indexed storage B-tree.
- unsigned getIstorek() const;
+ // Returns the 1/2 rank of an indexed storage B-tree.
+ unsigned getIstorek() const;
- // Sets the size of parameter used to control the B-trees for
- // indexing chunked datasets.
- void setIstorek( unsigned ik ) const;
+ // Sets the size of parameter used to control the B-trees for
+ // indexing chunked datasets.
+ void setIstorek(unsigned ik) const;
- // Sets the strategy and the threshold value that the library will
- // will employ in managing file space.
- void setFileSpace(H5F_file_space_type_t strategy, hsize_t threshold) const;
+ // Sets the strategy and the threshold value that the library will
+ // will employ in managing file space.
+ void setFileSpace(H5F_file_space_type_t strategy, hsize_t threshold) const;
- // Returns the strategy that the library uses in managing file space.
- H5F_file_space_type_t getFileSpaceStrategy() const;
+ // Returns the strategy that the library uses in managing file space.
+ H5F_file_space_type_t getFileSpaceStrategy() const;
- // Returns the threshold value that the library uses in tracking free
- // space sections.
- hsize_t getFileSpaceThreshold() const;
+ // Returns the threshold value that the library uses in tracking free
+ // space sections.
+ hsize_t getFileSpaceThreshold() const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("FileCreatPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass() const { return("FileCreatPropList"); }
- // Copy constructor: creates a copy of a FileCreatPropList object.
- FileCreatPropList(const FileCreatPropList& orig);
+ // Copy constructor: creates a copy of a FileCreatPropList object.
+ FileCreatPropList(const FileCreatPropList& orig);
- // Creates a copy of an existing file create property list
- // using the property list id.
- FileCreatPropList (const hid_t plist_id);
+ // Creates a copy of an existing file create property list
+ // using the property list id.
+ FileCreatPropList(const hid_t plist_id);
- // Noop destructor
- virtual ~FileCreatPropList();
+ // Noop destructor
+ virtual ~FileCreatPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the global constant, should only be used by the library
- static void deleteConstants();
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
private:
- static FileCreatPropList* DEFAULT_;
+ static FileCreatPropList* DEFAULT_;
- // Creates the global constant, should only be used by the library
- static FileCreatPropList* getConstant();
+ // Creates the global constant, should only be used by the library
+ static FileCreatPropList* getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index cd97025..cdb5837 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -46,43 +46,43 @@ namespace H5 {
//--------------------------------------------------------------------------
// Function H5File default constructor
-///\brief Default constructor: creates a stub H5File object.
-// Programmer Binh-Minh Ribler - 2000
+///\brief Default constructor: creates a stub H5File object.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5File::H5File() : Group(), id(H5I_INVALID_HID) {}
//--------------------------------------------------------------------------
-// Function: H5File overloaded constructor
-///\brief Creates or opens an HDF5 file depending on the parameter flags.
-///\param name - IN: Name of the file
-///\param flags - IN: File access flags
-///\param create_plist - IN: File creation property list, used when
-/// modifying default file meta-data. Default to
-/// FileCreatPropList::DEFAULT
-///\param access_plist - IN: File access property list. Default to
-/// FileAccPropList::DEFAULT
+// Function: H5File overloaded constructor
+///\brief Creates or opens an HDF5 file depending on the parameter flags.
+///\param name - IN: Name of the file
+///\param flags - IN: File access flags
+///\param create_plist - IN: File creation property list, used when
+/// modifying default file meta-data. Default to
+/// FileCreatPropList::DEFAULT
+///\param access_plist - IN: File access property list. Default to
+/// FileAccPropList::DEFAULT
///\par Description
-/// Valid values of \a flags include:
-/// \li \c H5F_ACC_TRUNC - Truncate file, if it already exists,
-/// erasing all data previously stored in
-/// the file.
-/// \li \c H5F_ACC_EXCL - Fail if file already exists.
-/// \c H5F_ACC_TRUNC and \c H5F_ACC_EXCL are mutually exclusive
-/// \li \c H5F_ACC_RDONLY - Open file as read-only, if it already
-/// exists, and fail, otherwise
-/// \li \c H5F_ACC_RDWR - Open file for read/write, if it already
-/// exists, and fail, otherwise
+/// Valid values of \a flags include:
+/// \li \c H5F_ACC_TRUNC - Truncate file, if it already exists,
+/// erasing all data previously stored in
+/// the file.
+/// \li \c H5F_ACC_EXCL - Fail if file already exists.
+/// \c H5F_ACC_TRUNC and \c H5F_ACC_EXCL are mutually exclusive
+/// \li \c H5F_ACC_RDONLY - Open file as read-only, if it already
+/// exists, and fail, otherwise
+/// \li \c H5F_ACC_RDWR - Open file for read/write, if it already
+/// exists, and fail, otherwise
///\par
-/// For info on file creation in the case of an already-open file,
-/// please refer to the \b Special \b case section in the C layer
-/// Reference Manual at:
+/// For info on file creation in the case of an already-open file,
+/// please refer to the \b Special \b case section in the C layer
+/// Reference Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Create
// Notes With a PGI compiler (~2012-2013), the exception thrown by p_get_file
-// could not be caught in the applications. Added try block here
-// to catch then re-throw it. -BMR 2013/03/21
-// Programmer Binh-Minh Ribler - 2000
+// could not be caught in the applications. Added try block here
+// to catch then re-throw it. -BMR 2013/03/21
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : Group(), id(H5I_INVALID_HID)
+H5File::H5File(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist) : Group(), id(H5I_INVALID_HID)
{
try {
p_get_file(name, flags, create_plist, access_plist);
@@ -92,22 +92,22 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c
}
//--------------------------------------------------------------------------
-// Function: H5File overloaded constructor
-///\brief This is another overloaded constructor. It differs from the
-/// above constructor only in the type of the \a name argument.
-///\param name - IN: Name of the file - \c H5std_string
-///\param flags - IN: File access flags
-///\param create_plist - IN: File creation property list, used when
-/// modifying default file meta-data. Default to
-/// FileCreatPropList::DEFAULT
-///\param access_plist - IN: File access property list. Default to
-/// FileAccPropList::DEFAULT
+// Function: H5File overloaded constructor
+///\brief This is another overloaded constructor. It differs from the
+/// above constructor only in the type of the \a name argument.
+///\param name - IN: Name of the file - \c H5std_string
+///\param flags - IN: File access flags
+///\param create_plist - IN: File creation property list, used when
+/// modifying default file meta-data. Default to
+/// FileCreatPropList::DEFAULT
+///\param access_plist - IN: File access property list. Default to
+/// FileAccPropList::DEFAULT
// Notes With a PGI compiler (~2012-2013), the exception thrown by p_get_file
-// could not be caught in the applications. Added try block here
-// to catch then re-throw it. -BMR 2013/03/21
-// Programmer Binh-Minh Ribler - 2000
+// could not be caught in the applications. Added try block here
+// to catch then re-throw it. -BMR 2013/03/21
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : Group(), id(H5I_INVALID_HID)
+H5File::H5File(const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist) : Group(), id(H5I_INVALID_HID)
{
try {
p_get_file(name.c_str(), flags, create_plist, access_plist);
@@ -120,21 +120,21 @@ H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPro
//--------------------------------------------------------------------------
// This function is private and contains common code between the
// constructors taking a string or a char*
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// - removed H5F_ACC_CREAT because H5Fcreate will fail with
-// H5F_ACC_CREAT. - BMR, Sep 17, 2014
+// - removed H5F_ACC_CREAT because H5Fcreate will fail with
+// H5F_ACC_CREAT. - BMR, Sep 17, 2014
//--------------------------------------------------------------------------
void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist)
{
// These bits only set for creation, so if any of them are set,
// create the file.
- if( flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC))
+ if (flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC))
{
hid_t create_plist_id = create_plist.getId();
hid_t access_plist_id = access_plist.getId();
- id = H5Fcreate( name, flags, create_plist_id, access_plist_id );
- if( id < 0 ) // throw an exception when open/create fail
+ id = H5Fcreate(name, flags, create_plist_id, access_plist_id);
+ if (id < 0) // throw an exception when open/create fail
{
throw FileIException("H5File constructor", "H5Fcreate failed");
}
@@ -143,8 +143,8 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro
else
{
hid_t access_plist_id = access_plist.getId();
- id = H5Fopen( name, flags, access_plist_id );
- if( id < 0 ) // throw an exception when open/create fail
+ id = H5Fopen(name, flags, access_plist_id);
+ if (id < 0) // throw an exception when open/create fail
{
throw FileIException("H5File constructor", "H5Fopen failed");
}
@@ -152,17 +152,17 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro
}
//--------------------------------------------------------------------------
-// Function: H5File overloaded constructor
-///\brief Creates an H5File object using an existing file id.
-///\param existing_id - IN: Id of an existing file
-// Programmer Binh-Minh Ribler - 2015
+// Function: H5File overloaded constructor
+///\brief Creates an H5File object using an existing file id.
+///\param existing_id - IN: Id of an existing file
+// Programmer Binh-Minh Ribler - 2015
// Description
// Mar 29, 2015
-// Added in responding to a request from user Jason Newton.
-// However, it is not recommended to use the private member "id"
-// in applications. Unlike other situations, where similar
-// constructor is needed by the library in order to return
-// an object, H5File doesn't need it. -BMR (HDFFV-8766 partially)
+// Added in responding to a request from user Jason Newton.
+// However, it is not recommended to use the private member "id"
+// in applications. Unlike other situations, where similar
+// constructor is needed by the library in order to return
+// an object, H5File doesn't need it. -BMR (HDFFV-8766 partially)
//--------------------------------------------------------------------------
H5File::H5File(hid_t existing_id) : Group()
{
@@ -173,11 +173,11 @@ H5File::H5File(hid_t existing_id) : Group()
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5File copy constructor
-///\brief Copy constructor: makes a copy of the original
-/// H5File object.
-///\param original - IN: H5File instance to copy
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5File copy constructor
+///\brief Copy constructor: makes a copy of the original
+/// H5File object.
+///\param original - IN: H5File instance to copy
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5File::H5File(const H5File& original) : Group()
{
@@ -186,57 +186,57 @@ H5File::H5File(const H5File& original) : Group()
}
//--------------------------------------------------------------------------
-// Function: H5File::isHdf5 (static)
-///\brief Determines whether a file in HDF5 format. (Static)
-///\param name - IN: Name of the file
-///\return true if the file is in HDF5 format, and false, otherwise
-///\exception H5::FileIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5File::isHdf5 (static)
+///\brief Determines whether a file in HDF5 format. (Static)
+///\param name - IN: Name of the file
+///\return true if the file is in HDF5 format, and false, otherwise
+///\exception H5::FileIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
bool H5File::isHdf5(const char* name)
{
- // Calls C routine H5Fis_hdf5 to determine whether the file is in
- // HDF5 format. It returns positive value, 0, or negative value
- htri_t ret_value = H5Fis_hdf5( name );
- if( ret_value > 0 )
- return true;
- else if( ret_value == 0 )
- return false;
- else // Raise exception when H5Fis_hdf5 returns a negative value
- {
- throw FileIException("H5File::isHdf5", "H5Fis_hdf5 returned negative value");
- }
+ // Calls C routine H5Fis_hdf5 to determine whether the file is in
+ // HDF5 format. It returns positive value, 0, or negative value
+ htri_t ret_value = H5Fis_hdf5(name);
+ if (ret_value > 0)
+ return true;
+ else if (ret_value == 0)
+ return false;
+ else // Raise exception when H5Fis_hdf5 returns a negative value
+ {
+ throw FileIException("H5File::isHdf5", "H5Fis_hdf5 returned negative value");
+ }
}
//--------------------------------------------------------------------------
-// Function: H5File::isHdf5 (static)
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes an \c H5std_string for \a name. (Static)
-///\param name - IN: Name of the file - \c H5std_string
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5File::isHdf5 (static)
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes an \c H5std_string for \a name. (Static)
+///\param name - IN: Name of the file - \c H5std_string
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-bool H5File::isHdf5(const H5std_string& name )
+bool H5File::isHdf5(const H5std_string& name)
{
- return( isHdf5( name.c_str()) );
+ return(isHdf5( name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: openFile
-///\brief Opens an HDF5 file
-///\param name - IN: Name of the file
-///\param flags - IN: File access flags
-///\param access_plist - IN: File access property list. Default to
-/// FileAccPropList::DEFAULT
+// Function: openFile
+///\brief Opens an HDF5 file
+///\param name - IN: Name of the file
+///\param flags - IN: File access flags
+///\param access_plist - IN: File access property list. Default to
+/// FileAccPropList::DEFAULT
///\par Description
-/// Valid values of \a flags include:
-/// H5F_ACC_RDWR: Open with read/write access. If the file is
-/// currently open for read-only access then it
-/// will be reopened. Absence of this flag
-/// implies read-only access.
+/// Valid values of \a flags include:
+/// H5F_ACC_RDWR: Open with read/write access. If the file is
+/// currently open for read-only access then it
+/// will be reopened. Absence of this flag
+/// implies read-only access.
///
-/// H5F_ACC_RDONLY: Open with read only access. - default
+/// H5F_ACC_RDONLY: Open with read only access. - default
///
-// Programmer Binh-Minh Ribler - Oct, 2005
+// Programmer Binh-Minh Ribler - Oct, 2005
//--------------------------------------------------------------------------
void H5File::openFile(const char* name, unsigned int flags, const FileAccPropList& access_plist)
{
@@ -256,14 +256,14 @@ void H5File::openFile(const char* name, unsigned int flags, const FileAccPropLis
}
//--------------------------------------------------------------------------
-// Function: H5File::openFile
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes an \c H5std_string for \a name.
-///\param name - IN: Name of the file - \c H5std_string
-///\param flags - IN: File access flags
-///\param access_plist - IN: File access property list. Default to
-/// FileAccPropList::DEFAULT
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5File::openFile
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes an \c H5std_string for \a name.
+///\param name - IN: Name of the file - \c H5std_string
+///\param flags - IN: File access flags
+///\param access_plist - IN: File access property list. Default to
+/// FileAccPropList::DEFAULT
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void H5File::openFile(const H5std_string& name, unsigned int flags, const FileAccPropList& access_plist)
{
@@ -271,21 +271,21 @@ void H5File::openFile(const H5std_string& name, unsigned int flags, const FileAc
}
//--------------------------------------------------------------------------
-// Function: H5File::reOpen
-///\brief Reopens this file.
+// Function: H5File::reOpen
+///\brief Reopens this file.
///
-///\exception H5::FileIException
+///\exception H5::FileIException
// Description
-// If this object has represented another HDF5 file, the previous
-// HDF5 file need to be closed first.
-// Programmer Binh-Minh Ribler - 2000
+// If this object has represented another HDF5 file, the previous
+// HDF5 file need to be closed first.
+// Programmer Binh-Minh Ribler - 2000
// Note: This wrapper doesn't seem right regarding the 'id' and should
// be investigated. BMR - 2/20/2005
// Modification
-// - Replaced resetIdComponent() with decRefCount() to use C
-// library ID reference counting mechanism - BMR, Feb 20, 2005
-// - 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, Feb 20, 2005
+// - Replaced decRefCount with close() to let the C library
+// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
void H5File::reOpen()
{
@@ -296,148 +296,148 @@ void H5File::reOpen()
throw FileIException("H5File::reOpen", close_error.getDetailMsg());
}
- // call C routine to reopen the file - Note: not sure about this,
- // which id to be the parameter when closing?
- id = H5Freopen( id );
- if( id < 0 ) // Raise exception when H5Freopen returns a neg value
- throw FileIException("H5File::reOpen", "H5Freopen failed");
+ // call C routine to reopen the file - Note: not sure about this,
+ // which id to be the parameter when closing?
+ id = H5Freopen(id);
+ if (id < 0) // Raise exception when H5Freopen returns a neg value
+ throw FileIException("H5File::reOpen", "H5Freopen failed");
}
//--------------------------------------------------------------------------
-// Function: H5File::getCreatePlist
-///\brief Returns the creation property list of this file
-///\return FileCreatPropList object
-///\exception H5::FileIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5File::getCreatePlist
+///\brief Returns the creation property list of this file
+///\return FileCreatPropList object
+///\exception H5::FileIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
FileCreatPropList H5File::getCreatePlist() const
{
- hid_t create_plist_id = H5Fget_create_plist( id );
-
- // if H5Fget_create_plist returns a valid id, create and return
- // the FileCreatPropList object for this property list
- if( create_plist_id > 0 )
- {
- FileCreatPropList create_plist( create_plist_id );
- return( create_plist );
- }
- else
- {
- throw FileIException("H5File::getCreatePlist", "H5Fget_create_plist failed");
- }
+ hid_t create_plist_id = H5Fget_create_plist(id);
+
+ // if H5Fget_create_plist returns a valid id, create and return
+ // the FileCreatPropList object for this property list
+ if (create_plist_id > 0)
+ {
+ FileCreatPropList create_plist(create_plist_id);
+ return(create_plist);
+ }
+ else
+ {
+ throw FileIException("H5File::getCreatePlist", "H5Fget_create_plist failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: H5File::getAccessPlist
-///\brief Returns the access property list of this file
-///\return FileAccPropList object
-///\exception H5::FileIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5File::getAccessPlist
+///\brief Returns the access property list of this file
+///\return FileAccPropList object
+///\exception H5::FileIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
FileAccPropList H5File::getAccessPlist() const
{
- hid_t access_plist_id = H5Fget_access_plist( id );
+ hid_t access_plist_id = H5Fget_access_plist(id);
- // if H5Fget_access_plist returns a valid id, create and return
- // the FileAccPropList object for this property list
- if( access_plist_id > 0 )
- {
- FileAccPropList access_plist( access_plist_id );
+ // if H5Fget_access_plist returns a valid id, create and return
+ // the FileAccPropList object for this property list
+ if (access_plist_id > 0)
+ {
+ FileAccPropList access_plist(access_plist_id);
return access_plist;
- }
- else // Raise an exception
- {
- throw FileIException("H5File::getAccessPlist", "H5Fget_access_plist failed");
- }
+ }
+ else // Raise an exception
+ {
+ throw FileIException("H5File::getAccessPlist", "H5Fget_access_plist failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: H5File::getFileInfo
-///\brief Retrieves the general information of this file.
+// Function: H5File::getFileInfo
+///\brief Retrieves the general information of this file.
///
-///\exception H5::FileIException
+///\exception H5::FileIException
///\par Description
-/// The retrieved information may include information about
-/// superblock extension, free space management, and shared object
+/// The retrieved information may include information about
+/// superblock extension, free space management, and shared object
// Programmer Binh-Minh Ribler - February 2017
//--------------------------------------------------------------------------
void H5File::getFileInfo(H5F_info2_t& file_info) const
{
- herr_t ret_value = H5Fget_info2(id, &file_info);
- if (ret_value < 0)
- {
- throw FileIException("H5File::getFileInfo", "H5Fget_info2 failed");
- }
+ herr_t ret_value = H5Fget_info2(id, &file_info);
+ if (ret_value < 0)
+ {
+ throw FileIException("H5File::getFileInfo", "H5Fget_info2 failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: H5File::getFreeSpace
-///\brief Returns the amount of free space in the file.
-///\return Amount of free space
-///\exception H5::FileIException
+// Function: H5File::getFreeSpace
+///\brief Returns the amount of free space in the file.
+///\return Amount of free space
+///\exception H5::FileIException
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
hssize_t H5File::getFreeSpace() const
{
- hssize_t free_space = H5Fget_freespace(id);
- if( free_space < 0 )
- {
- throw FileIException("H5File::getFreeSpace", "H5Fget_freespace failed");
- }
- return (free_space);
+ hssize_t free_space = H5Fget_freespace(id);
+ if (free_space < 0)
+ {
+ throw FileIException("H5File::getFreeSpace", "H5Fget_freespace failed");
+ }
+ return (free_space);
}
//--------------------------------------------------------------------------
-// Function: H5File::getObjCount
-///\brief Returns the number of opened object IDs (files, datasets,
-/// groups and datatypes) in the same file.
-///\param types - Type of object to retrieve the count
-///\return Number of opened object IDs
-///\exception H5::FileIException
+// Function: H5File::getObjCount
+///\brief Returns the number of opened object IDs (files, datasets,
+/// groups and datatypes) in the same file.
+///\param types - Type of object to retrieve the count
+///\return Number of opened object IDs
+///\exception H5::FileIException
///\par Description
-/// The valid values for \a types include:
-/// \li \c H5F_OBJ_FILE - Files only
-/// \li \c H5F_OBJ_DATASET - Datasets only
-/// \li \c H5F_OBJ_GROUP - Groups only
-/// \li \c H5F_OBJ_DATATYPE - Named datatypes only
-/// \li \c H5F_OBJ_ATTR - Attributes only
-/// \li \c H5F_OBJ_ALL - All of the above, i.e., \c H5F_OBJ_FILE
-/// | \c H5F_OBJ_DATASET | \c H5F_OBJ_GROUP
-/// | \c H5F_OBJ_DATATYPE | \c H5F_OBJ_ATTR
+/// The valid values for \a types include:
+/// \li \c H5F_OBJ_FILE - Files only
+/// \li \c H5F_OBJ_DATASET - Datasets only
+/// \li \c H5F_OBJ_GROUP - Groups only
+/// \li \c H5F_OBJ_DATATYPE - Named datatypes only
+/// \li \c H5F_OBJ_ATTR - Attributes only
+/// \li \c H5F_OBJ_ALL - All of the above, i.e., \c H5F_OBJ_FILE
+/// | \c H5F_OBJ_DATASET | \c H5F_OBJ_GROUP
+/// | \c H5F_OBJ_DATATYPE | \c H5F_OBJ_ATTR
///\par
/// Multiple object types can be combined with the logical OR operator (|).
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
ssize_t H5File::getObjCount(unsigned types) const
{
- ssize_t num_objs = H5Fget_obj_count(id, types);
- if( num_objs < 0 )
- {
- throw FileIException("H5File::getObjCount", "H5Fget_obj_count failed");
- }
- return (num_objs);
+ ssize_t num_objs = H5Fget_obj_count(id, types);
+ if (num_objs < 0)
+ {
+ throw FileIException("H5File::getObjCount", "H5Fget_obj_count failed");
+ }
+ return (num_objs);
}
//--------------------------------------------------------------------------
-// Function: H5File::getObjIDs
-///\brief Retrieves a list of opened object IDs (files, datasets,
-/// groups and datatypes) in the same file.
-///\param types - Type of object to retrieve the count
-///\param max_objs - Maximum number of object identifiers to place
-/// into obj_id_list.
-///\param oid_list - List of open object identifiers
-///\exception H5::FileIException
+// Function: H5File::getObjIDs
+///\brief Retrieves a list of opened object IDs (files, datasets,
+/// groups and datatypes) in the same file.
+///\param types - Type of object to retrieve the count
+///\param max_objs - Maximum number of object identifiers to place
+/// into obj_id_list.
+///\param oid_list - List of open object identifiers
+///\exception H5::FileIException
///\par Description
-/// The valid values for \a types include:
-/// \li \c H5F_OBJ_FILE - Files only
-/// \li \c H5F_OBJ_DATASET - Datasets only
-/// \li \c H5F_OBJ_GROUP - Groups only
-/// \li \c H5F_OBJ_DATATYPE - Named datatypes only
-/// \li \c H5F_OBJ_ATTR - Attributes only
-/// \li \c H5F_OBJ_ALL - All of the above, i.e., \c H5F_OBJ_FILE
-/// | \c H5F_OBJ_DATASET | \c H5F_OBJ_GROUP
-/// | \c H5F_OBJ_DATATYPE | \c H5F_OBJ_ATTR
+/// The valid values for \a types include:
+/// \li \c H5F_OBJ_FILE - Files only
+/// \li \c H5F_OBJ_DATASET - Datasets only
+/// \li \c H5F_OBJ_GROUP - Groups only
+/// \li \c H5F_OBJ_DATATYPE - Named datatypes only
+/// \li \c H5F_OBJ_ATTR - Attributes only
+/// \li \c H5F_OBJ_ALL - All of the above, i.e., \c H5F_OBJ_FILE
+/// | \c H5F_OBJ_DATASET | \c H5F_OBJ_GROUP
+/// | \c H5F_OBJ_DATATYPE | \c H5F_OBJ_ATTR
///\par
/// Multiple object types can be combined with the logical OR operator (|).
//
@@ -446,56 +446,56 @@ ssize_t H5File::getObjCount(unsigned types) const
//--------------------------------------------------------------------------
void H5File::getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const
{
- ssize_t ret_value = H5Fget_obj_ids(id, types, max_objs, oid_list);
- if( ret_value < 0 )
- {
- throw FileIException("H5File::getObjIDs", "H5Fget_obj_ids failed");
- }
+ ssize_t ret_value = H5Fget_obj_ids(id, types, max_objs, oid_list);
+ if (ret_value < 0)
+ {
+ throw FileIException("H5File::getObjIDs", "H5Fget_obj_ids failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: H5File::getVFDHandle
-///\brief Returns the pointer to the file handle of the low-level file
-/// driver.
-///\param fapl - File access property list
-///\param file_handle - Pointer to the file handle being used by
-/// the low-level virtual file driver
-///\exception H5::FileIException
+// Function: H5File::getVFDHandle
+///\brief Returns the pointer to the file handle of the low-level file
+/// driver.
+///\param fapl - File access property list
+///\param file_handle - Pointer to the file handle being used by
+/// the low-level virtual file driver
+///\exception H5::FileIException
///\par Description
-/// For the \c FAMILY or \c MULTI drivers, \a fapl should be
-/// defined through the property list functions:
-/// \c FileAccPropList::setFamilyOffset for the \c FAMILY driver
-/// and \c FileAccPropList::setMultiType for the \c MULTI driver.
+/// For the \c FAMILY or \c MULTI drivers, \a fapl should be
+/// defined through the property list functions:
+/// \c FileAccPropList::setFamilyOffset for the \c FAMILY driver
+/// and \c FileAccPropList::setMultiType for the \c MULTI driver.
///
-/// The obtained file handle is dynamic and is valid only while
-/// the file remains open; it will be invalid if the file is
-/// closed and reopened or opened during a subsequent session.
+/// The obtained file handle is dynamic and is valid only while
+/// the file remains open; it will be invalid if the file is
+/// closed and reopened or opened during a subsequent session.
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
void H5File::getVFDHandle(const FileAccPropList& fapl, void **file_handle) const
{
- hid_t fapl_id = fapl.getId();
- herr_t ret_value = H5Fget_vfd_handle(id, fapl_id, file_handle);
- if( ret_value < 0 )
- {
- throw FileIException("H5File::getVFDHandle", "H5Fget_vfd_handle failed");
- }
+ hid_t fapl_id = fapl.getId();
+ herr_t ret_value = H5Fget_vfd_handle(id, fapl_id, file_handle);
+ if (ret_value < 0)
+ {
+ throw FileIException("H5File::getVFDHandle", "H5Fget_vfd_handle failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: H5File::getVFDHandle
-// 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.
+// Function: H5File::getVFDHandle
+// 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 fapl - File access property list
// Param file_handle - Pointer to the file handle being used by
-// the low-level virtual file driver
+// the low-level virtual file driver
// Exception H5::FileIException
// Programmer Binh-Minh Ribler - May 2004
// Modification
-// Planned for removal. -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
+// Planned for removal. -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 H5File::getVFDHandle(FileAccPropList& fapl, void **file_handle) const
//{
@@ -503,103 +503,103 @@ void H5File::getVFDHandle(const FileAccPropList& fapl, void **file_handle) const
//}
//--------------------------------------------------------------------------
-// Function: H5File::getVFDHandle
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in what arguments it
-/// accepts.
-///\param file_handle - Pointer to the file handle being used by
-/// the low-level virtual file driver
-///\exception H5::FileIException
+// Function: H5File::getVFDHandle
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts.
+///\param file_handle - Pointer to the file handle being used by
+/// the low-level virtual file driver
+///\exception H5::FileIException
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
void H5File::getVFDHandle(void **file_handle) const
{
- herr_t ret_value = H5Fget_vfd_handle(id, H5P_DEFAULT, file_handle);
- if( ret_value < 0 )
- {
- throw FileIException("H5File::getVFDHandle", "H5Fget_vfd_handle failed");
- }
+ herr_t ret_value = H5Fget_vfd_handle(id, H5P_DEFAULT, file_handle);
+ if (ret_value < 0)
+ {
+ throw FileIException("H5File::getVFDHandle", "H5Fget_vfd_handle failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: H5File::getFileSize
-///\brief Returns the file size of the HDF5 file.
-///\return File size
-///\exception H5::FileIException
+// Function: H5File::getFileSize
+///\brief Returns the file size of the HDF5 file.
+///\return File size
+///\exception H5::FileIException
///\par Description
-/// This function is called after an existing file is opened in
-/// order to learn the true size of the underlying file.
+/// This function is called after an existing file is opened in
+/// order to learn the true size of the underlying file.
// Programmer Raymond Lu - June 24, 2004
//--------------------------------------------------------------------------
hsize_t H5File::getFileSize() const
{
- hsize_t file_size;
- herr_t ret_value = H5Fget_filesize(id, &file_size);
- if (ret_value < 0)
- {
- throw FileIException("H5File::getFileSize", "H5Fget_filesize failed");
- }
- return (file_size);
+ hsize_t file_size;
+ herr_t ret_value = H5Fget_filesize(id, &file_size);
+ if (ret_value < 0)
+ {
+ throw FileIException("H5File::getFileSize", "H5Fget_filesize failed");
+ }
+ return (file_size);
}
//--------------------------------------------------------------------------
-// Function: H5File::getId
-///\brief Get the id of this file
-///\return File identifier
-// Modification:
+// Function: H5File::getId
+///\brief Get the id of this file
+///\return File identifier
+// Modification
// May 2008 - BMR
-// Class hierarchy is revised to address bugzilla 1068. Class
-// AbstractDS and Attribute are moved out of H5Object. In
-// addition, member IdComponent::id is moved into subclasses, and
-// IdComponent::getId now becomes pure virtual function.
-// Programmer Binh-Minh Ribler - May, 2008
+// Class hierarchy is revised to address bugzilla 1068. Class
+// AbstractDS and Attribute are moved out of H5Object. In
+// addition, member IdComponent::id is moved into subclasses, and
+// IdComponent::getId now becomes pure virtual function.
+// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
hid_t H5File::getId() const
{
- return(id);
+ return(id);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5File::reopen
-// Purpose: Reopens this file.
+// Function: H5File::reopen
+// Purpose Reopens this file.
// Exception H5::FileIException
// Description
-// This function is replaced by the above function reOpen.
-// Programmer Binh-Minh Ribler - 2000
+// This function is replaced by the above function reOpen.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void H5File::reopen()
{
- H5File::reOpen();
+ H5File::reOpen();
}
//--------------------------------------------------------------------------
-// Function: H5File::getLocId
-// Purpose: Get the id of this file
+// Function: H5File::getLocId
+// Purpose Get the id of this file
// Description
-// This function is a redefinition of CommonFG::getLocId. It
-// is used by CommonFG member functions to get the file id.
-// Programmer Binh-Minh Ribler - 2000
+// This function is a redefinition of CommonFG::getLocId. It
+// is used by CommonFG member functions to get the file id.
+// Programmer Binh-Minh Ribler - 2000
// Deprecated:
// After HDFFV-9920, the Group's methods can use getId() and getLocId()
// is kept for backward compatibility. Aug 18, 2016 -BMR
//--------------------------------------------------------------------------
hid_t H5File::getLocId() const
{
- return( getId() );
+ return(getId());
}
//--------------------------------------------------------------------------
-// Function: H5File::p_setId (protected)
-///\brief Sets the identifier of this object to a new value.
+// Function: H5File::p_setId (protected)
+///\brief Sets the identifier of this object to a new value.
///
-///\exception H5::IdComponentException when the attempt to close the HDF5
-/// object fails
-// Description:
-// The underlaying reference counting in the C library ensures
-// that the current valid id of this object is properly closed.
-// Then the object's id is reset to the new id.
-// Programmer Binh-Minh Ribler - 2000
+///\exception H5::IdComponentException when the attempt to close the HDF5
+/// object fails
+// Description
+// The underlaying reference counting in the C library ensures
+// that the current valid id of this object is properly closed.
+// Then the object's id is reset to the new id.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void H5File::p_setId(const hid_t new_id)
{
@@ -610,24 +610,24 @@ void H5File::p_setId(const hid_t new_id)
catch (Exception& E) {
throw FileIException("H5File::p_setId", E.getDetailMsg());
}
- // reset object's id to the given id
- id = new_id;
+ // reset object's id to the given id
+ id = new_id;
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5File::close
-///\brief Closes this HDF5 file.
+// Function: H5File::close
+///\brief Closes this HDF5 file.
///
-///\exception H5::FileIException
-// Programmer Binh-Minh Ribler - Mar 9, 2005
+///\exception H5::FileIException
+// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
void H5File::close()
{
if (p_valid_id(id))
{
- herr_t ret_value = H5Fclose( id );
- if( ret_value < 0 )
+ herr_t ret_value = H5Fclose(id);
+ if (ret_value < 0)
{
throw FileIException("H5File::close", "H5Fclose failed");
}
@@ -637,34 +637,34 @@ void H5File::close()
}
//--------------------------------------------------------------------------
-// Function: H5File::throwException
-///\brief Throws file exception - initially implemented for CommonFG
-///\param func_name - Name of the function where failure occurs
-///\param msg - Message describing the failure
-///\exception H5::FileIException
+// Function: H5File::throwException
+///\brief Throws file exception - initially implemented for CommonFG
+///\param func_name - Name of the function where failure occurs
+///\param msg - Message describing the failure
+///\exception H5::FileIException
// Description
// This function is also used in H5Location implementation so that
-// proper exception can be thrown for file or group. The
-// "H5File::" will be inserted to indicate the function called is
-// an implementation of H5File.
-// Programmer Binh-Minh Ribler - 2000
+// proper exception can be thrown for file or group. The
+// "H5File::" will be inserted to indicate the function called is
+// an implementation of H5File.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void H5File::throwException(const H5std_string& func_name, const H5std_string& msg) const
{
- H5std_string full_name = func_name;
- full_name.insert(0, "H5File::");
- throw FileIException(full_name, msg);
+ H5std_string full_name = func_name;
+ full_name.insert(0, "H5File::");
+ throw FileIException(full_name, msg);
}
//--------------------------------------------------------------------------
-// Function: H5File destructor
-///\brief Properly terminates access to this file.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5File destructor
+///\brief Properly terminates access to this file.
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// - Replaced resetIdComponent() with decRefCount() to use C
-// library ID reference counting mechanism - BMR, Feb 20, 2005
-// - 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, Feb 20, 2005
+// - Replaced decRefCount with close() to let the C library
+// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
H5File::~H5File()
{
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index 495b4d0..5ac9118 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -28,100 +28,100 @@ namespace H5 {
*/
class H5_DLLCPP H5File : public Group {
public:
- // Creates or opens an HDF5 file.
- H5File( const char* name, unsigned int flags,
- const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT,
- const FileAccPropList& access_plist = FileAccPropList::DEFAULT );
- H5File( const H5std_string& name, unsigned int flags,
- const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT,
- const FileAccPropList& access_plist = FileAccPropList::DEFAULT );
+ // Creates or opens an HDF5 file.
+ H5File(const char* name, unsigned int flags,
+ const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT,
+ const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
+ H5File(const H5std_string& name, unsigned int flags,
+ const FileCreatPropList& create_plist = FileCreatPropList::DEFAULT,
+ const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
- // Open the file
- void openFile(const H5std_string& name, unsigned int flags,
- const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
- void openFile(const char* name, unsigned int flags,
- const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
+ // Open the file
+ void openFile(const H5std_string& name, unsigned int flags,
+ const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
+ void openFile(const char* name, unsigned int flags,
+ const FileAccPropList& access_plist = FileAccPropList::DEFAULT);
- // Close this file.
- virtual void close();
+ // Close this file.
+ virtual void close();
- // Gets the access property list of this file.
- FileAccPropList getAccessPlist() const;
+ // Gets the access property list of this file.
+ FileAccPropList getAccessPlist() const;
- // Gets the creation property list of this file.
- FileCreatPropList getCreatePlist() const;
+ // Gets the creation property list of this file.
+ FileCreatPropList getCreatePlist() const;
- // Gets general information about this file.
- void getFileInfo(H5F_info2_t& file_info) const;
+ // Gets general information about this file.
+ void getFileInfo(H5F_info2_t& file_info) const;
- // Returns the amount of free space in the file.
- hssize_t getFreeSpace() const;
+ // Returns the amount of free space in the file.
+ hssize_t getFreeSpace() const;
- // Returns the number of opened object IDs (files, datasets, groups
- // and datatypes) in the same file.
- ssize_t getObjCount(unsigned types = H5F_OBJ_ALL) const;
+ // Returns the number of opened object IDs (files, datasets, groups
+ // and datatypes) in the same file.
+ ssize_t getObjCount(unsigned types = H5F_OBJ_ALL) const;
- // Retrieves a list of opened object IDs (files, datasets, groups
- // and datatypes) in the same file.
- void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const;
+ // Retrieves a list of opened object IDs (files, datasets, groups
+ // and datatypes) in the same file.
+ void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const;
- // Returns the pointer to the file handle of the low-level file driver.
- void getVFDHandle(void **file_handle) const;
- void getVFDHandle(const FileAccPropList& fapl, void **file_handle) const;
- //void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // removed from 1.8.18 and 1.10.1
+ // Returns the pointer to the file handle of the low-level file driver.
+ void getVFDHandle(void **file_handle) const;
+ void getVFDHandle(const FileAccPropList& fapl, void **file_handle) const;
+ //void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // removed from 1.8.18 and 1.10.1
- // Returns the file size of the HDF5 file.
- hsize_t getFileSize() const;
+ // Returns the file size of the HDF5 file.
+ hsize_t getFileSize() const;
- // Determines if a file, specified by its name, is in HDF5 format
- static bool isHdf5(const char* name );
- static bool isHdf5(const H5std_string& name );
+ // Determines if a file, specified by its name, is in HDF5 format
+ static bool isHdf5(const char* name);
+ static bool isHdf5(const H5std_string& name);
- // Reopens this file.
- void reOpen(); // added for better name
+ // Reopens this file.
+ void reOpen(); // added for better name
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- void reopen(); // obsolete in favor of reOpen()
+ void reopen(); // obsolete in favor of reOpen()
- // Creates an H5File using an existing file id. Not recommended
- // in applications.
- H5File(hid_t existing_id);
+ // Creates an H5File using an existing file id. Not recommended
+ // in applications.
+ H5File(hid_t existing_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("H5File"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("H5File"); }
- // Throw file exception.
- virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
+ // Throw file exception.
+ virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
- // for CommonFG to get the file id.
- virtual hid_t getLocId() const;
+ // for CommonFG to get the file id.
+ virtual hid_t getLocId() const;
- // Default constructor
- H5File();
+ // Default constructor
+ H5File();
- // Copy constructor: makes a copy of the original H5File object.
- H5File(const H5File& original);
+ // Copy constructor: makes a copy of the original H5File object.
+ H5File(const H5File& original);
- // Gets the HDF5 file id.
- virtual hid_t getId() const;
+ // Gets the HDF5 file id.
+ virtual hid_t getId() const;
- // H5File destructor.
- virtual ~H5File();
+ // H5File destructor.
+ virtual ~H5File();
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Sets the HDF5 file id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the HDF5 file id.
+ virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
private:
- hid_t id; // HDF5 file id
+ hid_t id; // HDF5 file id
- // This function is private and contains common code between the
- // constructors taking a string or a char*
- void p_get_file( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist );
+ // This function is private and contains common code between the
+ // constructors taking a string or a char*
+ void p_get_file(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist);
};
}
diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp
index 73e8072..5902cbe 100644
--- a/c++/src/H5FloatType.cpp
+++ b/c++/src/H5FloatType.cpp
@@ -36,73 +36,73 @@
namespace H5 {
//--------------------------------------------------------------------------
-// Function: FloatType default constructor
-///\brief Default constructor: Creates a stub floating-point datatype
-// Programmer Binh-Minh Ribler - 2000
+// Function: FloatType default constructor
+///\brief Default constructor: Creates a stub floating-point datatype
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
FloatType::FloatType() {}
//--------------------------------------------------------------------------
-// Function: FloatType overloaded constructor
-///\brief Creates a floating-point datatype using a predefined type.
-///\param pred_type - IN: Predefined datatype
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: FloatType overloaded constructor
+///\brief Creates a floating-point datatype using a predefined type.
+///\param pred_type - IN: Predefined datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType::FloatType( const PredType& pred_type ) : AtomType()
+FloatType::FloatType(const PredType& pred_type) : AtomType()
{
- // use DataType::copy to make a copy of this predefined type
- copy( pred_type );
+ // use DataType::copy to make a copy of this predefined type
+ copy(pred_type);
}
//--------------------------------------------------------------------------
-// Function: FloatType overloaded constructor
-///\brief Creates an FloatType object using the id of an existing
-/// datatype.
-///\param existing_id - IN: Id of an existing datatype
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: FloatType overloaded constructor
+///\brief Creates an FloatType object using the id of an existing
+/// datatype.
+///\param existing_id - IN: Id of an existing datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType::FloatType( const hid_t existing_id ) : AtomType( existing_id ) {}
+FloatType::FloatType(const hid_t existing_id) : AtomType( existing_id ) {}
//--------------------------------------------------------------------------
-// Function: FloatType copy constructor
-///\brief Copy constructor: makes a copy of the original FloatType object.
-// Programmer Binh-Minh Ribler - 2000
+// Function: FloatType copy constructor
+///\brief Copy constructor: makes a copy of the original FloatType object.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType::FloatType( const FloatType& original ) : AtomType( original ){}
+FloatType::FloatType(const FloatType& original) : AtomType( original ){}
//--------------------------------------------------------------------------
-// Function: EnumType overloaded constructor
-///\brief Gets the floating-point datatype of the specified dataset
-///\param dataset - IN: Dataset that this floating-point datatype
-/// associates with
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: EnumType overloaded constructor
+///\brief Gets the floating-point datatype of the specified dataset
+///\param dataset - IN: Dataset that this floating-point datatype
+/// associates with
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FloatType::FloatType( const DataSet& dataset ) : AtomType()
+FloatType::FloatType(const DataSet& dataset) : AtomType()
{
- // Calls C function H5Dget_type to get the id of the datatype
- id = H5Dget_type( dataset.getId() );
+ // Calls C function H5Dget_type to get the id of the datatype
+ id = H5Dget_type(dataset.getId());
- if( id < 0 )
- {
- throw DataSetIException("FloatType constructor", "H5Dget_type failed");
- }
+ if (id < 0)
+ {
+ throw DataSetIException("FloatType constructor", "H5Dget_type failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FloatType overloaded constructor
-///\brief Creates an FloatType instance by opening an HDF5 float datatype
-/// given its name, provided as a C character string.
-///\param dtype_name - IN: Float type name
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Dec 2016
+// Function: FloatType overloaded constructor
+///\brief Creates an FloatType instance by opening an HDF5 float datatype
+/// given its name, provided as a C character string.
+///\param dtype_name - IN: Float type name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openFloatType(const char*)
-// to improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openFloatType(const char*)
+// to improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
FloatType::FloatType(const H5Location& loc, const char *dtype_name) : AtomType()
{
@@ -110,213 +110,213 @@ FloatType::FloatType(const H5Location& loc, const char *dtype_name) : AtomType()
}
//--------------------------------------------------------------------------
-// Function: FloatType overloaded constructor
-///\brief Creates an FloatType instance by opening an HDF5 float datatype
-/// given its name, provided as an \c H5std_string.
-///\param dtype_name - IN: Float type name
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Dec 2016
+// Function: FloatType overloaded constructor
+///\brief Creates an FloatType instance by opening an HDF5 float datatype
+/// given its name, provided as an \c H5std_string.
+///\param dtype_name - IN: Float type name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openFloatType(const H5std_string&)
-// to improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openFloatType(const H5std_string&)
+// to improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
FloatType::FloatType(const H5Location& loc, const H5std_string& dtype_name) : AtomType()
{
- id = p_opentype(loc, dtype_name.c_str());
+ id = p_opentype(loc, dtype_name.c_str());
}
//--------------------------------------------------------------------------
-// Function: FloatType::getFields
-///\brief Retrieves floating point datatype bit field information.
-///\param spos - OUT: Retrieved floating-point sign bit
-///\param epos - OUT: Retrieved exponent bit-position
-///\param esize - OUT: Retrieved size of exponent, in bits
-///\param mpos - OUT: Retrieved mantissa bit-position
-///\param msize - OUT: Retrieved size of mantissa, in bits
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void FloatType::getFields( size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize ) const
+// Function: FloatType::getFields
+///\brief Retrieves floating point datatype bit field information.
+///\param spos - OUT: Retrieved floating-point sign bit
+///\param epos - OUT: Retrieved exponent bit-position
+///\param esize - OUT: Retrieved size of exponent, in bits
+///\param mpos - OUT: Retrieved mantissa bit-position
+///\param msize - OUT: Retrieved size of mantissa, in bits
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void FloatType::getFields(size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize) const
{
- herr_t ret_value = H5Tget_fields( id, &spos, &epos, &esize, &mpos, &msize );
- if( ret_value < 0 )
- {
- throw DataTypeIException("FloatType::getFields", "H5Tget_fields failed");
- }
+ herr_t ret_value = H5Tget_fields(id, &spos, &epos, &esize, &mpos, &msize);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException("FloatType::getFields", "H5Tget_fields failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FloatType::setFields
-///\brief Sets locations and sizes of floating point bit fields.
-///\param spos - OUT: Sign position, i.e., the bit offset of the
-/// floating-point sign bit.
-///\param epos - OUT: Exponent bit position
-///\param esize - OUT: Size of exponent, in bits
-///\param mpos - OUT: Mantissa bit-position
-///\param msize - OUT: Size of mantissa, in bits
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-void FloatType::setFields( size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize ) const
+// Function: FloatType::setFields
+///\brief Sets locations and sizes of floating point bit fields.
+///\param spos - OUT: Sign position, i.e., the bit offset of the
+/// floating-point sign bit.
+///\param epos - OUT: Exponent bit position
+///\param esize - OUT: Size of exponent, in bits
+///\param mpos - OUT: Mantissa bit-position
+///\param msize - OUT: Size of mantissa, in bits
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+void FloatType::setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const
{
- herr_t ret_value = H5Tset_fields( id, spos, epos, esize, mpos, msize );
- if( ret_value < 0 )
- {
- throw DataTypeIException("FloatType::setFields", "H5Tset_fields failed");
- }
+ herr_t ret_value = H5Tset_fields(id, spos, epos, esize, mpos, msize);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException("FloatType::setFields", "H5Tset_fields failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FloatType::getEbias
-///\brief Retrieves the exponent bias of a floating-point type.
-///\return Exponent bias
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: FloatType::getEbias
+///\brief Retrieves the exponent bias of a floating-point type.
+///\return Exponent bias
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
size_t FloatType::getEbias() const
{
- size_t ebias = H5Tget_ebias( id );
- // Returns the bias if successful
- if( ebias == 0 )
- {
- throw DataTypeIException("FloatType::getEbias", "H5Tget_ebias failed - returned exponent bias as 0");
- }
- return( ebias );
+ size_t ebias = H5Tget_ebias(id);
+ // Returns the bias if successful
+ if (ebias == 0)
+ {
+ throw DataTypeIException("FloatType::getEbias", "H5Tget_ebias failed - returned exponent bias as 0");
+ }
+ return(ebias);
}
//--------------------------------------------------------------------------
-// Function: FloatType::setEbias
-///\brief Sets the exponent bias of a floating-point type.
-///\param ebias - Exponent bias value
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: FloatType::setEbias
+///\brief Sets the exponent bias of a floating-point type.
+///\param ebias - Exponent bias value
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FloatType::setEbias( size_t ebias ) const
+void FloatType::setEbias(size_t ebias) const
{
- herr_t ret_value = H5Tset_ebias( id, ebias );
- if( ret_value < 0 )
- {
- throw DataTypeIException("FloatType::setEbias", "H5Tset_ebias failed");
- }
+ herr_t ret_value = H5Tset_ebias(id, ebias);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException("FloatType::setEbias", "H5Tset_ebias failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FloatType::getNorm
-///\brief Retrieves mantissa normalization of a floating-point datatype.
-///\param norm_string - OUT: Text string of the normalization type
-///\return Valid normalization type, which can be:
-/// \li \c H5T_NORM_IMPLIED (0) - MSB of mantissa is not stored
-/// \li \c H5T_NORM_MSBSET (1) - MSB of mantissa is always 1
-/// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized
-///\exception H5::DataTypeIException
+// Function: FloatType::getNorm
+///\brief Retrieves mantissa normalization of a floating-point datatype.
+///\param norm_string - OUT: Text string of the normalization type
+///\return Valid normalization type, which can be:
+/// \li \c H5T_NORM_IMPLIED (0) - MSB of mantissa is not stored
+/// \li \c H5T_NORM_MSBSET (1) - MSB of mantissa is always 1
+/// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized
+///\exception H5::DataTypeIException
///\par Description
-/// For your convenience, this function also provides the text
-/// string of the returned normalization type, via parameter
-/// \a norm_string.
-// Programmer Binh-Minh Ribler - 2000
+/// For your convenience, this function also provides the text
+/// string of the returned normalization type, via parameter
+/// \a norm_string.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_norm_t FloatType::getNorm( H5std_string& norm_string ) const
+H5T_norm_t FloatType::getNorm(H5std_string& norm_string) const
{
- H5T_norm_t norm = H5Tget_norm( id ); // C routine
- // Returns a valid normalization type if successful
- if( norm == H5T_NORM_ERROR )
- {
- throw DataTypeIException("FloatType::getNorm", "H5Tget_norm failed - returned H5T_NORM_ERROR");
- }
- if( norm == H5T_NORM_IMPLIED )
- norm_string = "H5T_NORM_IMPLIED (0)";
- else if( norm == H5T_NORM_MSBSET )
- norm_string = "H5T_NORM_MSBSET (1)";
- else if( norm == H5T_NORM_NONE )
- norm_string = "H5T_NORM_NONE (2)";
- return( norm );
+ H5T_norm_t norm = H5Tget_norm(id); // C routine
+ // Returns a valid normalization type if successful
+ if (norm == H5T_NORM_ERROR)
+ {
+ throw DataTypeIException("FloatType::getNorm", "H5Tget_norm failed - returned H5T_NORM_ERROR");
+ }
+ if (norm == H5T_NORM_IMPLIED)
+ norm_string = "H5T_NORM_IMPLIED (0)";
+ else if (norm == H5T_NORM_MSBSET)
+ norm_string = "H5T_NORM_MSBSET (1)";
+ else if (norm == H5T_NORM_NONE)
+ norm_string = "H5T_NORM_NONE (2)";
+ return(norm);
}
//--------------------------------------------------------------------------
-// Function: FloatType::setNorm
-///\brief Sets the mantissa normalization of a floating-point datatype.
-///\param norm - IN: Mantissa normalization type
-///\exception H5::DataTypeIException
+// Function: FloatType::setNorm
+///\brief Sets the mantissa normalization of a floating-point datatype.
+///\param norm - IN: Mantissa normalization type
+///\exception H5::DataTypeIException
///\par Description
-/// Valid values for normalization type include:
-/// \li \c H5T_NORM_IMPLIED (0) - MSB of mantissa is not stored
-/// \li \c H5T_NORM_MSBSET (1) - MSB of mantissa is always 1
-/// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized
-// Programmer Binh-Minh Ribler - 2000
+/// Valid values for normalization type include:
+/// \li \c H5T_NORM_IMPLIED (0) - MSB of mantissa is not stored
+/// \li \c H5T_NORM_MSBSET (1) - MSB of mantissa is always 1
+/// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FloatType::setNorm( H5T_norm_t norm ) const
+void FloatType::setNorm(H5T_norm_t norm) const
{
- herr_t ret_value = H5Tset_norm( id, norm );
- if( ret_value < 0 )
- {
- throw DataTypeIException("FloatType::setNorm", "H5Tset_norm failed");
- }
+ herr_t ret_value = H5Tset_norm(id, norm);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException("FloatType::setNorm", "H5Tset_norm failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FloatType::getInpad
-///\brief Retrieves the internal padding type for unused bits in
-/// this floating-point datatypes.
-///\return Internal padding type, which can be:
-/// \li \c H5T_PAD_ZERO (0) - Set background to zeros
-/// \li \c H5T_PAD_ONE (1) - Set background to ones
-/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone
-///\exception H5::DataTypeIException
+// Function: FloatType::getInpad
+///\brief Retrieves the internal padding type for unused bits in
+/// this floating-point datatypes.
+///\return Internal padding type, which can be:
+/// \li \c H5T_PAD_ZERO (0) - Set background to zeros
+/// \li \c H5T_PAD_ONE (1) - Set background to ones
+/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone
+///\exception H5::DataTypeIException
///\par Description
-/// For your convenience, this function also provides the text
-/// string of the returned internal padding type, via parameter
-/// \a pad_string.
-// Programmer Binh-Minh Ribler - 2000
+/// For your convenience, this function also provides the text
+/// string of the returned internal padding type, via parameter
+/// \a pad_string.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5T_pad_t FloatType::getInpad( H5std_string& pad_string ) const
+H5T_pad_t FloatType::getInpad(H5std_string& pad_string) const
{
- H5T_pad_t pad_type = H5Tget_inpad( id );
- // Returns a valid padding type if successful
- if( pad_type == H5T_PAD_ERROR )
- {
- throw DataTypeIException("FloatType::getInpad", "H5Tget_inpad failed - returned H5T_PAD_ERROR");
- }
- if( pad_type == H5T_PAD_ZERO )
- pad_string = "H5T_PAD_ZERO (0)";
- else if( pad_type == H5T_PAD_ONE )
- pad_string = "H5T_PAD_ONE (1)";
- else if( pad_type == H5T_PAD_BACKGROUND )
- pad_string = "H5T_PAD_BACKGROUD (2)";
- return( pad_type );
+ H5T_pad_t pad_type = H5Tget_inpad(id);
+ // Returns a valid padding type if successful
+ if (pad_type == H5T_PAD_ERROR)
+ {
+ throw DataTypeIException("FloatType::getInpad", "H5Tget_inpad failed - returned H5T_PAD_ERROR");
+ }
+ if (pad_type == H5T_PAD_ZERO)
+ pad_string = "H5T_PAD_ZERO (0)";
+ else if (pad_type == H5T_PAD_ONE)
+ pad_string = "H5T_PAD_ONE (1)";
+ else if (pad_type == H5T_PAD_BACKGROUND)
+ pad_string = "H5T_PAD_BACKGROUD (2)";
+ return(pad_type);
}
//--------------------------------------------------------------------------
-// Function: FloatType::setInpad
-///\brief Fills unused internal floating point bits.
-///\param inpad - IN: Internal padding type
-///\exception H5::DataTypeIException
+// Function: FloatType::setInpad
+///\brief Fills unused internal floating point bits.
+///\param inpad - IN: Internal padding type
+///\exception H5::DataTypeIException
///\par Description
-/// If any internal bits of a floating point type are unused
-/// (that is, those significant bits which are not part of the
-/// sign, exponent, or mantissa), then they will be filled
-/// according to the padding value provided by \a inpad.
+/// If any internal bits of a floating point type are unused
+/// (that is, those significant bits which are not part of the
+/// sign, exponent, or mantissa), then they will be filled
+/// according to the padding value provided by \a inpad.
///\par
-/// Valid values for normalization type include:
-/// \li \c H5T_PAD_ZERO (0) - Set background to zeros
-/// \li \c H5T_PAD_ONE (1) - Set background to ones
-/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone
-// Programmer Binh-Minh Ribler - 2000
+/// Valid values for normalization type include:
+/// \li \c H5T_PAD_ZERO (0) - Set background to zeros
+/// \li \c H5T_PAD_ONE (1) - Set background to ones
+/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void FloatType::setInpad( H5T_pad_t inpad ) const
+void FloatType::setInpad(H5T_pad_t inpad) const
{
- herr_t ret_value = H5Tset_inpad( id, inpad );
- if( ret_value < 0 )
- {
- throw DataTypeIException("FloatType::setInpad", "H5Tset_inpad failed");
- }
+ herr_t ret_value = H5Tset_inpad(id, inpad);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException("FloatType::setInpad", "H5Tset_inpad failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: FloatType destructor
-///\brief Noop destructor.
-// Programmer Binh-Minh Ribler - 2000
+// Function: FloatType destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
FloatType::~FloatType() {}
diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h
index 1f4b227..2c925de 100644
--- a/c++/src/H5FloatType.h
+++ b/c++/src/H5FloatType.h
@@ -27,54 +27,54 @@ namespace H5 {
*/
class H5_DLLCPP FloatType : public AtomType {
public:
- // Creates a floating-point type using a predefined type.
- FloatType( const PredType& pred_type );
+ // Creates a floating-point type using a predefined type.
+ FloatType(const PredType& pred_type);
- // Gets the floating-point datatype of the specified dataset.
- FloatType( const DataSet& dataset );
+ // Gets the floating-point datatype of the specified dataset.
+ FloatType(const DataSet& dataset);
- // Constructors that open an HDF5 float datatype, given a location.
- FloatType(const H5Location& loc, const char* name);
- FloatType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open an HDF5 float datatype, given a location.
+ FloatType(const H5Location& loc, const char* name);
+ FloatType(const H5Location& loc, const H5std_string& name);
- // Retrieves the exponent bias of a floating-point type.
- size_t getEbias() const;
+ // Retrieves the exponent bias of a floating-point type.
+ size_t getEbias() const;
- // Sets the exponent bias of a floating-point type.
- void setEbias( size_t ebias ) const;
+ // Sets the exponent bias of a floating-point type.
+ void setEbias(size_t ebias) const;
- // Retrieves floating point datatype bit field information.
- void getFields( size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize ) const;
+ // Retrieves floating point datatype bit field information.
+ void getFields(size_t& spos, size_t& epos, size_t& esize, size_t& mpos, size_t& msize) const;
- // Sets locations and sizes of floating point bit fields.
- void setFields( size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize ) const;
+ // Sets locations and sizes of floating point bit fields.
+ void setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const;
- // Retrieves the internal padding type for unused bits in floating-point datatypes.
- H5T_pad_t getInpad( H5std_string& pad_string ) const;
+ // Retrieves the internal padding type for unused bits in floating-point datatypes.
+ H5T_pad_t getInpad(H5std_string& pad_string) const;
- // Fills unused internal floating point bits.
- void setInpad( H5T_pad_t inpad ) const;
+ // Fills unused internal floating point bits.
+ void setInpad(H5T_pad_t inpad) const;
- // Retrieves mantissa normalization of a floating-point datatype.
- H5T_norm_t getNorm( H5std_string& norm_string ) const;
+ // Retrieves mantissa normalization of a floating-point datatype.
+ H5T_norm_t getNorm(H5std_string& norm_string) const;
- // Sets the mantissa normalization of a floating-point datatype.
- void setNorm( H5T_norm_t norm ) const;
+ // Sets the mantissa normalization of a floating-point datatype.
+ void setNorm(H5T_norm_t norm) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("FloatType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("FloatType"); }
- // Default constructor
- FloatType();
+ // Default constructor
+ FloatType();
- // Creates a floating-point datatype using an existing id.
- FloatType( const hid_t existing_id );
+ // Creates a floating-point datatype using an existing id.
+ FloatType(const hid_t existing_id);
- // Copy constructor: makes a copy of the original FloatType object.
- FloatType( const FloatType& original );
+ // Copy constructor: makes a copy of the original FloatType object.
+ FloatType(const FloatType& original);
- // Noop destructor.
- virtual ~FloatType();
+ // Noop destructor.
+ virtual ~FloatType();
};
}
#endif // __H5FloatType_H
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index c976b00..6b143b5 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -46,17 +46,17 @@ namespace H5 {
using std::endl;
//--------------------------------------------------------------------------
-// Function: Group default constructor
-///\brief Default constructor: creates a stub Group.
-// Programmer Binh-Minh Ribler - 2000
+// Function: Group default constructor
+///\brief Default constructor: creates a stub Group.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) {}
//--------------------------------------------------------------------------
-// Function: Group copy constructor
-///\brief Copy constructor: makes a copy of the original Group object.
-///\param original - IN: Original group to copy
-// Programmer Binh-Minh Ribler - 2000
+// Function: Group copy constructor
+///\brief Copy constructor: makes a copy of the original Group object.
+///\param original - IN: Original group to copy
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id)
{
@@ -64,26 +64,26 @@ Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id)
}
//--------------------------------------------------------------------------
-// Function: Group::getLocId
+// Function: Group::getLocId
// Purpose: Get the id of this group
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
// Description
-// This function is a redefinition of CommonFG::getLocId. It
-// is used by CommonFG member functions to get the file id.
+// This function is a redefinition of CommonFG::getLocId. It
+// is used by CommonFG member functions to get the file id.
// Deprecated:
// After HDFFV-9920, the Group's methods can use getId() and getLocId()
// is kept for backward compatibility. Aug 18, 2016 -BMR
//--------------------------------------------------------------------------
hid_t Group::getLocId() const
{
- return( getId() );
+ return(getId());
}
//--------------------------------------------------------------------------
-// Function: Group overloaded constructor
-///\brief Creates a Group object using the id of an existing group.
-///\param existing_id - IN: Id of an existing group
-// Programmer Binh-Minh Ribler - 2000
+// Function: Group overloaded constructor
+///\brief Creates a Group object using the id of an existing group.
+///\param existing_id - IN: Id of an existing group
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id)
{
@@ -91,17 +91,17 @@ Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id)
}
//--------------------------------------------------------------------------
-// Function: Group overload constructor - dereference
-///\brief Given a reference, ref, to an hdf5 group, creates a Group object
-///\param loc - IN: Specifying location referenced object is in
-///\param ref - IN: Reference pointer
-///\param ref_type - IN: Reference type - default to H5R_OBJECT
-///\param plist - IN: Property list - default to PropList::DEFAULT
-///\exception H5::ReferenceException
+// Function: Group overload constructor - dereference
+///\brief Given a reference, ref, to an hdf5 group, creates a Group object
+///\param loc - IN: Specifying location referenced object is in
+///\param ref - IN: Reference pointer
+///\param ref_type - IN: Reference type - default to H5R_OBJECT
+///\param plist - IN: Property list - default to PropList::DEFAULT
+///\exception H5::ReferenceException
///\par Description
-/// \c obj can be DataSet, Group, or named DataType, that
-/// is a datatype that has been named by DataType::commit.
-// Programmer Binh-Minh Ribler - Oct, 2006
+/// \c obj can be DataSet, Group, or named DataType, that
+/// is a datatype that has been named by DataType::commit.
+// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), CommonFG(), id(H5I_INVALID_HID)
{
@@ -109,14 +109,14 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const
}
//--------------------------------------------------------------------------
-// Function: Group overload constructor - dereference
-///\brief Given a reference, ref, to an hdf5 group, creates a Group 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
-///\param plist - IN: Property list - default to PropList::DEFAULT
-///\exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
+// Function: Group overload constructor - dereference
+///\brief Given a reference, ref, to an hdf5 group, creates a Group 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
+///\param plist - IN: Property list - default to PropList::DEFAULT
+///\exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - Oct, 2006
//--------------------------------------------------------------------------
/* Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID)
{
@@ -126,19 +126,19 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const
//--------------------------------------------------------------------------
// Function: Group::getId
-///\brief Get the id of this group
-///\return Group identifier
+///\brief Get the id of this group
+///\return Group identifier
// Modification:
// May 2008 - BMR
-// Class hierarchy is revised to address bugzilla 1068. Class
-// AbstractDS and Attribute are moved out of H5Object. In
-// addition, member IdComponent::id is moved into subclasses, and
-// IdComponent::getId now becomes pure virtual function.
+// Class hierarchy is revised to address bugzilla 1068. Class
+// AbstractDS and Attribute are moved out of H5Object. In
+// addition, member IdComponent::id is moved into subclasses, and
+// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
hid_t Group::getId() const
{
- return(id);
+ return(id);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -147,11 +147,11 @@ hid_t Group::getId() const
///\brief Sets the identifier of this object to a new value.
///
///\exception H5::IdComponentException when the attempt to close the HDF5
-/// object fails
+/// object fails
// Description:
-// The underlaying reference counting in the C library ensures
-// that the current valid id of this object is properly closed.
-// Then the object's id is reset to the new id.
+// The underlaying reference counting in the C library ensures
+// that the current valid id of this object is properly closed.
+// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void Group::p_setId(const hid_t new_id)
@@ -163,24 +163,24 @@ void Group::p_setId(const hid_t new_id)
catch (Exception& close_error) {
throwException("Group::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;
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: Group::close
-///\brief Closes this group.
+// Function: Group::close
+///\brief Closes this group.
///
-///\exception H5::GroupIException
-// Programmer Binh-Minh Ribler - Mar 9, 2005
+///\exception H5::GroupIException
+// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
void Group::close()
{
if (p_valid_id(id))
{
- herr_t ret_value = H5Gclose( id );
- if( ret_value < 0 )
+ herr_t ret_value = H5Gclose(id);
+ if (ret_value < 0)
{
throwException("Group::close", "H5Gclose failed");
}
@@ -190,34 +190,34 @@ void Group::close()
}
//--------------------------------------------------------------------------
-// Function: Group::throwException
-///\brief Throws H5::GroupIException.
-///\param func_name - Name of the function where failure occurs
-///\param msg - Message describing the failure
-///\exception H5::GroupIException
+// Function: Group::throwException
+///\brief Throws H5::GroupIException.
+///\param func_name - Name of the function where failure occurs
+///\param msg - Message describing the failure
+///\exception H5::GroupIException
// Description
-// This function is also used in H5Location's methods so that
-// proper exception can be thrown for file or group. The
-// "Group::" will be inserted to indicate the function called is
-// an implementation of Group.
-// Programmer Binh-Minh Ribler - 2000
+// This function is also used in H5Location's methods so that
+// proper exception can be thrown for file or group. The
+// "Group::" will be inserted to indicate the function called is
+// an implementation of Group.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void Group::throwException(const H5std_string& func_name, const H5std_string& msg) const
{
- H5std_string full_name = func_name;
- full_name.insert(0, "Group::");
- throw GroupIException(full_name, msg);
+ H5std_string full_name = func_name;
+ full_name.insert(0, "Group::");
+ throw GroupIException(full_name, msg);
}
//--------------------------------------------------------------------------
-// Function: Group destructor
-///\brief Properly terminates access to this group.
-// Programmer Binh-Minh Ribler - 2000
+// Function: Group destructor
+///\brief Properly terminates access to this group.
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// - Replaced resetIdComponent() with decRefCount() to use C
-// library ID reference counting mechanism - BMR, Feb 20, 2005
-// - 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, Feb 20, 2005
+// - Replaced decRefCount with close() to let the C library
+// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
Group::~Group()
{
diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h
index 0a9e975..96dc5c1 100644
--- a/c++/src/H5Group.h
+++ b/c++/src/H5Group.h
@@ -30,53 +30,53 @@ class VarLenType;
class H5_DLLCPP Group : public H5Object, public CommonFG {
public:
- // Group constructor to create a group or file (aka root group).
- Group(const char* name, size_t size_hint = 0);
- Group(const H5std_string& name, size_t size_hint = 0);
+ // Group constructor to create a group or file (aka root group).
+ Group(const char* name, size_t size_hint = 0);
+ Group(const H5std_string& name, size_t size_hint = 0);
- // Group constructor to open a group or file (aka root group).
- Group(const char* name);
- Group(const H5std_string& name);
+ // Group constructor to open a group or file (aka root group).
+ Group(const char* name);
+ Group(const H5std_string& name);
- // Close this group.
- virtual void close();
+ // Close this group.
+ virtual void close();
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("Group"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("Group"); }
- // Throw group exception.
- virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
+ // Throw group exception.
+ virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
- // for CommonFG to get the file id.
- virtual hid_t getLocId() const;
+ // for CommonFG to get the file id.
+ virtual hid_t getLocId() const;
- // Creates a group by way of dereference.
- Group(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
+ // Creates a group by way of dereference.
+ Group(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
// Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
- // default constructor
- Group();
+ // default constructor
+ Group();
- // Copy constructor: makes a copy of the original object
- Group(const Group& original);
+ // Copy constructor: makes a copy of the original object
+ Group(const Group& original);
- // Gets the group id.
- virtual hid_t getId() const;
+ // Gets the group id.
+ virtual hid_t getId() const;
- // Destructor
- virtual ~Group();
+ // Destructor
+ virtual ~Group();
- // Creates a copy of an existing group using its id.
- Group( const hid_t group_id );
+ // Creates a copy of an existing group using its id.
+ Group(const hid_t group_id);
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Sets the group id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the group id.
+ virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
private:
- hid_t id; // HDF5 group id
+ hid_t id; // HDF5 group id
};
}
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index ae60c5e..574b28a 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -15,7 +15,7 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5Library.h"
@@ -34,21 +34,21 @@ bool IdComponent::H5cppinit = false;
bool IdComponent::H5dontAtexit_called = false;
//--------------------------------------------------------------------------
-// Function: IdComponent::incRefCount
-///\brief Increment reference counter for a given id.
-// Programmer Binh-Minh Ribler - May 2005
+// Function: IdComponent::incRefCount
+///\brief Increment reference counter for a given id.
+// Programmer Binh-Minh Ribler - May 2005
//--------------------------------------------------------------------------
void IdComponent::incRefCount(const hid_t obj_id) const
{
if (p_valid_id(obj_id))
- if (H5Iinc_ref(obj_id) < 0)
- throw IdComponentException(inMemFunc("incRefCount"), "incrementing object ref count failed");
+ if (H5Iinc_ref(obj_id) < 0)
+ throw IdComponentException(inMemFunc("incRefCount"), "incrementing object ref count failed");
}
//--------------------------------------------------------------------------
-// Function: IdComponent::incRefCount
-///\brief Increment reference counter for the id of this object.
-// Programmer Binh-Minh Ribler - 2000
+// Function: IdComponent::incRefCount
+///\brief Increment reference counter for the id of this object.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void IdComponent::incRefCount() const
{
@@ -56,31 +56,31 @@ void IdComponent::incRefCount() const
}
//--------------------------------------------------------------------------
-// Function: IdComponent::decRefCount
-///\brief Decrement reference counter for a given id.
-// Programmer Binh-Minh Ribler - May 2005
+// Function: IdComponent::decRefCount
+///\brief Decrement reference counter for a given id.
+// Programmer Binh-Minh Ribler - May 2005
// Modification:
-// Added the check for ref counter to give a little more info
-// on why H5Idec_ref fails in some cases - BMR 5/19/2005
+// Added the check for ref counter to give a little more info
+// on why H5Idec_ref fails in some cases - BMR 5/19/2005
//--------------------------------------------------------------------------
void IdComponent::decRefCount(const hid_t obj_id) const
{
if (p_valid_id(obj_id))
- if (H5Idec_ref(obj_id) < 0)
- {
- if (H5Iget_ref(obj_id) <= 0)
- throw IdComponentException(inMemFunc("decRefCount"),
- "object ref count is 0 or negative");
- else
- throw IdComponentException(inMemFunc("decRefCount"),
- "decrementing object ref count failed");
- }
+ if (H5Idec_ref(obj_id) < 0)
+ {
+ if (H5Iget_ref(obj_id) <= 0)
+ throw IdComponentException(inMemFunc("decRefCount"),
+ "object ref count is 0 or negative");
+ else
+ throw IdComponentException(inMemFunc("decRefCount"),
+ "decrementing object ref count failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: IdComponent::decRefCount
-///\brief Decrement reference counter for the id of this object.
-// Programmer Binh-Minh Ribler - 2000
+// Function: IdComponent::decRefCount
+///\brief Decrement reference counter for the id of this object.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void IdComponent::decRefCount() const
{
@@ -88,28 +88,28 @@ void IdComponent::decRefCount() const
}
//--------------------------------------------------------------------------
-// Function: IdComponent::getCounter
-///\brief Returns the reference counter for a given id.
-///\return Reference count
-// Programmer Binh-Minh Ribler - May 2005
+// Function: IdComponent::getCounter
+///\brief Returns the reference counter for a given id.
+///\return Reference count
+// Programmer Binh-Minh Ribler - May 2005
//--------------------------------------------------------------------------
int IdComponent::getCounter(const hid_t obj_id) const
{
int counter = 0;
if (p_valid_id(obj_id))
{
- counter = H5Iget_ref(obj_id);
- if (counter < 0)
- throw IdComponentException(inMemFunc("incRefCount"), "getting object ref count failed - negative");
+ counter = H5Iget_ref(obj_id);
+ if (counter < 0)
+ throw IdComponentException(inMemFunc("incRefCount"), "getting object ref count failed - negative");
}
return (counter);
}
//--------------------------------------------------------------------------
-// Function: IdComponent::getCounter
-///\brief Returns the reference counter for the id of this object.
-///\return Reference count
-// Programmer Binh-Minh Ribler - 2000
+// Function: IdComponent::getCounter
+///\brief Returns the reference counter for the id of this object.
+///\return Reference count
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int IdComponent::getCounter() const
{
@@ -117,43 +117,43 @@ int IdComponent::getCounter() const
}
//--------------------------------------------------------------------------
-// Function: getHDFObjType (static)
-///\brief Given an id, returns the type of the object.
-///\return a valid HDF object type, which may be one of the following:
-/// \li \c H5I_FILE
-/// \li \c H5I_GROUP
-/// \li \c H5I_DATATYPE
-/// \li \c H5I_DATASPACE
-/// \li \c H5I_DATASET
-/// \li \c H5I_ATTR
-/// \li or \c H5I_BADID, if no valid type can be determined or the
-/// input object id is invalid.
+// Function: getHDFObjType (static)
+///\brief Given an id, returns the type of the object.
+///\return a valid HDF object type, which may be one of the following:
+/// \li \c H5I_FILE
+/// \li \c H5I_GROUP
+/// \li \c H5I_DATATYPE
+/// \li \c H5I_DATASPACE
+/// \li \c H5I_DATASET
+/// \li \c H5I_ATTR
+/// \li or \c H5I_BADID, if no valid type can be determined or the
+/// input object id is invalid.
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
H5I_type_t IdComponent::getHDFObjType(const hid_t obj_id)
{
if (obj_id <= 0)
- return H5I_BADID; // invalid
+ return H5I_BADID; // invalid
H5I_type_t id_type = H5Iget_type(obj_id);
if (id_type <= H5I_BADID || id_type >= H5I_NTYPES)
- return H5I_BADID; // invalid
+ return H5I_BADID; // invalid
else
- return id_type; // valid type
+ return id_type; // valid type
}
//--------------------------------------------------------------------------
-// Function: getHDFObjType
-///\brief Returns the type of the object. It is an overloaded function
-/// of the above function.
-///\return a valid HDF object type, which may be one of the following:
-/// \li \c H5I_FILE
-/// \li \c H5I_GROUP
-/// \li \c H5I_DATATYPE
-/// \li \c H5I_DATASPACE
-/// \li \c H5I_DATASET
-/// \li \c H5I_ATTR
-/// \li or \c H5I_BADID, if no valid type can be determined or the
-/// input object id is invalid.
+// Function: getHDFObjType
+///\brief Returns the type of the object. It is an overloaded function
+/// of the above function.
+///\return a valid HDF object type, which may be one of the following:
+/// \li \c H5I_FILE
+/// \li \c H5I_GROUP
+/// \li \c H5I_DATATYPE
+/// \li \c H5I_DATASPACE
+/// \li \c H5I_DATASET
+/// \li \c H5I_ATTR
+/// \li or \c H5I_BADID, if no valid type can be determined or the
+/// input object id is invalid.
// Programmer Binh-Minh Ribler - Mar, 2014
//--------------------------------------------------------------------------
H5I_type_t IdComponent::getHDFObjType() const
@@ -162,25 +162,25 @@ H5I_type_t IdComponent::getHDFObjType() const
}
//--------------------------------------------------------------------------
-// Function: getNumMembers (static)
-///\brief Returns the number of members of the given type.
-///\return Number of members
+// Function: getNumMembers (static)
+///\brief Returns the number of members of the given type.
+///\return Number of members
///\Description
-/// If there is no member of the given type, getNumMembers will
-/// return 0. Valid types are:
-/// \li \c H5I_FILE (= 1)
-/// \li \c H5I_GROUP
-/// \li \c H5I_DATATYPE
-/// \li \c H5I_DATASPACE
-/// \li \c H5I_DATASET
-/// \li \c H5I_ATTR
-/// \li \c H5I_REFERENCE
-/// \li \c H5I_VFL
-/// \li \c H5I_GENPROP_CLS
-/// \li \c H5I_GENPROP_LST
-/// \li \c H5I_ERROR_CLASS
-/// \li \c H5I_ERROR_MSG
-/// \li \c H5I_ERROR_STACK
+/// If there is no member of the given type, getNumMembers will
+/// return 0. Valid types are:
+/// \li \c H5I_FILE (= 1)
+/// \li \c H5I_GROUP
+/// \li \c H5I_DATATYPE
+/// \li \c H5I_DATASPACE
+/// \li \c H5I_DATASET
+/// \li \c H5I_ATTR
+/// \li \c H5I_REFERENCE
+/// \li \c H5I_VFL
+/// \li \c H5I_GENPROP_CLS
+/// \li \c H5I_GENPROP_LST
+/// \li \c H5I_ERROR_CLASS
+/// \li \c H5I_ERROR_MSG
+/// \li \c H5I_ERROR_STACK
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
hsize_t IdComponent::getNumMembers(H5I_type_t type)
@@ -188,31 +188,31 @@ hsize_t IdComponent::getNumMembers(H5I_type_t type)
hsize_t nmembers = 0;
herr_t ret_value = H5Inmembers(type, &nmembers);
if (ret_value < 0)
- throw IdComponentException("getNumMembers", "H5Inmembers failed");
+ throw IdComponentException("getNumMembers", "H5Inmembers failed");
else
- return(nmembers);
+ return(nmembers);
}
//--------------------------------------------------------------------------
-// Function: typeExists (static)
-///\brief Queries if a given type is currently registered with the
-/// library.
-///\return true if the given type exists, and false, otherwise.
+// Function: typeExists (static)
+///\brief Queries if a given type is currently registered with the
+/// library.
+///\return true if the given type exists, and false, otherwise.
///\Description
-/// Valid types are:
-/// \li \c H5I_FILE (= 1)
-/// \li \c H5I_GROUP
-/// \li \c H5I_DATATYPE
-/// \li \c H5I_DATASPACE
-/// \li \c H5I_DATASET
-/// \li \c H5I_ATTR
-/// \li \c H5I_REFERENCE
-/// \li \c H5I_VFL
-/// \li \c H5I_GENPROP_CLS
-/// \li \c H5I_GENPROP_LST
-/// \li \c H5I_ERROR_CLASS
-/// \li \c H5I_ERROR_MSG
-/// \li \c H5I_ERROR_STACK
+/// Valid types are:
+/// \li \c H5I_FILE (= 1)
+/// \li \c H5I_GROUP
+/// \li \c H5I_DATATYPE
+/// \li \c H5I_DATASPACE
+/// \li \c H5I_DATASET
+/// \li \c H5I_ATTR
+/// \li \c H5I_REFERENCE
+/// \li \c H5I_VFL
+/// \li \c H5I_GENPROP_CLS
+/// \li \c H5I_GENPROP_LST
+/// \li \c H5I_ERROR_CLASS
+/// \li \c H5I_ERROR_MSG
+/// \li \c H5I_ERROR_STACK
// Programmer Binh-Minh Ribler - Feb, 2017
//--------------------------------------------------------------------------
bool IdComponent::typeExists(H5I_type_t type)
@@ -220,82 +220,82 @@ bool IdComponent::typeExists(H5I_type_t type)
// Call C function
htri_t ret_value = H5Itype_exists(type);
if (ret_value > 0)
- return true;
+ return true;
else if (ret_value == 0)
- return false;
+ return false;
else // Raise exception when H5Itype_exists returns a negative value
- throw IdComponentException("typeExists", "H5Itype_exists failed");
+ throw IdComponentException("typeExists", "H5Itype_exists failed");
}
//--------------------------------------------------------------------------
-// Function: IdComponent::operator=
-///\brief Assignment operator.
-///\param rhs - IN: Reference to the existing object
-///\return Reference to IdComponent instance
-///\exception H5::IdComponentException when attempt to close the HDF5
-/// object fails
+// Function: IdComponent::operator=
+///\brief Assignment operator.
+///\param rhs - IN: Reference to the existing object
+///\return Reference to IdComponent instance
+///\exception H5::IdComponentException when attempt to close the HDF5
+/// object fails
// Description
-// First, close the current valid id of this object. Then
-// copy the id from rhs to this object, and increment the
-// reference counter of the id to indicate that another object
-// is referencing that id.
+// First, close the current valid id of this object. Then
+// copy the id from rhs to this object, and increment the
+// reference counter of the id to indicate that another object
+// is referencing that id.
// Modification
-// 2010/5/9 - BMR
-// Removed close() and incRefCount() because setId/p_setId takes
-// care of close() and setId takes care incRefCount().
-// Programmer Binh-Minh Ribler - 2000
+// 2010/5/9 - BMR
+// Removed close() and incRefCount() because setId/p_setId takes
+// care of close() and setId takes care incRefCount().
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IdComponent& IdComponent::operator=( const IdComponent& rhs )
+IdComponent& IdComponent::operator=(const IdComponent& rhs)
{
if (this != &rhs)
{
- // handling references to this id
- try {
- setId(rhs.getId());
- // Note: a = b, so there are two objects with the same hdf5 id
- // that's why incRefCount is needed, and it is called by setId
- }
- catch (Exception& close_error) {
- throw FileIException(inMemFunc("operator="), close_error.getDetailMsg());
- }
+ // handling references to this id
+ try {
+ setId(rhs.getId());
+ // Note: a = b, so there are two objects with the same hdf5 id
+ // that's why incRefCount is needed, and it is called by setId
+ }
+ catch (Exception& close_error) {
+ throw FileIException(inMemFunc("operator="), close_error.getDetailMsg());
+ }
}
return *this;
}
//--------------------------------------------------------------------------
-// Function: IdComponent::setId
-///\brief Sets the identifier of this object to a new value.
-///\param new_id - IN: New identifier to be set to
-///\exception H5::IdComponentException when the attempt to close the HDF5
-/// object fails
+// Function: IdComponent::setId
+///\brief Sets the identifier of this object to a new value.
+///\param new_id - IN: New identifier to be set to
+///\exception H5::IdComponentException when the attempt to close the HDF5
+/// object fails
// Description:
-// p_setId ensures that the current valid id of this object is
-// properly closed before resetting the object's id to the new id.
-// Programmer Binh-Minh Ribler - 2000
+// p_setId ensures that the current valid id of this object is
+// properly closed before resetting the object's id to the new id.
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// 2008/7/23 - BMR
-// Changed all subclasses' setId to p_setId and put back setId
-// here. p_setId is used in the library where the id provided
-// by a C API passed on to user's application in the form of a
-// C++ API object, which will be destroyed properly, and so
-// p_setId does not call incRefCount. On the other hand, the
-// public version setId is used by other applications, in which
-// the id passed to setId is that of another C++ API object, so
-// setId must call incRefCount.
+// 2008/7/23 - BMR
+// Changed all subclasses' setId to p_setId and put back setId
+// here. p_setId is used in the library where the id provided
+// by a C API passed on to user's application in the form of a
+// C++ API object, which will be destroyed properly, and so
+// p_setId does not call incRefCount. On the other hand, the
+// public version setId is used by other applications, in which
+// the id passed to setId is that of another C++ API object, so
+// setId must call incRefCount.
//--------------------------------------------------------------------------
void IdComponent::setId(const hid_t new_id)
{
- // set to new_id
- p_setId(new_id);
+ // set to new_id
+ p_setId(new_id);
- // increment the reference counter of the new id
- incRefCount();
+ // increment the reference counter of the new id
+ incRefCount();
}
//--------------------------------------------------------------------------
-// Function: IdComponent destructor
-///\brief Noop destructor.
-// Programmer Binh-Minh Ribler - 2000
+// Function: IdComponent destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
IdComponent::~IdComponent() {}
@@ -306,29 +306,29 @@ IdComponent::~IdComponent() {}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: IdComponent::inMemFunc
-///\brief Makes and returns string "<class-name>::<func_name>"
-///\param func_name - Name of the function where failure occurs
+// Function: IdComponent::inMemFunc
+///\brief Makes and returns string "<class-name>::<func_name>"
+///\param func_name - Name of the function where failure occurs
// Description
-/// Concatenates the class name of this object with the
-/// passed-in function name to create a string that indicates
-/// where the failure occurs. The class-name is provided by
-/// fromClass(). This string will be used by a base class when
-/// an exception is thrown.
-// Programmer Binh-Minh Ribler - Aug 6, 2005
+/// Concatenates the class name of this object with the
+/// passed-in function name to create a string that indicates
+/// where the failure occurs. The class-name is provided by
+/// fromClass(). This string will be used by a base class when
+/// an exception is thrown.
+// Programmer Binh-Minh Ribler - Aug 6, 2005
//--------------------------------------------------------------------------
H5std_string IdComponent::inMemFunc(const char* func_name) const
{
- H5std_string full_name = func_name;
- full_name.insert(0, "::");
- full_name.insert(0, fromClass());
- return (full_name);
+ H5std_string full_name = func_name;
+ full_name.insert(0, "::");
+ full_name.insert(0, fromClass());
+ return (full_name);
}
//--------------------------------------------------------------------------
-// Function: IdComponent default constructor - private
-///\brief Default constructor.
-// Programmer Binh-Minh Ribler - 2000
+// Function: IdComponent default constructor - private
+///\brief Default constructor.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
IdComponent::IdComponent()
{
@@ -342,45 +342,45 @@ IdComponent::IdComponent()
}
//--------------------------------------------------------------------------
-// Function: IdComponent::p_get_file_name (protected)
-// Purpose: Gets the name of the file, in which this object belongs.
-// Exception: H5::IdComponentException
+// Function: IdComponent::p_get_file_name (protected)
+// Purpose Gets the name of the file, in which this object belongs.
+// Exception: H5::IdComponentException
// Description:
-// This function is protected so that the user applications can
-// only have access to its code via allowable classes, namely,
-// Attribute and H5Location subclasses.
-// Programmer Binh-Minh Ribler - Jul, 2004
+// This function is protected so that the user applications can
+// only have access to its code via allowable classes, namely,
+// Attribute and H5Location subclasses.
+// Programmer Binh-Minh Ribler - Jul, 2004
//--------------------------------------------------------------------------
H5std_string IdComponent::p_get_file_name() const
{
- hid_t temp_id = getId();
+ hid_t temp_id = getId();
- // Preliminary call to H5Fget_name to get the length of the file name
- ssize_t name_size = H5Fget_name(temp_id, NULL, 0);
+ // Preliminary call to H5Fget_name to get the length of the file name
+ ssize_t name_size = H5Fget_name(temp_id, NULL, 0);
- // If H5Aget_name returns a negative value, raise an exception,
- if( name_size < 0 )
- {
- throw IdComponentException("", "H5Fget_name failed");
- }
+ // If H5Aget_name returns a negative value, raise an exception,
+ if (name_size < 0)
+ {
+ throw IdComponentException("", "H5Fget_name failed");
+ }
- // Call H5Fget_name again to get the actual file name
- char* name_C = new char[name_size+1]; // temporary C-string for C API
- HDmemset(name_C, 0, name_size+1); // clear buffer
+ // Call H5Fget_name again to get the actual file name
+ char* name_C = new char[name_size+1]; // temporary C-string for C API
+ HDmemset(name_C, 0, name_size+1); // clear buffer
- name_size = H5Fget_name(temp_id, name_C, name_size+1);
+ name_size = H5Fget_name(temp_id, name_C, name_size+1);
- // Check for failure again
- if( name_size < 0 )
- {
+ // Check for failure again
+ if (name_size < 0)
+ {
delete []name_C;
- throw IdComponentException("", "H5Fget_name failed");
- }
+ throw IdComponentException("", "H5Fget_name failed");
+ }
- // Convert the C file name and return
- H5std_string file_name(name_C);
- delete []name_C;
- return(file_name);
+ // Convert the C file name and return
+ H5std_string file_name(name_C);
+ delete []name_C;
+ return(file_name);
}
//
@@ -388,22 +388,22 @@ H5std_string IdComponent::p_get_file_name() const
//
//--------------------------------------------------------------------------
-// Function: p_valid_id
-// Purpose: Verifies that the given id is a valid id so it can be passed
-// into an H5I C function.
-// Return true if id is valid, false, otherwise
-// Programmer Binh-Minh Ribler - May, 2005
+// Function: p_valid_id
+// Purpose Verifies that the given id is a valid id so it can be passed
+// into an H5I C function.
+// Return true if id is valid, false, otherwise
+// Programmer Binh-Minh Ribler - May, 2005
//--------------------------------------------------------------------------
bool IdComponent::p_valid_id(const hid_t obj_id)
{
if (obj_id <= 0)
- return false;
+ return false;
H5I_type_t id_type = H5Iget_type(obj_id);
if (id_type <= H5I_BADID || id_type >= H5I_NTYPES)
- return false;
+ return false;
else
- return true;
+ return true;
}
// Notes about IdComponent::id
diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h
index 70522dc..6f57364 100644
--- a/c++/src/H5IdComponent.h
+++ b/c++/src/H5IdComponent.h
@@ -30,92 +30,92 @@ class DataSpace;
class H5_DLLCPP IdComponent {
public:
- // Increment reference counter.
- void incRefCount(const hid_t obj_id) const;
- void incRefCount() const;
+ // Increment reference counter.
+ void incRefCount(const hid_t obj_id) const;
+ void incRefCount() const;
- // Decrement reference counter.
- void decRefCount(const hid_t obj_id) const;
- void decRefCount() const;
+ // Decrement reference counter.
+ void decRefCount(const hid_t obj_id) const;
+ void decRefCount() const;
- // Get the reference counter to this identifier.
- int getCounter(const hid_t obj_id) const;
- int getCounter() const;
+ // Get the reference counter to this identifier.
+ int getCounter(const hid_t obj_id) const;
+ int getCounter() const;
- // Returns an HDF5 object type, given the object id.
- static H5I_type_t getHDFObjType(const hid_t obj_id);
+ // Returns an HDF5 object type, given the object id.
+ static H5I_type_t getHDFObjType(const hid_t obj_id);
- // Returns an HDF5 object type of this object.
- H5I_type_t getHDFObjType() const;
+ // Returns an HDF5 object type of this object.
+ H5I_type_t getHDFObjType() const;
- // Returns the number of members in a type.
- static hsize_t getNumMembers(H5I_type_t type);
+ // Returns the number of members in a type.
+ static hsize_t getNumMembers(H5I_type_t type);
- // Determines if an type exists.
- static bool typeExists(H5I_type_t type);
+ // Determines if an type exists.
+ static bool typeExists(H5I_type_t type);
- // Assignment operator.
- IdComponent& operator=( const IdComponent& rhs );
+ // Assignment operator.
+ IdComponent& operator=(const IdComponent& rhs);
- // Sets the identifier of this object to a new value.
- void setId(const hid_t new_id);
+ // Sets the identifier of this object to a new value.
+ void setId(const hid_t new_id);
- // *** Deprecation warning ***
- // The following two constructors are no longer appropriate after the
- // data member "id" had been moved to the sub-classes.
- // The copy constructor is a noop and is removed in 1.8.15 and the
- // other will be removed from 1.10 release, and then from 1.8 if its
- // removal does not raise any problems in two 1.10 releases.
+ // *** Deprecation warning ***
+ // The following two constructors are no longer appropriate after the
+ // data member "id" had been moved to the sub-classes.
+ // The copy constructor is a noop and is removed in 1.8.15 and the
+ // other will be removed from 1.10 release, and then from 1.8 if its
+ // removal does not raise any problems in two 1.10 releases.
- // Creates an object to hold an HDF5 identifier.
- IdComponent( const hid_t h5_id );
+ // Creates an object to hold an HDF5 identifier.
+ // IdComponent(const hid_t h5_id); - removed from 1.10.1
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Copy constructor: makes copy of the original IdComponent object.
- // IdComponent( const IdComponent& original ); - removed from 1.8.15
+ // Copy constructor: makes copy of the original IdComponent object.
+ // IdComponent(const IdComponent& original); - removed from 1.8.15
- // Gets the identifier of this object.
- virtual hid_t getId () const = 0;
+ // Gets the identifier of this object.
+ virtual hid_t getId () const = 0;
- // Pure virtual function for there are various H5*close for the
- // subclasses.
- virtual void close() = 0;
+ // Pure virtual function for there are various H5*close for the
+ // subclasses.
+ virtual void close() = 0;
- // Makes and returns the string "<class-name>::<func_name>";
- // <class-name> is returned by fromClass().
- H5std_string inMemFunc(const char* func_name) const;
+ // Makes and returns the string "<class-name>::<func_name>";
+ // <class-name> is returned by fromClass().
+ H5std_string inMemFunc(const char* func_name) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass() const { return("IdComponent");}
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass() const { return("IdComponent");}
#endif // DOXYGEN_SHOULD_SKIP_THIS
- // Destructor
- virtual ~IdComponent();
+ // Destructor
+ virtual ~IdComponent();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
protected:
- // Default constructor.
- IdComponent();
+ // Default constructor.
+ IdComponent();
- // Gets the name of the file, in which an HDF5 object belongs.
- H5std_string p_get_file_name() const;
+ // Gets the name of the file, in which an HDF5 object belongs.
+ H5std_string p_get_file_name() const;
- // Verifies that the given id is valid.
- static bool p_valid_id(const hid_t obj_id);
+ // Verifies that the given id is valid.
+ static bool p_valid_id(const hid_t obj_id);
- // Sets the identifier of this object to a new value. - this one
- // doesn't increment reference count
- virtual void p_setId(const hid_t new_id) = 0;
+ // Sets the identifier of this object to a new value. - this one
+ // doesn't increment reference count
+ virtual void p_setId(const hid_t new_id) = 0;
- // This flag is used to decide whether H5dont_atexit should be called
- static bool H5dontAtexit_called;
+ // This flag is used to decide whether H5dont_atexit should be called
+ static bool H5dontAtexit_called;
private:
- // This flag indicates whether H5Library::initH5cpp has been called
- // to register various terminating functions with atexit()
+ // This flag indicates whether H5Library::initH5cpp has been called
+ // to register various terminating functions with atexit()
static bool H5cppinit;
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5Include.h b/c++/src/H5Include.h
index 1e0e952..ba82d78 100644
--- a/c++/src/H5Include.h
+++ b/c++/src/H5Include.h
@@ -33,10 +33,10 @@ const bool true = 1;
// so re-define them here for now.
/* Initial version of the object header format */
-#define H5O_VERSION_1 1
+#define H5O_VERSION_1 1
/* Revised version - leaves out reserved bytes and alignment padding, and adds
* magic number as prefix and checksum as suffix for all chunks.
*/
-#define H5O_VERSION_2 2
+#define H5O_VERSION_2 2
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp
index 38e2a7d..c64dae9 100644
--- a/c++/src/H5IntType.cpp
+++ b/c++/src/H5IntType.cpp
@@ -36,72 +36,72 @@
namespace H5 {
//--------------------------------------------------------------------------
-// Function: IntType default constructor
-///\brief Default constructor: Creates a stub integer datatype
-// Programmer Binh-Minh Ribler - 2000
+// Function: IntType default constructor
+///\brief Default constructor: Creates a stub integer datatype
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
IntType::IntType() {}
//--------------------------------------------------------------------------
-// Function: IntType copy constructor
-///\brief Copy constructor: makes a copy of the original IntType object.
-// Programmer Binh-Minh Ribler - 2000
+// Function: IntType copy constructor
+///\brief Copy constructor: makes a copy of the original IntType object.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType::IntType( const IntType& original ) : AtomType( original ) {}
+IntType::IntType(const IntType& original) : AtomType( original ) {}
//--------------------------------------------------------------------------
-// Function: IntType overloaded constructor
-///\brief Creates a integer type using a predefined type
-///\param pred_type - IN: Predefined datatype
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: IntType overloaded constructor
+///\brief Creates a integer type using a predefined type
+///\param pred_type - IN: Predefined datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType::IntType( const PredType& pred_type ) : AtomType()
+IntType::IntType(const PredType& pred_type) : AtomType()
{
- // use DataType::copy to make a copy of this predefined type
- copy( pred_type );
+ // use DataType::copy to make a copy of this predefined type
+ copy(pred_type);
}
//--------------------------------------------------------------------------
-// Function: IntType overloaded constructor
-///\brief Creates an integer datatype using the id of an existing
-/// datatype.
-///\param existing_id - IN: Id of an existing datatype
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: IntType overloaded constructor
+///\brief Creates an integer datatype using the id of an existing
+/// datatype.
+///\param existing_id - IN: Id of an existing datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType::IntType( const hid_t existing_id ) : AtomType( existing_id ) {}
+IntType::IntType(const hid_t existing_id) : AtomType( existing_id ) {}
//--------------------------------------------------------------------------
-// Function: IntType overloaded constructor
-///\brief Gets the integer datatype of the specified dataset.
-///\param dataset - IN: Dataset that this integer datatype associates with
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: IntType overloaded constructor
+///\brief Gets the integer datatype of the specified dataset.
+///\param dataset - IN: Dataset that this integer datatype associates with
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-IntType::IntType( const DataSet& dataset ) : AtomType()
+IntType::IntType(const DataSet& dataset) : AtomType()
{
- // Calls C function H5Dget_type to get the id of the datatype
- id = H5Dget_type( dataset.getId() );
-
- if( id < 0 )
- {
- throw DataSetIException("IntType constructor", "H5Dget_type failed");
- }
+ // Calls C function H5Dget_type to get the id of the datatype
+ id = H5Dget_type(dataset.getId());
+
+ if (id < 0)
+ {
+ throw DataSetIException("IntType constructor", "H5Dget_type failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: IntType overloaded constructor
-///\brief Creates a IntType instance by opening an HDF5 integer datatype
-/// given its name as a char*.
-///\param dtype_name - IN: Integer type name
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Dec 2016
+// Function: IntType overloaded constructor
+///\brief Creates a IntType instance by opening an HDF5 integer datatype
+/// given its name as a char*.
+///\param dtype_name - IN: Integer type name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openIntType(const char*) to
-// improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openIntType(const char*) to
+// improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
IntType::IntType(const H5Location& loc, const char *dtype_name) : AtomType()
{
@@ -109,17 +109,17 @@ IntType::IntType(const H5Location& loc, const char *dtype_name) : AtomType()
}
//--------------------------------------------------------------------------
-// Function: IntType overloaded constructor
-///\brief Creates a IntType instance by opening an HDF5 integer datatype
-/// given its name, provided as an \c H5std_string.
-///\param dtype_name - IN: Integer type name
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Dec 2016
+// Function: IntType overloaded constructor
+///\brief Creates a IntType instance by opening an HDF5 integer datatype
+/// given its name, provided as an \c H5std_string.
+///\param dtype_name - IN: Integer type name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openArrayType(const H5std_string&)
-// to improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openArrayType(const H5std_string&)
+// to improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
IntType::IntType(const H5Location& loc, const H5std_string& dtype_name) : AtomType()
{
@@ -127,46 +127,46 @@ IntType::IntType(const H5Location& loc, const H5std_string& dtype_name) : AtomTy
}
//--------------------------------------------------------------------------
-// Function: IntType::getSign
-///\brief Retrieves the sign type for an integer type.
-///\return Valid sign type
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: IntType::getSign
+///\brief Retrieves the sign type for an integer type.
+///\return Valid sign type
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5T_sign_t IntType::getSign() const
{
- H5T_sign_t type_sign = H5Tget_sign( id ); // C routine
-
- // Returns a valid sign type if no errors
- if( type_sign == H5T_SGN_ERROR )
- {
- throw DataTypeIException("IntType::getSign",
- "H5Tget_sign failed - returned H5T_SGN_ERROR for the sign type");
- }
- return( type_sign );
+ H5T_sign_t type_sign = H5Tget_sign(id); // C routine
+
+ // Returns a valid sign type if no errors
+ if (type_sign == H5T_SGN_ERROR)
+ {
+ throw DataTypeIException("IntType::getSign",
+ "H5Tget_sign failed - returned H5T_SGN_ERROR for the sign type");
+ }
+ return(type_sign);
}
//--------------------------------------------------------------------------
-// Function: IntType::getSign
-///\brief Sets the sign property for an integer type.
-///\param sign - IN: Sign type
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: IntType::getSign
+///\brief Sets the sign property for an integer type.
+///\param sign - IN: Sign type
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void IntType::setSign( H5T_sign_t sign ) const
+void IntType::setSign(H5T_sign_t sign) const
{
- // Call C routine to set the sign property
- herr_t ret_value = H5Tset_sign( id, sign );
- if( ret_value < 0 )
- {
- throw DataTypeIException("IntType::setSign", "H5Tset_sign failed");
- }
+ // Call C routine to set the sign property
+ herr_t ret_value = H5Tset_sign(id, sign);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException("IntType::setSign", "H5Tset_sign failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: IntType destructor
-///\brief Noop destructor.
-// Programmer Binh-Minh Ribler - 2000
+// Function: IntType destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
IntType::~IntType() {}
diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h
index 74786b9..ae4b3df 100644
--- a/c++/src/H5IntType.h
+++ b/c++/src/H5IntType.h
@@ -27,36 +27,36 @@ namespace H5 {
*/
class H5_DLLCPP IntType : public AtomType {
public:
- // Creates an integer type using a predefined type
- IntType(const PredType& pred_type);
+ // Creates an integer type using a predefined type
+ IntType(const PredType& pred_type);
- // Gets the integer datatype of the specified dataset
- IntType(const DataSet& dataset);
+ // Gets the integer datatype of the specified dataset
+ IntType(const DataSet& dataset);
- // Constructors that open an HDF5 integer datatype, given a location.
- IntType(const H5Location& loc, const char* name);
- IntType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open an HDF5 integer datatype, given a location.
+ IntType(const H5Location& loc, const char* name);
+ IntType(const H5Location& loc, const H5std_string& name);
- // Retrieves the sign type for an integer type
- H5T_sign_t getSign() const;
+ // Retrieves the sign type for an integer type
+ H5T_sign_t getSign() const;
- // Sets the sign proprety for an integer type.
- void setSign( H5T_sign_t sign ) const;
+ // Sets the sign proprety for an integer type.
+ void setSign(H5T_sign_t sign) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("IntType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("IntType"); }
- // Default constructor
- IntType();
+ // Default constructor
+ IntType();
- // Creates a integer datatype using an existing id
- IntType(const hid_t existing_id);
+ // Creates a integer datatype using an existing id
+ IntType(const hid_t existing_id);
- // Copy constructor: makes copy of IntType object
- IntType(const IntType& original);
+ // Copy constructor: makes copy of IntType object
+ IntType(const IntType& original);
- // Noop destructor.
- virtual ~IntType();
+ // Noop destructor.
+ virtual ~IntType();
};
}
#endif // __H5IntType_H
diff --git a/c++/src/H5LaccProp.cpp b/c++/src/H5LaccProp.cpp
index e225b36..e9adb12 100644
--- a/c++/src/H5LaccProp.cpp
+++ b/c++/src/H5LaccProp.cpp
@@ -47,7 +47,7 @@ LinkAccPropList* LinkAccPropList::getConstant()
// Tell the C library not to clean up, H5Library::termH5cpp will call
// H5close - more dependency if use H5Library::dontAtExit()
if (!IdComponent::H5dontAtexit_called)
- {
+ {
(void) H5dont_atexit();
IdComponent::H5dontAtexit_called = true;
}
@@ -75,39 +75,39 @@ void LinkAccPropList::deleteConstants()
}
//--------------------------------------------------------------------------
-// Purpose: Constant for default property
+// Purpose: Constant for default property
//--------------------------------------------------------------------------
const LinkAccPropList& LinkAccPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: Default Constructor
-///\brief Creates a file access property list
-// Programmer: Binh-Minh Ribler - 2000
+// Function: Default Constructor
+///\brief Creates a file access property list
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-LinkAccPropList::LinkAccPropList() : PropList( H5P_LINK_ACCESS ) {}
+LinkAccPropList::LinkAccPropList() : PropList(H5P_LINK_ACCESS) {}
//--------------------------------------------------------------------------
-// Function: LinkAccPropList copy constructor
-///\brief Copy Constructor: makes a copy of the original
-///\param original - IN: LinkAccPropList instance to copy
-// Programmer: Binh-Minh Ribler - 2000
+// Function: LinkAccPropList copy constructor
+///\brief Copy Constructor: makes a copy of the original
+///\param original - IN: LinkAccPropList instance to copy
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
LinkAccPropList::LinkAccPropList(const LinkAccPropList& original) : PropList(original) {}
//--------------------------------------------------------------------------
-// Function: LinkAccPropList overloaded constructor
-///\brief Creates a file access property list using the id of an
-/// existing one.
-// Programmer: Binh-Minh Ribler - 2000
+// Function: LinkAccPropList overloaded constructor
+///\brief Creates a file access property list using the id of an
+/// existing one.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
LinkAccPropList::LinkAccPropList(const hid_t plist_id) : PropList(plist_id) {}
//--------------------------------------------------------------------------
-// Function: LinkAccPropList destructor
-///\brief Noop destructor
-// Programmer Binh-Minh Ribler - 2000
+// Function: LinkAccPropList destructor
+///\brief Noop destructor
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
LinkAccPropList::~LinkAccPropList() {}
diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h
index 2a84ffb..8bcdd64 100644
--- a/c++/src/H5LaccProp.h
+++ b/c++/src/H5LaccProp.h
@@ -30,24 +30,24 @@ namespace H5 {
*/
class H5_DLLCPP LinkAccPropList : public PropList {
public:
- ///\brief Default file access property list.
- static const LinkAccPropList& DEFAULT;
+ ///\brief Default file access property list.
+ static const LinkAccPropList& DEFAULT;
- // Creates a file access property list.
- LinkAccPropList();
+ // Creates a file access property list.
+ LinkAccPropList();
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("LinkAccPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("LinkAccPropList"); }
- // Copy constructor: creates a copy of a LinkAccPropList object.
- LinkAccPropList( const LinkAccPropList& original );
+ // Copy constructor: creates a copy of a LinkAccPropList object.
+ LinkAccPropList(const LinkAccPropList& original);
- // Creates a copy of an existing file access property list
- // using the property list id.
- LinkAccPropList (const hid_t plist_id);
+ // Creates a copy of an existing file access property list
+ // using the property list id.
+ LinkAccPropList (const hid_t plist_id);
- // Noop destructor
- virtual ~LinkAccPropList();
+ // Noop destructor
+ virtual ~LinkAccPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp
index 0ee6b4d..dc453b7 100644
--- a/c++/src/H5Library.cpp
+++ b/c++/src/H5Library.cpp
@@ -38,46 +38,46 @@
namespace H5 {
//--------------------------------------------------------------------------
-// Function: H5Library::open (static)
-///\brief Initializes the HDF5 library.
+// Function: H5Library::open (static)
+///\brief Initializes the HDF5 library.
///
-///\exception H5::LibraryIException
-// Programmer Binh-Minh Ribler - 2000
+///\exception H5::LibraryIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void H5Library::open()
{
- herr_t ret_value = H5open();
- if( ret_value < 0 )
- {
- throw LibraryIException("H5Library::open", "H5open failed");
- }
+ herr_t ret_value = H5open();
+ if (ret_value < 0)
+ {
+ throw LibraryIException("H5Library::open", "H5open failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: H5Library::close (static)
-///\brief Flushes all data to disk, closes files, and cleans up memory.
+// Function: H5Library::close (static)
+///\brief Flushes all data to disk, closes files, and cleans up memory.
///
-///\exception H5::LibraryIException
-// Programmer Binh-Minh Ribler - 2000
+///\exception H5::LibraryIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void H5Library::close()
{
- herr_t ret_value = H5close();
- if( ret_value < 0 )
- {
- throw LibraryIException("H5Library::close", "H5close failed");
- }
+ herr_t ret_value = H5close();
+ if (ret_value < 0)
+ {
+ throw LibraryIException("H5Library::close", "H5close failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: H5Library::dontAtExit (static)
-///\brief Instructs library not to install the C \c atexit cleanup routine
+// Function: H5Library::dontAtExit (static)
+///\brief Instructs library not to install the C \c atexit cleanup routine
///
-///\exception H5::LibraryIException
-// Programmer Binh-Minh Ribler - 2000
+///\exception H5::LibraryIException
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// Removed the check for failure returned from H5dont_atexit.
-// will be fixed to not fail (HDFFV-9540)
+// Removed the check for failure returned from H5dont_atexit.
+// will be fixed to not fail (HDFFV-9540)
//--------------------------------------------------------------------------
void H5Library::dontAtExit()
{
@@ -85,80 +85,80 @@ void H5Library::dontAtExit()
}
//--------------------------------------------------------------------------
-// Function: H5Library::getLibVersion (static)
-///\brief Returns the HDF library release number.
-///\param majnum - OUT: Major version of the library
-///\param minnum - OUT: Minor version of the library
-///\param relnum - OUT: Release number of the library
-///\exception H5::LibraryIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Library::getLibVersion (static)
+///\brief Returns the HDF library release number.
+///\param majnum - OUT: Major version of the library
+///\param minnum - OUT: Minor version of the library
+///\param relnum - OUT: Release number of the library
+///\exception H5::LibraryIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Library::getLibVersion( unsigned& majnum, unsigned& minnum, unsigned& relnum )
+void H5Library::getLibVersion(unsigned& majnum, unsigned& minnum, unsigned& relnum)
{
- herr_t ret_value = H5get_libversion( &majnum, &minnum, &relnum );
- if( ret_value < 0 )
- {
- throw LibraryIException("H5Library::getLibVersion", "H5get_libversion failed");
- }
+ herr_t ret_value = H5get_libversion(&majnum, &minnum, &relnum);
+ if (ret_value < 0)
+ {
+ throw LibraryIException("H5Library::getLibVersion", "H5get_libversion failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: H5Library::checkVersion (static)
-///\brief Verifies that the arguments match the version numbers
-/// compiled into the library
-///\param majnum - IN: Major version of the library
-///\param minnum - IN: Minor version of the library
-///\param relnum - IN: Release number of the library
-///\exception H5::LibraryIException
+// Function: H5Library::checkVersion (static)
+///\brief Verifies that the arguments match the version numbers
+/// compiled into the library
+///\param majnum - IN: Major version of the library
+///\param minnum - IN: Minor version of the library
+///\param relnum - IN: Release number of the library
+///\exception H5::LibraryIException
///\par Description
-/// For information about library version, please refer to
-/// the C layer Reference Manual at:
+/// For information about library version, please refer to
+/// the C layer Reference Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-VersCheck
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum)
{
- herr_t ret_value = H5check_version(majnum, minnum, relnum);
- if( ret_value < 0 )
- {
- throw LibraryIException("H5Library::checkVersion", "H5check_version failed");
- }
+ herr_t ret_value = H5check_version(majnum, minnum, relnum);
+ if (ret_value < 0)
+ {
+ throw LibraryIException("H5Library::checkVersion", "H5check_version failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: H5Library::garbageCollect (static)
-///\brief Walks through all the garbage collection routines for the
-/// library, which are supposed to free any unused memory they
-/// have allocated.
+// Function: H5Library::garbageCollect (static)
+///\brief Walks through all the garbage collection routines for the
+/// library, which are supposed to free any unused memory they
+/// have allocated.
///
-///\exception H5::LibraryIException
+///\exception H5::LibraryIException
///\par Description
-/// It is not required that H5Library::garbageCollect be called
-/// at any particular time; it is only necessary in certain
-/// situations, such as when the application has performed actions
-/// that cause the library to allocate many objects. The
-/// application should call H5Library::garbageCollect if it
-/// eventually releases those objects and wants to reduce the
-/// memory used by the library from the peak usage required.
+/// It is not required that H5Library::garbageCollect be called
+/// at any particular time; it is only necessary in certain
+/// situations, such as when the application has performed actions
+/// that cause the library to allocate many objects. The
+/// application should call H5Library::garbageCollect if it
+/// eventually releases those objects and wants to reduce the
+/// memory used by the library from the peak usage required.
///\par
-/// The library automatically garbage collects all the free
-/// lists when the application ends.
-// Programmer Binh-Minh Ribler - May, 2004
+/// The library automatically garbage collects all the free
+/// lists when the application ends.
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Library::garbageCollect()
{
- herr_t ret_value = H5garbage_collect();
- if( ret_value < 0 )
- {
- throw LibraryIException("H5Library::garbageCollect", "H5garbage_collect failed");
- }
+ herr_t ret_value = H5garbage_collect();
+ if (ret_value < 0)
+ {
+ throw LibraryIException("H5Library::garbageCollect", "H5garbage_collect failed");
+ }
}
//--------------------------------------------------------------------------
// Function: H5Library::initH5cpp (static)
///\brief Initializes C++ library and registers terminating functions at
-/// exit. Only for the library functions, not for user-defined
-/// functions.
+/// exit. Only for the library functions, not for user-defined
+/// functions.
// Description
// initH5cpp registers the following functions with std::atexit():
// termH5cpp() - calls H5close() after all cleanup in
@@ -231,45 +231,45 @@ void H5Library::termH5cpp()
}
//--------------------------------------------------------------------------
-// Function: H5Library::setFreeListLimits (static)
-///\brief Sets limits on the different kinds of free lists.
-///\param reg_global_lim - IN: Limit on all "regular" free list memory used
-///\param reg_list_lim - IN: Limit on memory used in each "regular" free list
-///\param arr_global_lim - IN: Limit on all "array" free list memory used
-///\param arr_list_lim - IN: Limit on memory used in each "array" free list
-///\param blk_global_lim - IN: Limit on all "block" free list memory used
-///\param blk_list_lim - IN: Limit on memory used in each "block" free list
-///\exception H5::LibraryIException
+// Function: H5Library::setFreeListLimits (static)
+///\brief Sets limits on the different kinds of free lists.
+///\param reg_global_lim - IN: Limit on all "regular" free list memory used
+///\param reg_list_lim - IN: Limit on memory used in each "regular" free list
+///\param arr_global_lim - IN: Limit on all "array" free list memory used
+///\param arr_list_lim - IN: Limit on memory used in each "array" free list
+///\param blk_global_lim - IN: Limit on all "block" free list memory used
+///\param blk_list_lim - IN: Limit on memory used in each "block" free list
+///\exception H5::LibraryIException
///\par Description
-/// Setting a value of -1 for a limit means no limit of that type.
-/// For more information on free list limits, please refer to C
-/// layer Reference Manual at:
+/// Setting a value of -1 for a limit means no limit of that type.
+/// For more information on free list limits, please refer to C
+/// layer Reference Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-SetFreeListLimits
-// Programmer Binh-Minh Ribler - May, 2004
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim,
- int arr_global_lim, int arr_list_lim, int blk_global_lim,
- int blk_list_lim)
+ int arr_global_lim, int arr_list_lim, int blk_global_lim,
+ int blk_list_lim)
{
- herr_t ret_value = H5set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim, blk_global_lim, blk_list_lim);
- if( ret_value < 0 )
- {
- throw LibraryIException("H5Library::setFreeListLimits", "H5set_free_list_limits failed");
- }
+ herr_t ret_value = H5set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim, blk_global_lim, blk_list_lim);
+ if (ret_value < 0)
+ {
+ throw LibraryIException("H5Library::setFreeListLimits", "H5set_free_list_limits failed");
+ }
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5Library default constructor - private
-///\brief Default constructor: Creates a stub H5Library object
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Library default constructor - private
+///\brief Default constructor: Creates a stub H5Library object
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5Library::H5Library(){}
//--------------------------------------------------------------------------
-// Function: H5Library destructor
-///\brief Noop destructor
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Library destructor
+///\brief Noop destructor
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5Library::~H5Library(){}
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5Library.h b/c++/src/H5Library.h
index 694b052..018ba38 100644
--- a/c++/src/H5Library.h
+++ b/c++/src/H5Library.h
@@ -27,32 +27,32 @@ namespace H5 {
*/
class H5_DLLCPP H5Library {
public:
- // Initializes the HDF5 library.
- static void open();
+ // Initializes the HDF5 library.
+ static void open();
- // Flushes all data to disk, closes files, and cleans up memory.
- static void close();
+ // Flushes all data to disk, closes files, and cleans up memory.
+ static void close();
- // Instructs library not to install atexit cleanup routine
- static void dontAtExit();
+ // Instructs library not to install atexit cleanup routine
+ static void dontAtExit();
- // Returns the HDF library release number.
- static void getLibVersion( unsigned& majnum, unsigned& minnum, unsigned& relnum );
+ // Returns the HDF library release number.
+ static void getLibVersion(unsigned& majnum, unsigned& minnum, unsigned& relnum);
- // Verifies that the arguments match the version numbers compiled
- // into the library
- static void checkVersion( unsigned majnum, unsigned minnum, unsigned relnum );
+ // Verifies that the arguments match the version numbers compiled
+ // into the library
+ static void checkVersion(unsigned majnum, unsigned minnum, unsigned relnum);
- // Walks through all the garbage collection routines for the library,
- // which are supposed to free any unused memory they have allocated.
- static void garbageCollect();
+ // Walks through all the garbage collection routines for the library,
+ // which are supposed to free any unused memory they have allocated.
+ static void garbageCollect();
- // Sets limits on the different kinds of free lists.
- static void setFreeListLimits(int reg_global_lim, int reg_list_lim, int
- arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim);
+ // Sets limits on the different kinds of free lists.
+ static void setFreeListLimits(int reg_global_lim, int reg_list_lim, int
+ arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim);
// Initializes C++ library and registers terminating functions at exit.
- // Only for the library functions, not for user-defined functions.
+ // Only for the library functions, not for user-defined functions.
static void initH5cpp(void);
// Sends request for terminating the HDF5 library.
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index a3e6738..5a0bb73 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -15,7 +15,7 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -40,17 +40,17 @@ namespace H5 {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5Location default constructor (protected)
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location default constructor (protected)
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5Location::H5Location() : IdComponent() {}
//--------------------------------------------------------------------------
-// Function: H5Location overloaded constructor (protected)
-// Purpose Creates an H5Location object using the id of an existing HDF5
-// object.
-// Parameters object_id - IN: Id of an existing HDF5 object
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location overloaded constructor (protected)
+// Purpose Creates an H5Location object using the id of an existing HDF5
+// object.
+// Parameters object_id - IN: Id of an existing HDF5 object
+// Programmer Binh-Minh Ribler - 2000
// *** Deprecation warning ***
// This constructor is no longer appropriate because the data member "id" had
@@ -62,11 +62,11 @@ H5Location::H5Location() : IdComponent() {}
// H5Location::H5Location(const hid_t object_id) : IdComponent() {}
//--------------------------------------------------------------------------
-// Function: H5Location copy constructor
-// Purpose: This noop copy constructor is removed as a result of the data
-// member "id" being moved down to sub-classes. (Mar 2015)
-///\param original - IN: H5Location instance to copy
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location copy constructor
+// Purpose This noop copy constructor is removed as a result of the data
+// member "id" being moved down to sub-classes. (Mar 2015)
+///\param original - IN: H5Location instance to copy
+// Programmer Binh-Minh Ribler - 2000
//
// *** Deprecation warning ***
// This constructor is no longer appropriate because the data member "id" had
@@ -78,34 +78,34 @@ H5Location::H5Location() : IdComponent() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5Location::exists
-///\brief Checks if a link of a given name exists in a location
-///\param name - IN: Searched name
-///\param lapl - IN: Link access property list
-///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - Nov, 2016
+// Function: H5Location::exists
+///\brief Checks if a link of a given name exists in a location
+///\param name - IN: Searched name
+///\param lapl - IN: Link access property list
+///\exception H5::LocationException
+// Programmer Binh-Minh Ribler - Nov, 2016
// Modification
//--------------------------------------------------------------------------
bool H5Location::exists(const char* name, const LinkAccPropList& lapl) const
{
htri_t ret_value = H5Lexists(getId(), name, lapl.getId());
if (ret_value > 0)
- return true;
+ return true;
else if (ret_value == 0)
- return false;
+ return false;
else // Raise exception when H5Lexists returns a negative value
{
- throwException("exists", "H5Lexists failed");
+ throwException("exists", "H5Lexists failed");
}
}
//--------------------------------------------------------------------------
-// Function: H5Location::exists
-///\brief Checks if a link of a given name exists in a location
-///\param name - IN: Searched name
-///\param lapl - IN: Link access property list
-///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - Dec, 2016
+// Function: H5Location::exists
+///\brief Checks if a link of a given name exists in a location
+///\param name - IN: Searched name
+///\param lapl - IN: Link access property list
+///\exception H5::LocationException
+// Programmer Binh-Minh Ribler - Dec, 2016
// Modification
//--------------------------------------------------------------------------
bool H5Location::exists(const H5std_string& name, const LinkAccPropList& lapl) const
@@ -114,156 +114,156 @@ bool H5Location::exists(const H5std_string& name, const LinkAccPropList& lapl) c
}
//--------------------------------------------------------------------------
-// Function: H5Location::flush
-///\brief Flushes all buffers associated with a location to disk.
-///\param scope - IN: Specifies the scope of the flushing action,
-/// which can be either of these values:
-/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file
-/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file
-///\exception H5::Exception
+// Function: H5Location::flush
+///\brief Flushes all buffers associated with a location to disk.
+///\param scope - IN: Specifies the scope of the flushing action,
+/// which can be either of these values:
+/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file
+/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file
+///\exception H5::Exception
///\par Description
-/// This location is used to identify the file to be flushed.
-// Programmer Binh-Minh Ribler - 2012
+/// This location is used to identify the file to be flushed.
+// Programmer Binh-Minh Ribler - 2012
// Modification
-// Sep 2012 - BMR
-// Moved from H5File/H5Object
+// Sep 2012 - BMR
+// Moved from H5File/H5Object
//--------------------------------------------------------------------------
void H5Location::flush(H5F_scope_t scope) const
{
- herr_t ret_value = H5Fflush(getId(), scope);
- if( ret_value < 0 )
- {
- throw LocationException(inMemFunc("flush"), "H5Fflush failed");
- }
+ herr_t ret_value = H5Fflush(getId(), scope);
+ if (ret_value < 0)
+ {
+ throw LocationException(inMemFunc("flush"), "H5Fflush failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: H5Location::getFileName
-///\brief Gets the name of the file, in which this HDF5 object belongs.
-///\return File name
-///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - Jul, 2004
+// Function: H5Location::getFileName
+///\brief Gets the name of the file, in which this HDF5 object belongs.
+///\return File name
+///\exception H5::LocationException
+// Programmer Binh-Minh Ribler - Jul, 2004
//--------------------------------------------------------------------------
H5std_string H5Location::getFileName() const
{
- try {
+ try {
return(p_get_file_name());
- }
- catch (LocationException& E) {
- throw FileIException(inMemFunc("getFileName"), E.getDetailMsg());
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::setComment
-///\brief Sets or resets the comment for an object specified by its name.
-///\param name - IN: Name of the object
-///\param comment - IN: New comment
-///\exception H5::LocationException
-///\par Description
-/// If \a comment is an empty string or a null pointer, the comment
-/// message is removed from the object.
-/// Comments should be relatively short, null-terminated, ASCII
-/// strings. They can be attached to any object that has an
-/// object header, e.g., data sets, groups, named data types,
-/// and data spaces, but not symbolic links.
-// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
+ }
+ catch (LocationException& E) {
+ throw FileIException(inMemFunc("getFileName"), E.getDetailMsg());
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::setComment
+///\brief Sets or resets the comment for an object specified by its name.
+///\param name - IN: Name of the object
+///\param comment - IN: New comment
+///\exception H5::LocationException
+///\par Description
+/// If \a comment is an empty string or a null pointer, the comment
+/// message is removed from the object.
+/// Comments should be relatively short, null-terminated, ASCII
+/// strings. They can be attached to any object that has an
+/// object header, e.g., data sets, groups, named data types,
+/// and data spaces, but not symbolic links.
+// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
// Modification
-// 2007: QAK modified to use H5O APIs; however the first parameter is
-// no longer just file or group, this function should be moved
-// to another class to accommodate attribute, dataset, and named
-// datatype. - BMR
+// 2007: QAK modified to use H5O APIs; however the first parameter is
+// no longer just file or group, this function should be moved
+// to another class to accommodate attribute, dataset, and named
+// datatype. - BMR
//--------------------------------------------------------------------------
void H5Location::setComment(const char* name, const char* comment) const
{
- herr_t ret_value = H5Oset_comment_by_name(getId(), name, comment, H5P_DEFAULT);
- if( ret_value < 0 )
- throw LocationException(inMemFunc("setComment"), "H5Oset_comment_by_name failed");
+ herr_t ret_value = H5Oset_comment_by_name(getId(), name, comment, H5P_DEFAULT);
+ if (ret_value < 0)
+ throw LocationException(inMemFunc("setComment"), "H5Oset_comment_by_name failed");
}
//--------------------------------------------------------------------------
-// Function: H5Location::setComment
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name and \a comment.
-// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
+// Function: H5Location::setComment
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name and \a comment.
+// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
//--------------------------------------------------------------------------
void H5Location::setComment(const H5std_string& name, const H5std_string& comment) const
{
- setComment(name.c_str(), comment.c_str());
+ setComment(name.c_str(), comment.c_str());
}
//--------------------------------------------------------------------------
-// Function: H5Location::setComment
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it doesn't take
-/// an object name.
-// Programmer Binh-Minh Ribler - Sep 2013
+// Function: H5Location::setComment
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it doesn't take
+/// an object name.
+// Programmer Binh-Minh Ribler - Sep 2013
// Modification
//--------------------------------------------------------------------------
void H5Location::setComment(const char* comment) const
{
- herr_t ret_value = H5Oset_comment_by_name(getId(), ".", comment, H5P_DEFAULT);
- if( ret_value < 0 )
- throw LocationException(inMemFunc("setComment"), "H5Oset_comment_by_name failed");
+ herr_t ret_value = H5Oset_comment_by_name(getId(), ".", comment, H5P_DEFAULT);
+ if (ret_value < 0)
+ throw LocationException(inMemFunc("setComment"), "H5Oset_comment_by_name failed");
}
//--------------------------------------------------------------------------
-// Function: H5Location::setComment
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a comment.
-// Programmer Binh-Minh Ribler - Sep 2013
+// Function: H5Location::setComment
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a comment.
+// Programmer Binh-Minh Ribler - Sep 2013
//--------------------------------------------------------------------------
void H5Location::setComment(const H5std_string& comment) const
{
- setComment(comment.c_str());
+ setComment(comment.c_str());
}
//--------------------------------------------------------------------------
-// Function: H5Location::removeComment
-///\brief Removes the comment from an object specified by its name.
-///\param name - IN: Name of the object
-///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013)
-// 2007: QAK modified to use H5O APIs; however the first parameter is
-// no longer just file or group, this function should be moved
-// to another class to accommodate attribute, dataset, and named
-// datatype. - BMR
+// Function: H5Location::removeComment
+///\brief Removes the comment from an object specified by its name.
+///\param name - IN: Name of the object
+///\exception H5::LocationException
+// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013)
+// 2007: QAK modified to use H5O APIs; however the first parameter is
+// no longer just file or group, this function should be moved
+// to another class to accommodate attribute, dataset, and named
+// datatype. - BMR
//--------------------------------------------------------------------------
void H5Location::removeComment(const char* name) const
{
- herr_t ret_value = H5Oset_comment_by_name(getId(), name, NULL, H5P_DEFAULT);
- if( ret_value < 0 )
- throw LocationException(inMemFunc("removeComment"), "H5Oset_comment_by_name failed");
+ herr_t ret_value = H5Oset_comment_by_name(getId(), name, NULL, H5P_DEFAULT);
+ if (ret_value < 0)
+ throw LocationException(inMemFunc("removeComment"), "H5Oset_comment_by_name failed");
}
//--------------------------------------------------------------------------
-// Function: H5Location::removeComment
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013)
+// Function: H5Location::removeComment
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013)
//--------------------------------------------------------------------------
void H5Location::removeComment(const H5std_string& name) const
{
- removeComment (name.c_str());
+ removeComment (name.c_str());
}
//--------------------------------------------------------------------------
-// Function: H5Location::getComment
-///\brief Retrieves the comment for this location, returning its length.
-///\param name - IN: Name of the object
-///\param buf_size - IN: Length of the comment to retrieve
-///\param comment - OUT: Retrieved comment
-///\return Actual length of the comment
-///\exception H5::LocationException
+// Function: H5Location::getComment
+///\brief Retrieves the comment for this location, returning its length.
+///\param name - IN: Name of the object
+///\param buf_size - IN: Length of the comment to retrieve
+///\param comment - OUT: Retrieved comment
+///\return Actual length of the comment
+///\exception H5::LocationException
///\par Description
-/// This function retrieves \a buf_size characters of the comment
-/// including the null terminator. Thus, if the actual length
-/// of the comment is more than buf_size-1, the retrieved comment
-/// will be truncated to accommodate the null terminator.
-// Programmer Binh-Minh Ribler - Mar 2014
+/// This function retrieves \a buf_size characters of the comment
+/// including the null terminator. Thus, if the actual length
+/// of the comment is more than buf_size-1, the retrieved comment
+/// will be truncated to accommodate the null terminator.
+// Programmer Binh-Minh Ribler - Mar 2014
//--------------------------------------------------------------------------
ssize_t H5Location::getComment(const char* name, size_t buf_size, char* comment) const
{
@@ -274,27 +274,27 @@ ssize_t H5Location::getComment(const char* name, size_t buf_size, char* comment)
// If H5Oget_comment_by_name returns a negative value, raise an exception
if (comment_len < 0)
- {
+ {
throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed");
}
// If the comment is longer than the provided buffer size, the C library
// will not null terminate it
if (static_cast<size_t>(comment_len) >= buf_size)
- comment[buf_size-1] = '\0';
+ comment[buf_size-1] = '\0';
// Return the actual comment length, which might be different from buf_size
return(comment_len);
}
//--------------------------------------------------------------------------
-// Function: H5Location::getComment
-///\brief Returns the comment as \a string for this location,
-/// returning its length.
-///\param name - IN: Name of the object
-///\param buf_size - IN: Length of the comment to retrieve, default to 0
-///\return Comment string
-///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
+// Function: H5Location::getComment
+///\brief Returns the comment as \a string for this location,
+/// returning its length.
+///\param name - IN: Name of the object
+///\param buf_size - IN: Length of the comment to retrieve, default to 0
+///\return Comment string
+///\exception H5::LocationException
+// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
//--------------------------------------------------------------------------
H5std_string H5Location::getComment(const char* name, size_t buf_size) const
{
@@ -307,36 +307,36 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
// If H5Oget_comment_by_name returns a negative value, raise an exception
if (comment_len < 0)
- {
+ {
throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed");
}
// If comment exists, calls C routine again to get it
else if (comment_len > 0)
- {
- size_t tmp_len = buf_size;
-
- // If buffer size is not provided, use comment length
- if (tmp_len == 0)
- tmp_len = comment_len;
-
- // Temporary buffer for char* comment
- char* comment_C = new char[tmp_len+1];
- HDmemset(comment_C, 0, tmp_len+1); // clear buffer
-
- // Used overloaded function
- ssize_t temp_len = getComment(name, tmp_len+1, comment_C);
- if (temp_len < 0)
- {
- delete []comment_C;
- throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed");
- }
-
- // Convert the C comment to return
- comment = comment_C;
-
- // Clean up resource
- delete []comment_C;
+ {
+ size_t tmp_len = buf_size;
+
+ // If buffer size is not provided, use comment length
+ if (tmp_len == 0)
+ tmp_len = comment_len;
+
+ // Temporary buffer for char* comment
+ char* comment_C = new char[tmp_len+1];
+ HDmemset(comment_C, 0, tmp_len+1); // clear buffer
+
+ // Used overloaded function
+ ssize_t temp_len = getComment(name, tmp_len+1, comment_C);
+ if (temp_len < 0)
+ {
+ delete []comment_C;
+ throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed");
+ }
+
+ // Convert the C comment to return
+ comment = comment_C;
+
+ // Clean up resource
+ delete []comment_C;
}
// Return the string comment
@@ -344,11 +344,11 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
}
//--------------------------------------------------------------------------
-// Function: H5Location::getComment
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
+// Function: H5Location::getComment
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013)
//--------------------------------------------------------------------------
H5std_string H5Location::getComment(const H5std_string& name, size_t buf_size) const
{
@@ -357,112 +357,112 @@ H5std_string H5Location::getComment(const H5std_string& name, size_t buf_size) c
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5Location::p_reference (protected)
-// Purpose Creates a reference to an HDF5 object or a dataset region.
+// Function: H5Location::p_reference (protected)
+// Purpose Creates a reference to an HDF5 object or a dataset region.
// Parameters
-// name - IN: Name of the object to be referenced
-// dataspace - IN: Dataspace with selection
-// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION
-// Exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - May, 2004
+// name - IN: Name of the object to be referenced
+// dataspace - IN: Dataspace with selection
+// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION
+// Exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Location::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const
{
- herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id);
- if (ret_value < 0)
- {
- throw ReferenceException(inMemFunc("reference"), "H5Rcreate failed");
- }
+ herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id);
+ if (ret_value < 0)
+ {
+ throw ReferenceException(inMemFunc("reference"), "H5Rcreate failed");
+ }
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5Location::reference
-///\brief Creates a reference to an HDF5 object or a dataset region.
-///\param ref - IN: Reference pointer
-///\param name - IN: Name of the object to be referenced
-///\param dataspace - IN: Dataspace with selection
-///\param ref_type - IN: Type of reference to query, valid values are:
-/// \li \c H5R_OBJECT - Reference is an object reference.
-/// \li \c H5R_DATASET_REGION - Reference is a dataset region
-/// reference. (default)
-///\exception H5::ReferenceException
-///\note This method is more suitable for a dataset region reference.
-// Programmer Binh-Minh Ribler - May, 2004
+// Function: H5Location::reference
+///\brief Creates a reference to an HDF5 object or a dataset region.
+///\param ref - IN: Reference pointer
+///\param name - IN: Name of the object to be referenced
+///\param dataspace - IN: Dataspace with selection
+///\param ref_type - IN: Type of reference to query, valid values are:
+/// \li \c H5R_OBJECT - Reference is an object reference.
+/// \li \c H5R_DATASET_REGION - Reference is a dataset region
+/// reference. (default)
+///\exception H5::ReferenceException
+///\note This method is more suitable for a dataset region reference.
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Location::reference(void* ref, const char* name, const DataSpace& dataspace, H5R_type_t ref_type) const
{
- try {
- p_reference(ref, name, dataspace.getId(), ref_type);
- }
- catch (ReferenceException& E) {
- throw ReferenceException(inMemFunc("reference"), E.getDetailMsg());
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::reference
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-///\param ref - IN: Reference pointer
-///\param name - IN: Name of the object to be referenced
-///\param dataspace - IN: Dataspace with selection
-///\param ref_type - IN: Type of reference to query, valid values are:
-/// \li \c H5R_OBJECT - Reference is an object reference.
-/// \li \c H5R_DATASET_REGION - Reference is a dataset region
-/// reference. (default)
-///\exception H5::ReferenceException
-///\note This method is more suitable for a dataset region reference.
-// Programmer Binh-Minh Ribler - May, 2004
+ try {
+ p_reference(ref, name, dataspace.getId(), ref_type);
+ }
+ catch (ReferenceException& E) {
+ throw ReferenceException(inMemFunc("reference"), E.getDetailMsg());
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::reference
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+///\param ref - IN: Reference pointer
+///\param name - IN: Name of the object to be referenced
+///\param dataspace - IN: Dataspace with selection
+///\param ref_type - IN: Type of reference to query, valid values are:
+/// \li \c H5R_OBJECT - Reference is an object reference.
+/// \li \c H5R_DATASET_REGION - Reference is a dataset region
+/// reference. (default)
+///\exception H5::ReferenceException
+///\note This method is more suitable for a dataset region reference.
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Location::reference(void* ref, const H5std_string& name, const DataSpace& dataspace, H5R_type_t ref_type) const
{
- try {
- p_reference(ref, name.c_str(), dataspace.getId(), ref_type);
- }
- catch (ReferenceException& E) {
- throw ReferenceException(inMemFunc("reference"), E.getDetailMsg());
- }
+ try {
+ p_reference(ref, name.c_str(), dataspace.getId(), ref_type);
+ }
+ catch (ReferenceException& E) {
+ throw ReferenceException(inMemFunc("reference"), E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: H5Location::reference
-///\brief This is an overloaded function, provided for your convenience.
-/// It differs from the above function in that it does not take
-/// a DataSpace object and the reference type must be specified.
-///\param ref - IN: Reference pointer
-///\param name - IN: Name of the object to be referenced
-///\param ref_type - IN: Type of reference to query, valid values are:
-/// \li \c H5R_OBJECT - Reference is an object reference (default)
-/// \li \c H5R_DATASET_REGION - Reference is a dataset region
-///\exception H5::ReferenceException
-///\note This method is more suitable for an object reference.
-// Programmer Binh-Minh Ribler - May, 2004
+// Function: H5Location::reference
+///\brief This is an overloaded function, provided for your convenience.
+/// It differs from the above function in that it does not take
+/// a DataSpace object and the reference type must be specified.
+///\param ref - IN: Reference pointer
+///\param name - IN: Name of the object to be referenced
+///\param ref_type - IN: Type of reference to query, valid values are:
+/// \li \c H5R_OBJECT - Reference is an object reference (default)
+/// \li \c H5R_DATASET_REGION - Reference is a dataset region
+///\exception H5::ReferenceException
+///\note This method is more suitable for an object reference.
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Location::reference(void* ref, const char* name, H5R_type_t ref_type) const
{
- try {
- p_reference(ref, name, -1, ref_type);
- }
- catch (ReferenceException& E) {
- throw ReferenceException(inMemFunc("reference"), E.getDetailMsg());
- }
+ try {
+ p_reference(ref, name, -1, ref_type);
+ }
+ catch (ReferenceException& E) {
+ throw ReferenceException(inMemFunc("reference"), E.getDetailMsg());
+ }
}
//--------------------------------------------------------------------------
-// Function: H5Location::reference
-///\brief This is an overloaded function, provided for your convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for the object's name.
-///\param ref - IN: Reference pointer
-///\param name - IN: Name of the object to be referenced - \c H5std_string
-///\param ref_type - IN: Type of reference to query, valid values are:
-/// \li \c H5R_OBJECT - Reference is an object reference (default)
-/// \li \c H5R_DATASET_REGION - Reference is a dataset region
-///\note This method is more suitable for an object reference.
-// Programmer Binh-Minh Ribler - May, 2004
+// Function: H5Location::reference
+///\brief This is an overloaded function, provided for your convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for the object's name.
+///\param ref - IN: Reference pointer
+///\param name - IN: Name of the object to be referenced - \c H5std_string
+///\param ref_type - IN: Type of reference to query, valid values are:
+/// \li \c H5R_OBJECT - Reference is an object reference (default)
+/// \li \c H5R_DATASET_REGION - Reference is a dataset region
+///\note This method is more suitable for an object reference.
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_type) const
{
@@ -471,69 +471,69 @@ void H5Location::reference(void* ref, const H5std_string& name, H5R_type_t ref_t
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5Location::p_dereference (protected)
-// Purpose Dereference a ref into an hdf5 object.
+// Function: H5Location::p_dereference (protected)
+// Purpose Dereference a ref into an hdf5 object.
// Parameters
-// loc_id - IN: An hdf5 identifier specifying the location of the
-// referenced object
-// ref - IN: Reference pointer
-// ref_type - IN: Reference type
-// plist - IN: Property list - default to PropList::DEFAULT
-// from_func - IN: Name of the calling function
-// Exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
+// loc_id - IN: An hdf5 identifier specifying the location of the
+// referenced object
+// ref - IN: Reference pointer
+// ref_type - IN: Reference type
+// plist - IN: Property list - default to PropList::DEFAULT
+// from_func - IN: Name of the calling function
+// Exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
-// May 2008 - BMR
-// Moved from IdComponent.
+// May 2008 - BMR
+// Moved from IdComponent.
//--------------------------------------------------------------------------
hid_t H5Location::p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist, const char* from_func)
{
- hid_t plist_id;
- if (p_valid_id(plist.getId()))
- plist_id = plist.getId();
- else
- plist_id = H5P_DEFAULT;
+ hid_t plist_id;
+ if (p_valid_id(plist.getId()))
+ plist_id = plist.getId();
+ else
+ plist_id = H5P_DEFAULT;
- hid_t temp_id = H5Rdereference2(loc_id, plist_id, ref_type, ref);
- if (temp_id < 0)
- {
- throw ReferenceException(inMemFunc(from_func), "H5Rdereference failed");
- }
+ hid_t temp_id = H5Rdereference2(loc_id, plist_id, ref_type, ref);
+ if (temp_id < 0)
+ {
+ throw ReferenceException(inMemFunc(from_func), "H5Rdereference failed");
+ }
- return(temp_id);
+ return(temp_id);
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5Location::dereference
-///\brief Dereferences a reference into an HDF5 object, given an HDF5 object.
-///\param loc - IN: Location of the referenced object
-///\param ref - IN: Reference pointer
-///\param ref_type - IN: Reference type
-///\param plist - IN: Property list - default to PropList::DEFAULT
-///\exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
+// Function: H5Location::dereference
+///\brief Dereferences a reference into an HDF5 object, given an HDF5 object.
+///\param loc - IN: Location of the referenced object
+///\param ref - IN: Reference pointer
+///\param ref_type - IN: Reference type
+///\param plist - IN: Property list - default to PropList::DEFAULT
+///\exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
-// May, 2008
-// Corrected missing parameters. - BMR
+// May, 2008
+// Corrected missing parameters. - BMR
//--------------------------------------------------------------------------
void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist)
{
- p_setId(p_dereference(loc.getId(), ref, ref_type, plist, "dereference"));
+ p_setId(p_dereference(loc.getId(), ref, ref_type, plist, "dereference"));
}
//--------------------------------------------------------------------------
-// Function: H5Location::dereference
-///\brief Dereferences a reference into an HDF5 object, given an attribute.
-///\param attr - IN: Attribute specifying the location of the referenced object
-///\param ref - IN: Reference pointer
-///\param ref_type - IN: Reference type
-///\param plist - IN: Property list - default to PropList::DEFAULT
-///\exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
+// Function: H5Location::dereference
+///\brief Dereferences a reference into an HDF5 object, given an attribute.
+///\param attr - IN: Attribute specifying the location of the referenced object
+///\param ref - IN: Reference pointer
+///\param ref_type - IN: Reference type
+///\param plist - IN: Property list - default to PropList::DEFAULT
+///\exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - Oct, 2006
// Modification
-// May, 2008
-// Corrected missing parameters. - BMR
+// May, 2008
+// Corrected missing parameters. - BMR
//--------------------------------------------------------------------------
/* void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist)
{
@@ -543,153 +543,152 @@ void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
-// Function: H5Location::getObjType
-///\brief Retrieves the type of object that an object reference points to.
-///\param ref_type - IN: Type of reference to query, valid values are:
-/// \li \c H5R_OBJECT - Reference is an object reference.
-/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference.
-///\param ref - IN: Reference to query
-///\return An object type, which can be one of the following:
-/// \li \c H5G_UNKNOWN - A failure occurs. (-1)
-/// \li \c H5G_GROUP - Object is a group.
-/// \li \c H5G_DATASET - Object is a dataset.
-/// \li \c H5G_TYPE Object - is a named datatype
-/// \li \c H5G_LINK - Object is a symbolic link.
-/// \li \c H5G_UDLINK - Object is a user-defined link.
-///\exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - May, 2004
+// Function: H5Location::getObjType
+///\brief Retrieves the type of object that an object reference points to.
+///\param ref_type - IN: Type of reference to query, valid values are:
+/// \li \c H5R_OBJECT - Reference is an object reference.
+/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference.
+///\param ref - IN: Reference to query
+///\return An object type, which can be one of the following:
+/// \li \c H5G_UNKNOWN - A failure occurs. (-1)
+/// \li \c H5G_GROUP - Object is a group.
+/// \li \c H5G_DATASET - Object is a dataset.
+/// \li \c H5G_TYPE Object - is a named datatype
+/// \li \c H5G_LINK - Object is a symbolic link.
+/// \li \c H5G_UDLINK - Object is a user-defined link.
+///\exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - May, 2004
// Modification
-// Sep 2012: Moved up from H5File, Group, DataSet, and DataType
+// Sep 2012: Moved up from H5File, Group, DataSet, and DataType
//--------------------------------------------------------------------------
H5G_obj_t H5Location::getObjType(void *ref, H5R_type_t ref_type) const
{
- try {
- return(p_get_obj_type(ref, ref_type));
- }
- catch (ReferenceException& E) {
- throw ReferenceException(inMemFunc("getObjType"), E.getDetailMsg());
- }
+ try {
+ return(p_get_obj_type(ref, ref_type));
+ }
+ catch (ReferenceException& E) {
+ throw ReferenceException(inMemFunc("getObjType"), E.getDetailMsg());
+ }
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5Location::p_get_obj_type (protected)
-// Purpose Retrieves the type of object that an object reference points to.
+// Function: H5Location::p_get_obj_type (protected)
+// Purpose Retrieves the type of object that an object reference points to.
// Parameters
-// ref - IN: Reference to query
-// ref_type - IN: Type of reference to query
-// Return An object type, which can be one of the following:
-// H5G_UNKNOWN \tFailure occurs (-1)
-// H5G_GROUP \tObject is a group.
-// H5G_DATASET \tObject is a dataset.
-// H5G_TYPE Object \tis a named datatype.
-// H5G_LINK \tObject is a symbolic link.
-// H5G_UDLINK \tObject is a user-defined link.
-// Exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - May, 2004
+// ref - IN: Reference to query
+// ref_type - IN: Type of reference to query
+// Return An object type, which can be one of the following:
+// H5G_UNKNOWN \tFailure occurs (-1)
+// H5G_GROUP \tObject is a group.
+// H5G_DATASET \tObject is a dataset.
+// H5G_TYPE Object \tis a named datatype.
+// H5G_LINK \tObject is a symbolic link.
+// H5G_UDLINK \tObject is a user-defined link.
+// Exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const
{
H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref);
-
if (obj_type == H5G_UNKNOWN)
- {
- throw ReferenceException(inMemFunc("getObjType"), "H5Rget_obj_type1 failed");
- }
+ {
+ throw ReferenceException(inMemFunc("getObjType"), "H5Rget_obj_type1 failed");
+ }
return(obj_type);
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
-// Function: H5Location::getRefObjType
-///\brief Retrieves the type of object that an object reference points to.
-///\param ref - IN: Reference to query
-///\param ref_type - IN: Type of reference to query, valid values are:
-/// \li \c H5R_OBJECT - Reference is an object reference.
-/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference.
-///\return An object type, which can be one of the following:
-/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1)
-/// \li \c H5O_TYPE_GROUP - Object is a group
-/// \li \c H5O_TYPE_DATASET - Object is a dataset
-/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype
-/// \li \c H5O_TYPE_NTYPES - Number of different object types
-///\exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - May, 2004
+// Function: H5Location::getRefObjType
+///\brief Retrieves the type of object that an object reference points to.
+///\param ref - IN: Reference to query
+///\param ref_type - IN: Type of reference to query, valid values are:
+/// \li \c H5R_OBJECT - Reference is an object reference.
+/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference.
+///\return An object type, which can be one of the following:
+/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1)
+/// \li \c H5O_TYPE_GROUP - Object is a group
+/// \li \c H5O_TYPE_DATASET - Object is a dataset
+/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype
+/// \li \c H5O_TYPE_NTYPES - Number of different object types
+///\exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const
{
- try {
+ try {
return(p_get_ref_obj_type(ref, ref_type));
- }
- catch (ReferenceException& E) {
- throw ReferenceException(inMemFunc("getRefObjType"), E.getDetailMsg());
- }
+ }
+ catch (ReferenceException& E) {
+ throw ReferenceException(inMemFunc("getRefObjType"), E.getDetailMsg());
+ }
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5Location::p_get_ref_obj_type (protected)
-// Purpose Retrieves the type of object that an object reference points to.
+// Function: H5Location::p_get_ref_obj_type (protected)
+// Purpose Retrieves the type of object that an object reference points to.
// Parameters
-// ref - IN: Reference to query
-// ref_type - IN: Type of reference to query
-// Return An object type, which can be one of the following:
-// H5O_TYPE_UNKNOWN - Unknown object type (-1)
-// H5O_TYPE_GROUP - Object is a group
-// H5O_TYPE_DATASET - Object is a dataset
-// H5O_TYPE_NAMED_DATATYPE - Object is a named datatype
-// H5O_TYPE_NTYPES - Number of object types
-// Exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - May, 2004
+// ref - IN: Reference to query
+// ref_type - IN: Type of reference to query
+// Return An object type, which can be one of the following:
+// H5O_TYPE_UNKNOWN - Unknown object type (-1)
+// H5O_TYPE_GROUP - Object is a group
+// H5O_TYPE_DATASET - Object is a dataset
+// H5O_TYPE_NAMED_DATATYPE - Object is a named datatype
+// H5O_TYPE_NTYPES - Number of object types
+// Exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const
{
- H5O_type_t obj_type = H5O_TYPE_UNKNOWN;
- herr_t ret_value = H5Rget_obj_type2(getId(), ref_type, ref, &obj_type);
- if (ret_value < 0)
- {
- throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 failed");
- }
- if (obj_type == H5O_TYPE_UNKNOWN || obj_type >= H5O_TYPE_NTYPES)
- {
- throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 returned invalid type");
- }
- return(obj_type);
+ H5O_type_t obj_type = H5O_TYPE_UNKNOWN;
+ herr_t ret_value = H5Rget_obj_type2(getId(), ref_type, ref, &obj_type);
+ if (ret_value < 0)
+ {
+ throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 failed");
+ }
+ if (obj_type == H5O_TYPE_UNKNOWN || obj_type >= H5O_TYPE_NTYPES)
+ {
+ throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 returned invalid type");
+ }
+ return(obj_type);
}
//--------------------------------------------------------------------------
-// Function: H5Location::getRegion
-///\brief Retrieves a dataspace with the region pointed to selected.
-///\param ref - IN: Reference to get region of
-///\param ref_type - IN: Type of reference to get region of - default
-// to H5R_DATASET_REGION
-///\return DataSpace object
-///\exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - May, 2004
+// Function: H5Location::getRegion
+///\brief Retrieves a dataspace with the region pointed to selected.
+///\param ref - IN: Reference to get region of
+///\param ref_type - IN: Type of reference to get region of - default
+// to H5R_DATASET_REGION
+///\return DataSpace object
+///\exception H5::ReferenceException
+// Programmer Binh-Minh Ribler - May, 2004
// Modification
-// Mar 29, 2015
-// Used friend function to set id for DataSpace instead of the
-// existing id constructor or the setId method to avoid incrementing
-// ref count, as a work-around for a problem described in the JIRA
-// issue HDFFV-7947. -BMR
+// Mar 29, 2015
+// Used friend function to set id for DataSpace instead of the
+// existing id constructor or the setId method to avoid incrementing
+// ref count, as a work-around for a problem described in the JIRA
+// issue HDFFV-7947. -BMR
//--------------------------------------------------------------------------
DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const
{
- hid_t space_id = H5Rget_region(getId(), ref_type, ref);
- if (space_id < 0)
- {
- throw ReferenceException(inMemFunc("getRegion"), "H5Rget_region failed");
- }
- try {
- DataSpace dataspace;
- f_DataSpace_setId(&dataspace, space_id);
- return(dataspace);
- }
- catch (DataSpaceIException& E) {
- throw ReferenceException(inMemFunc("getRegion"), E.getDetailMsg());
- }
+ hid_t space_id = H5Rget_region(getId(), ref_type, ref);
+ if (space_id < 0)
+ {
+ throw ReferenceException(inMemFunc("getRegion"), "H5Rget_region failed");
+ }
+ try {
+ DataSpace dataspace;
+ f_DataSpace_setId(&dataspace, space_id);
+ return(dataspace);
+ }
+ catch (DataSpaceIException& E) {
+ throw ReferenceException(inMemFunc("getRegion"), E.getDetailMsg());
+ }
}
@@ -705,11 +704,11 @@ DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const
// to call the right getId() - although, as the structure of the
// library at this time, getId() is basically the IdComponent::getId()
// ***Updated: after the classes are rearranged (HDFFV-9920), functions
-// in CommonFG are moved to Group, and they can call getId()
-// instead of getLocId(). getLocId() is kept for backward
-// compatibility on user applications. Aug 18, 2016 -BMR
+// in CommonFG are moved to Group, and they can call getId()
+// instead of getLocId(). getLocId() is kept for backward
+// compatibility on user applications. Aug 18, 2016 -BMR
// ***Updated: Moving to Group was a mistake, now to H5Location
-// Aug 24, 2016 -BMR
+// Aug 24, 2016 -BMR
// - when a failure returned by the C API, the functions will call
// throwException, which is a pure virtual function and is implemented
// by H5File to throw a FileIException and by Group to throw a
@@ -722,29 +721,29 @@ DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const
// is kept in those methods as well. Sep 17, 2016 -BMR
//--------------------------------------------------------------------------
-// Function: H5Location::createGroup
-///\brief Creates a new group at this location which can be a file
-/// or another group.
-///\param name - IN: Name of the group to create
-///\param size_hint - IN: Indicates the number of bytes to reserve for
-/// the names that will appear in the group
-///\return Group instance
-///\exception H5::FileIException or H5::GroupIException
+// Function: H5Location::createGroup
+///\brief Creates a new group at this location which can be a file
+/// or another group.
+///\param name - IN: Name of the group to create
+///\param size_hint - IN: Indicates the number of bytes to reserve for
+/// the names that will appear in the group
+///\return Group instance
+///\exception H5::FileIException or H5::GroupIException
///\par Description
-/// The optional \a size_hint specifies how much file space to
-/// reserve for storing the names that will appear in this new
-/// group. If a non-positive value is provided for the \a size_hint
-/// then a default size is chosen.
-// Programmer Binh-Minh Ribler - 2000
+/// The optional \a size_hint specifies how much file space to
+/// reserve for storing the names that will appear in this new
+/// group. If a non-positive value is provided for the \a size_hint
+/// then a default size is chosen.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::createGroup( const char* name, size_t size_hint ) const
+Group H5Location::createGroup(const char* name, size_t size_hint) const
{
// Group creation property list for size hint
hid_t gcpl_id = 0;
// Set the local heap size hint
if (size_hint > 0)
- {
+ {
// If the creation of the property list failed, throw an exception
if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0)
throwException("createGroup", "H5Pcreate failed");
@@ -755,351 +754,351 @@ Group H5Location::createGroup( const char* name, size_t size_hint ) const
}
}
- // Call C routine H5Gcreate2 to create the named group, giving the
- // location id which can be a file id or a group id
- hid_t group_id = H5Gcreate2(getId(), name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT );
+ // Call C routine H5Gcreate2 to create the named group, giving the
+ // location id which can be a file id or a group id
+ hid_t group_id = H5Gcreate2(getId(), name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT);
- // Close the group creation property list, if necessary
- if(gcpl_id > 0)
+ // Close the group creation property list, if necessary
+ if(gcpl_id > 0)
H5Pclose(gcpl_id);
- // If the creation of the group failed, throw an exception
- if( group_id < 0 )
- throwException("createGroup", "H5Gcreate2 failed");
+ // If the creation of the group failed, throw an exception
+ if (group_id < 0)
+ throwException("createGroup", "H5Gcreate2 failed");
- // No failure, create and return the Group object
- Group group;
- //group.p_setId(group_id);
- H5Location *ptr = &group;
- ptr->p_setId(group_id);
- return( group );
+ // No failure, create and return the Group object
+ Group group;
+ //group.p_setId(group_id);
+ H5Location *ptr = &group;
+ ptr->p_setId(group_id);
+ return(group);
}
//--------------------------------------------------------------------------
-// Function: H5Location::createGroup
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::createGroup
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::createGroup( const H5std_string& name, size_t size_hint ) const
+Group H5Location::createGroup(const H5std_string& name, size_t size_hint) const
{
- return( createGroup( name.c_str(), size_hint ));
+ return(createGroup( name.c_str(), size_hint));
}
//--------------------------------------------------------------------------
-// Function: H5Location::openGroup
-///\brief Opens an existing group in a location which can be a file
-/// or another group.
-///\param name - IN: Name of the group to open
-///\return Group instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::openGroup
+///\brief Opens an existing group in a location which can be a file
+/// or another group.
+///\param name - IN: Name of the group to open
+///\return Group instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::openGroup( const char* name ) const
+Group H5Location::openGroup(const char* name) const
{
- // Call C routine H5Gopen2 to open the named group, giving the
- // location id which can be a file id or a group id
- hid_t group_id = H5Gopen2(getId(), name, H5P_DEFAULT );
+ // Call C routine H5Gopen2 to open the named group, giving the
+ // location id which can be a file id or a group id
+ hid_t group_id = H5Gopen2(getId(), name, H5P_DEFAULT);
- // If the opening of the group failed, throw an exception
- if( group_id < 0 )
- throwException("openGroup", "H5Gopen2 failed");
+ // If the opening of the group failed, throw an exception
+ if (group_id < 0)
+ throwException("openGroup", "H5Gopen2 failed");
- // No failure, create and return the Group object
- Group group;
- //group.p_setId(group_id);
- H5Location *ptr = &group;
- ptr->p_setId(group_id);
- return( group );
+ // No failure, create and return the Group object
+ Group group;
+ //group.p_setId(group_id);
+ H5Location *ptr = &group;
+ ptr->p_setId(group_id);
+ return(group);
}
//--------------------------------------------------------------------------
-// Function: H5Location::openGroup
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::openGroup
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group H5Location::openGroup( const H5std_string& name ) const
+Group H5Location::openGroup(const H5std_string& name) const
{
- return( openGroup( name.c_str() ));
+ return(openGroup( name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: H5Location::createDataSet
-///\brief Creates a new dataset at this location.
-///\param name - IN: Name of the dataset to create
-///\param data_type - IN: Datatype of the dataset
-///\param data_space - IN: Dataspace for the dataset
-///\param create_plist - IN: Creation properly list for the dataset
-///\return DataSet instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::createDataSet
+///\brief Creates a new dataset at this location.
+///\param name - IN: Name of the dataset to create
+///\param data_type - IN: Datatype of the dataset
+///\param data_space - IN: Dataspace for the dataset
+///\param create_plist - IN: Creation properly list for the dataset
+///\return DataSet instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSet H5Location::createDataSet( const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const
+DataSet H5Location::createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist) const
{
// Obtain identifiers for C API
- hid_t type_id = data_type.getId();
- hid_t space_id = data_space.getId();
- hid_t create_plist_id = create_plist.getId();
+ hid_t type_id = data_type.getId();
+ hid_t space_id = data_space.getId();
+ hid_t create_plist_id = create_plist.getId();
- // Call C routine H5Dcreate2 to create the named dataset
- hid_t dataset_id = H5Dcreate2(getId(), name, type_id, space_id, H5P_DEFAULT, create_plist_id, H5P_DEFAULT );
+ // Call C routine H5Dcreate2 to create the named dataset
+ hid_t dataset_id = H5Dcreate2(getId(), name, type_id, space_id, H5P_DEFAULT, create_plist_id, H5P_DEFAULT);
- // If the creation of the dataset failed, throw an exception
- if( dataset_id < 0 )
- throwException("createDataSet", "H5Dcreate2 failed");
+ // If the creation of the dataset failed, throw an exception
+ if (dataset_id < 0)
+ throwException("createDataSet", "H5Dcreate2 failed");
- // No failure, create and return the DataSet object
- DataSet dataset;
- f_DataSet_setId(&dataset, dataset_id);
- return( dataset );
+ // No failure, create and return the DataSet object
+ DataSet dataset;
+ f_DataSet_setId(&dataset, dataset_id);
+ return(dataset);
}
//--------------------------------------------------------------------------
-// Function: H5Location::createDataSet
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::createDataSet
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSet H5Location::createDataSet( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist ) const
+DataSet H5Location::createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist) const
{
- return( createDataSet( name.c_str(), data_type, data_space, create_plist ));
+ return(createDataSet( name.c_str(), data_type, data_space, create_plist));
}
//--------------------------------------------------------------------------
-// Function: H5Location::openDataSet
-///\brief Opens an existing dataset at this location.
-///\param name - IN: Name of the dataset to open
-///\return DataSet instance
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::openDataSet
+///\brief Opens an existing dataset at this location.
+///\param name - IN: Name of the dataset to open
+///\return DataSet instance
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSet H5Location::openDataSet( const char* name ) const
+DataSet H5Location::openDataSet(const char* name) const
{
- // Call C function H5Dopen2 to open the specified dataset, giving
- // the location id and the dataset's name
- hid_t dataset_id = H5Dopen2(getId(), name, H5P_DEFAULT );
+ // Call C function H5Dopen2 to open the specified dataset, giving
+ // the location id and the dataset's name
+ hid_t dataset_id = H5Dopen2(getId(), name, H5P_DEFAULT);
- // If the dataset's opening failed, throw an exception
- if(dataset_id < 0)
- throwException("openDataSet", "H5Dopen2 failed");
+ // If the dataset's opening failed, throw an exception
+ if(dataset_id < 0)
+ throwException("openDataSet", "H5Dopen2 failed");
- // No failure, create and return the DataSet object
- DataSet dataset;
- f_DataSet_setId(&dataset, dataset_id);
- return( dataset );
+ // No failure, create and return the DataSet object
+ DataSet dataset;
+ f_DataSet_setId(&dataset, dataset_id);
+ return(dataset);
}
//--------------------------------------------------------------------------
-// Function: H5Location::openDataSet
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::openDataSet
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSet H5Location::openDataSet( const H5std_string& name ) const
+DataSet H5Location::openDataSet(const H5std_string& name) const
{
- return( openDataSet( name.c_str() ));
+ return(openDataSet( name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: H5Location::link
-///\brief Creates a link of the specified type from \a new_name to
-/// \a curr_name.
-///\param link_type - IN: Link type; possible values are
-/// \li \c H5G_LINK_HARD
-/// \li \c H5G_LINK_SOFT
-///\param curr_name - IN: Name of the existing object if link is a hard
-/// link; can be anything for the soft link
-///\param new_name - IN: New name for the object
-///\exception H5::FileIException or H5::GroupIException
+// Function: H5Location::link
+///\brief Creates a link of the specified type from \a new_name to
+/// \a curr_name.
+///\param link_type - IN: Link type; possible values are
+/// \li \c H5G_LINK_HARD
+/// \li \c H5G_LINK_SOFT
+///\param curr_name - IN: Name of the existing object if link is a hard
+/// link; can be anything for the soft link
+///\param new_name - IN: New name for the object
+///\exception H5::FileIException or H5::GroupIException
///\par Description
-/// Note that both names are interpreted relative to the
-/// specified location.
-/// For information on creating hard link and soft link, please
-/// refer to the C layer Reference Manual at:
+/// Note that both names are interpreted relative to the
+/// specified location.
+/// For information on creating hard link and soft link, please
+/// refer to the C layer Reference Manual at:
/// http://hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateHard and
/// http://hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateSoft
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// 2007: QAK modified to use H5L APIs - BMR
+// 2007: QAK modified to use H5L APIs - BMR
//--------------------------------------------------------------------------
-void H5Location::link( H5L_type_t link_type, const char* curr_name, const char* new_name ) const
+void H5Location::link(H5L_type_t link_type, const char* curr_name, const char* new_name) const
{
herr_t ret_value = -1;
switch(link_type) {
case H5L_TYPE_HARD:
- ret_value = H5Lcreate_hard(getId(), curr_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT );
+ ret_value = H5Lcreate_hard(getId(), curr_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT);
break;
case H5L_TYPE_SOFT:
- ret_value = H5Lcreate_soft( curr_name,getId(), new_name, H5P_DEFAULT, H5P_DEFAULT );
+ ret_value = H5Lcreate_soft(curr_name,getId(), new_name, H5P_DEFAULT, H5P_DEFAULT);
break;
- case H5L_TYPE_ERROR:
- case H5L_TYPE_EXTERNAL:
- case H5L_TYPE_MAX:
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_EXTERNAL:
+ case H5L_TYPE_MAX:
default:
throwException("link", "unknown link type");
break;
} /* end switch */
- if( ret_value < 0 )
- throwException("link", "creating link failed");
+ if (ret_value < 0)
+ throwException("link", "creating link failed");
}
//--------------------------------------------------------------------------
-// Function: H5Location::link
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a curr_name and \a new_name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::link
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a curr_name and \a new_name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::link( H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name ) const
+void H5Location::link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const
{
- link( link_type, curr_name.c_str(), new_name.c_str() );
+ link(link_type, curr_name.c_str(), new_name.c_str());
}
//--------------------------------------------------------------------------
-// Function: H5Location::unlink
-///\brief Removes the specified name at this location.
-///\param name - IN: Name of the object to be removed
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::unlink
+///\brief Removes the specified name at this location.
+///\param name - IN: Name of the object to be removed
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// 2007: QAK modified to use H5L APIs - BMR
+// 2007: QAK modified to use H5L APIs - BMR
//--------------------------------------------------------------------------
-void H5Location::unlink( const char* name ) const
+void H5Location::unlink(const char* name) const
{
- herr_t ret_value = H5Ldelete(getId(), name, H5P_DEFAULT );
- if( ret_value < 0 )
- throwException("unlink", "H5Ldelete failed");
+ herr_t ret_value = H5Ldelete(getId(), name, H5P_DEFAULT);
+ if (ret_value < 0)
+ throwException("unlink", "H5Ldelete failed");
}
//--------------------------------------------------------------------------
-// Function: H5Location::unlink
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::unlink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::unlink( const H5std_string& name ) const
+void H5Location::unlink(const H5std_string& name) const
{
- unlink( name.c_str() );
+ unlink(name.c_str());
}
//--------------------------------------------------------------------------
-// Function: H5Location::move
-///\brief Renames an object at this location.
-///\param src - IN: Object's original name
-///\param dst - IN: Object's new name
-///\exception H5::FileIException or H5::GroupIException
+// Function: H5Location::move
+///\brief Renames an object at this location.
+///\param src - IN: Object's original name
+///\param dst - IN: Object's new name
+///\exception H5::FileIException or H5::GroupIException
///\note
-/// Exercise care in moving groups as it is possible to render
-/// data in a file inaccessible with H5Location::move. Please refer
-/// to the Group Interface in the HDF5 User's Guide for details at:
+/// Exercise care in moving groups as it is possible to render
+/// data in a file inaccessible with H5Location::move. Please refer
+/// to the Group Interface in the HDF5 User's Guide for details at:
/// https://www.hdfgroup.org/HDF5/doc/UG/HDF5_Users_Guide-Responsive%20HTML5/index.html#t=HDF5_Users_Guide%2FGroups%2FHDF5_Groups.htm
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// 2007: QAK modified to use H5L APIs - BMR
+// 2007: QAK modified to use H5L APIs - BMR
//--------------------------------------------------------------------------
-void H5Location::move( const char* src, const char* dst ) const
+void H5Location::move(const char* src, const char* dst) const
{
- herr_t ret_value = H5Lmove(getId(), src, H5L_SAME_LOC, dst, H5P_DEFAULT, H5P_DEFAULT );
- if( ret_value < 0 )
- throwException("move", "H5Lmove failed");
+ herr_t ret_value = H5Lmove(getId(), src, H5L_SAME_LOC, dst, H5P_DEFAULT, H5P_DEFAULT);
+ if (ret_value < 0)
+ throwException("move", "H5Lmove failed");
}
//--------------------------------------------------------------------------
-// Function: H5Location::move
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a src and \a dst.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::move
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a src and \a dst.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::move( const H5std_string& src, const H5std_string& dst ) const
+void H5Location::move(const H5std_string& src, const H5std_string& dst) const
{
- move( src.c_str(), dst.c_str() );
+ move(src.c_str(), dst.c_str());
}
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
-// Function: H5Location::getObjinfo
-///\brief Returns information about an object.
-///\param name - IN: Name of the object
-///\param follow_link - IN: Link flag
-///\param statbuf - OUT: Buffer to return information about the object
-///\exception H5::FileIException or H5::GroupIException
+// Function: H5Location::getObjinfo
+///\brief Returns information about an object.
+///\param name - IN: Name of the object
+///\param follow_link - IN: Link flag
+///\param statbuf - OUT: Buffer to return information about the object
+///\exception H5::FileIException or H5::GroupIException
///\par Description
-/// For more information, please refer to the C layer Reference
-/// Manual at:
+/// For more information, please refer to the C layer Reference
+/// Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5G.html#Group-GetObjinfo
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::getObjinfo( const char* name, hbool_t follow_link, H5G_stat_t& statbuf ) const
+void H5Location::getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const
{
- herr_t ret_value = H5Gget_objinfo(getId(), name, follow_link, &statbuf );
- if( ret_value < 0 )
- throwException("getObjinfo", "H5Gget_objinfo failed");
+ herr_t ret_value = H5Gget_objinfo(getId(), name, follow_link, &statbuf);
+ if (ret_value < 0)
+ throwException("getObjinfo", "H5Gget_objinfo failed");
}
//--------------------------------------------------------------------------
-// Function: H5Location::getObjinfo
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::getObjinfo
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::getObjinfo( const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf ) const
+void H5Location::getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const
{
- getObjinfo( name.c_str(), follow_link, statbuf );
+ getObjinfo(name.c_str(), follow_link, statbuf);
}
//--------------------------------------------------------------------------
-// Function: H5Location::getObjinfo
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above functions in that it doesn't have
-/// the paramemter \a follow_link.
-// Programmer Binh-Minh Ribler - Nov, 2005
+// Function: H5Location::getObjinfo
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above functions in that it doesn't have
+/// the paramemter \a follow_link.
+// Programmer Binh-Minh Ribler - Nov, 2005
// Note: need to modify to use H5Oget_info and H5Lget_info - BMR
//--------------------------------------------------------------------------
-void H5Location::getObjinfo( const char* name, H5G_stat_t& statbuf ) const
+void H5Location::getObjinfo(const char* name, H5G_stat_t& statbuf) const
{
- herr_t ret_value = H5Gget_objinfo(getId(), name, 0, &statbuf );
- if( ret_value < 0 )
- throwException("getObjinfo", "H5Gget_objinfo failed");
+ herr_t ret_value = H5Gget_objinfo(getId(), name, 0, &statbuf);
+ if (ret_value < 0)
+ throwException("getObjinfo", "H5Gget_objinfo failed");
}
//--------------------------------------------------------------------------
-// Function: H5Location::getObjinfo
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - Nov, 2005
+// Function: H5Location::getObjinfo
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - Nov, 2005
//--------------------------------------------------------------------------
-void H5Location::getObjinfo( const H5std_string& name, H5G_stat_t& statbuf ) const
+void H5Location::getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const
{
- getObjinfo( name.c_str(), statbuf );
+ getObjinfo(name.c_str(), statbuf);
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
-// Function: H5Location::getLinkval
-///\brief Returns the name of the object that the symbolic link points to.
-///\param name - IN: Symbolic link to the object
-///\param size - IN: Maximum number of characters of value to be returned
-///\return Name of the object
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::getLinkval
+///\brief Returns the name of the object that the symbolic link points to.
+///\param name - IN: Symbolic link to the object
+///\param size - IN: Maximum number of characters of value to be returned
+///\return Name of the object
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string H5Location::getLinkval( const char* name, size_t size ) const
+H5std_string H5Location::getLinkval(const char* name, size_t size) const
{
H5L_info_t linkinfo;
- char *value_C; // value in C string
+ char *value_C; // value in C string
size_t val_size = size;
H5std_string value = "";
herr_t ret_value;
@@ -1107,81 +1106,81 @@ H5std_string H5Location::getLinkval( const char* name, size_t size ) const
// if user doesn't provide buffer size, determine it
if (size == 0)
{
- ret_value = H5Lget_info(getId(), name, &linkinfo, H5P_DEFAULT);
- if( ret_value < 0 )
- throwException("getLinkval", "H5Lget_info to find buffer size failed");
+ ret_value = H5Lget_info(getId(), name, &linkinfo, H5P_DEFAULT);
+ if (ret_value < 0)
+ throwException("getLinkval", "H5Lget_info to find buffer size failed");
- val_size = linkinfo.u.val_size;
+ val_size = linkinfo.u.val_size;
}
// if link has value, retrieve the value, otherwise, return null string
if (val_size > 0)
{
- value_C = new char[val_size+1]; // temporary C-string for C API
- HDmemset(value_C, 0, val_size+1); // clear buffer
-
- ret_value = H5Lget_val(getId(), name, value_C, val_size, H5P_DEFAULT);
- if( ret_value < 0 )
- {
- delete []value_C;
- throwException("getLinkval", "H5Lget_val failed");
- }
-
- value = H5std_string(value_C);
- delete []value_C;
+ value_C = new char[val_size+1]; // temporary C-string for C API
+ HDmemset(value_C, 0, val_size+1); // clear buffer
+
+ ret_value = H5Lget_val(getId(), name, value_C, val_size, H5P_DEFAULT);
+ if (ret_value < 0)
+ {
+ delete []value_C;
+ throwException("getLinkval", "H5Lget_val failed");
+ }
+
+ value = H5std_string(value_C);
+ delete []value_C;
}
return(value);
}
//--------------------------------------------------------------------------
-// Function: H5Location::getLinkval
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::getLinkval
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5std_string H5Location::getLinkval( const H5std_string& name, size_t size ) const
+H5std_string H5Location::getLinkval(const H5std_string& name, size_t size) const
{
- return( getLinkval( name.c_str(), size ));
+ return(getLinkval( name.c_str(), size));
}
//--------------------------------------------------------------------------
-// Function: H5Location::mount
-///\brief Mounts the file \a child onto this group.
-///\param name - IN: Name of the group
-///\param child - IN: File to mount
-///\param plist - IN: Property list to use
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2014 (original 2000)
+// Function: H5Location::mount
+///\brief Mounts the file \a child onto this group.
+///\param name - IN: Name of the group
+///\param child - IN: File to mount
+///\param plist - IN: Property list to use
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2014 (original 2000)
//--------------------------------------------------------------------------
-void H5Location::mount(const char* name, const H5File& child, const PropList& plist ) const
+void H5Location::mount(const char* name, const H5File& child, const PropList& plist) const
{
- // Obtain identifiers for C API
- hid_t plist_id = plist.getId();
- hid_t child_id = child.getId();
+ // Obtain identifiers for C API
+ hid_t plist_id = plist.getId();
+ hid_t child_id = child.getId();
- // Call C routine H5Fmount to do the mouting
- herr_t ret_value = H5Fmount(getId(), name, child_id, plist_id );
+ // Call C routine H5Fmount to do the mouting
+ herr_t ret_value = H5Fmount(getId(), name, child_id, plist_id);
- // Raise exception if H5Fmount returns negative value
- if( ret_value < 0 )
- throwException("mount", "H5Fmount failed");
+ // Raise exception if H5Fmount returns negative value
+ if (ret_value < 0)
+ throwException("mount", "H5Fmount failed");
}
//--------------------------------------------------------------------------
-// Function: H5Location::mount
-// 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 name - IN: Name of the group
-// Param child - IN: File to mount
-// Param plist - IN: Property list to use
-// Exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::mount
+// 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 name - IN: Name of the group
+// Param child - IN: File to mount
+// Param plist - IN: Property list to use
+// Exception H5::FileIException or H5::GroupIException
+// 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 H5Location::mount(const char* name, H5File& child, PropList& plist) const
//{
@@ -1189,26 +1188,26 @@ void H5Location::mount(const char* name, const H5File& child, const PropList& pl
//}
//--------------------------------------------------------------------------
-// Function: H5Location::mount
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::mount
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void H5Location::mount(const H5std_string& name, const H5File& child, const PropList& plist) const
{
- mount(name.c_str(), child, plist);
+ mount(name.c_str(), child, plist);
}
//--------------------------------------------------------------------------
-// Function: H5Location::mount
-// 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.
-// Programmer Binh-Minh Ribler - 2014
+// Function: H5Location::mount
+// 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.
+// Programmer Binh-Minh Ribler - 2014
// 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 H5Location::mount(const H5std_string& name, H5File& child, PropList& plist) const
//{
@@ -1216,109 +1215,109 @@ void H5Location::mount(const H5std_string& name, const H5File& child, const Prop
//}
//--------------------------------------------------------------------------
-// Function: H5Location::unmount
-///\brief Unmounts the specified file.
-///\param name - IN: Name of the file to unmount
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::unmount
+///\brief Unmounts the specified file.
+///\param name - IN: Name of the file to unmount
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::unmount( const char* name ) const
+void H5Location::unmount(const char* name) const
{
- // Call C routine H5Fmount to do the mouting
- herr_t ret_value = H5Funmount(getId(), name );
+ // Call C routine H5Fmount to do the mouting
+ herr_t ret_value = H5Funmount(getId(), name);
- // Raise exception if H5Funmount returns negative value
- if( ret_value < 0 )
- throwException("unmount", "H5Funmount failed");
+ // Raise exception if H5Funmount returns negative value
+ if (ret_value < 0)
+ throwException("unmount", "H5Funmount failed");
}
//--------------------------------------------------------------------------
-// Function: H5Location::unmount
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::unmount
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Location::unmount( const H5std_string& name ) const
+void H5Location::unmount(const H5std_string& name) const
{
- unmount( name.c_str() );
+ unmount(name.c_str());
}
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
-// Function: H5Location::iterateElems
-///\brief Iterates a user's function over the entries of a group.
-///\param name - IN : Name of group to iterate over
-///\param idx - IN/OUT: Starting (IN) and ending (OUT) entry indices
-///\param op - IN : User's function to operate on each entry
-///\param op_data - IN/OUT: Data associated with the operation
-///\return The return value of the first operator that returns non-zero,
-/// or zero if all members were processed with no operator
-/// returning non-zero.
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::iterateElems
+///\brief Iterates a user's function over the entries of a group.
+///\param name - IN : Name of group to iterate over
+///\param idx - IN/OUT: Starting (IN) and ending (OUT) entry indices
+///\param op - IN : User's function to operate on each entry
+///\param op_data - IN/OUT: Data associated with the operation
+///\return The return value of the first operator that returns non-zero,
+/// or zero if all members were processed with no operator
+/// returning non-zero.
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int H5Location::iterateElems( const char* name, int *idx, H5G_iterate_t op , void* op_data )
+int H5Location::iterateElems(const char* name, int *idx, H5G_iterate_t op , void* op_data)
{
- int ret_value = H5Giterate(getId(), name, idx, op, op_data );
- if( ret_value < 0 )
- {
- throwException("iterateElems", "H5Giterate failed");
- }
- return( ret_value );
+ int ret_value = H5Giterate(getId(), name, idx, op, op_data);
+ if (ret_value < 0)
+ {
+ throwException("iterateElems", "H5Giterate failed");
+ }
+ return(ret_value);
}
//--------------------------------------------------------------------------
-// Function: H5Location::iterateElems
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location::iterateElems
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int H5Location::iterateElems( const H5std_string& name, int *idx, H5G_iterate_t op , void* op_data )
+int H5Location::iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op , void* op_data)
{
- return( iterateElems( name.c_str(), idx, op, op_data ));
+ return(iterateElems( name.c_str(), idx, op, op_data));
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
-// Function: H5Location::getNumObjs
-///\brief Returns the number of objects in this group.
-///\return Number of objects
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - January, 2003
+// Function: H5Location::getNumObjs
+///\brief Returns the number of objects in this group.
+///\return Number of objects
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
hsize_t H5Location::getNumObjs() const
{
- H5G_info_t ginfo; /* Group information */
+ H5G_info_t ginfo; // Group information
- herr_t ret_value = H5Gget_info(getId(), &ginfo);
- if(ret_value < 0)
- throwException("getNumObjs", "H5Gget_info failed");
- return (ginfo.nlinks);
+ herr_t ret_value = H5Gget_info(getId(), &ginfo);
+ if(ret_value < 0)
+ throwException("getNumObjs", "H5Gget_info failed");
+ return (ginfo.nlinks);
}
//--------------------------------------------------------------------------
-// Function: H5Location::getObjnameByIdx
-///\brief Returns the name of an object in this group, given the
-/// object's index.
-///\param idx - IN: Transient index of the object
-///\return Object name
-///\exception H5::FileIException or H5::GroupIException
+// Function: H5Location::getObjnameByIdx
+///\brief Returns the name of an object in this group, given the
+/// object's index.
+///\param idx - IN: Transient index of the object
+///\return Object name
+///\exception H5::FileIException or H5::GroupIException
///\par Description
-/// The value of idx can be any nonnegative number less than the
-/// total number of objects in the group, which is returned by
-/// the function \c H5Location::getNumObjs. Note that this is a
-/// transient index; thus, an object may have a different index
-/// each time the group is opened.
-// Programmer Binh-Minh Ribler - Mar, 2005
+/// The value of idx can be any nonnegative number less than the
+/// total number of objects in the group, which is returned by
+/// the function \c H5Location::getNumObjs. Note that this is a
+/// transient index; thus, an object may have a different index
+/// each time the group is opened.
+// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
H5std_string H5Location::getObjnameByIdx(hsize_t idx) const
{
// call H5Lget_name_by_idx with name as NULL to get its length
ssize_t name_len = H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, NULL, 0, H5P_DEFAULT);
if(name_len < 0)
- throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
+ throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
// now, allocate C buffer to get the name
char* name_C = new char[name_len+1];
@@ -1328,8 +1327,8 @@ H5std_string H5Location::getObjnameByIdx(hsize_t idx) const
if (name_len < 0)
{
- delete []name_C;
- throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
+ delete []name_C;
+ throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
}
// clean up and return the string
@@ -1339,74 +1338,74 @@ H5std_string H5Location::getObjnameByIdx(hsize_t idx) const
}
//--------------------------------------------------------------------------
-// Function: H5Location::getObjnameByIdx
-///\brief Retrieves the name of an object in this group, given the
-/// object's index.
-///\param idx - IN: Transient index of the object
-///\param name - IN/OUT: Retrieved name of the object
-///\param size - IN: Length to retrieve
-///\return Actual size of the object name or 0, if object has no name
-///\exception H5::FileIException or H5::GroupIException
+// Function: H5Location::getObjnameByIdx
+///\brief Retrieves the name of an object in this group, given the
+/// object's index.
+///\param idx - IN: Transient index of the object
+///\param name - IN/OUT: Retrieved name of the object
+///\param size - IN: Length to retrieve
+///\return Actual size of the object name or 0, if object has no name
+///\exception H5::FileIException or H5::GroupIException
///\par Description
-/// The value of idx can be any nonnegative number less than the
-/// total number of objects in the group, which is returned by
-/// the function \c H5Location::getNumObjs. Note that this is a
-/// transient index; thus, an object may have a different index
-/// each time the group is opened.
-// Programmer Binh-Minh Ribler - January, 2003
+/// The value of idx can be any nonnegative number less than the
+/// total number of objects in the group, which is returned by
+/// the function \c H5Location::getNumObjs. Note that this is a
+/// transient index; thus, an object may have a different index
+/// each time the group is opened.
+// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
ssize_t H5Location::getObjnameByIdx(hsize_t idx, char* name, size_t size) const
{
- ssize_t name_len = H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT);
- if(name_len < 0)
- throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
+ ssize_t name_len = H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT);
+ if(name_len < 0)
+ throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
- return (name_len);
+ return (name_len);
}
//--------------------------------------------------------------------------
-// Function: H5Location::getObjnameByIdx
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - January, 2003
+// Function: H5Location::getObjnameByIdx
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
ssize_t H5Location::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const
{
- char* name_C = new char[size+1]; // temporary C-string for object name
- HDmemset(name_C, 0, size+1); // clear buffer
+ char* name_C = new char[size+1]; // temporary C-string for object name
+ HDmemset(name_C, 0, size+1); // clear buffer
- // call overloaded function to get the name
- ssize_t name_len = getObjnameByIdx(idx, name_C, size+1);
- if(name_len < 0)
- {
+ // call overloaded function to get the name
+ ssize_t name_len = getObjnameByIdx(idx, name_C, size+1);
+ if(name_len < 0)
+ {
delete []name_C;
- throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
- }
-
- // clean up and return the string
- name = H5std_string(name_C);
- delete []name_C;
- return (name_len);
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::childObjType
-///\brief Returns the type of an object in this file/group, given the
-/// object's name.
-///\param objname - IN: Name of the object
-///\return Object type, which can have the following values for group,
-/// dataset, and named datatype
-/// \li \c H5O_TYPE_GROUP
-/// \li \c H5O_TYPE_DATASET
-/// \li \c H5O_TYPE_NAMED_DATATYPE
-/// Refer to the C API documentation for more details:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
-///\exception H5::FileIException or H5::GroupIException
-/// Exception will be thrown when:
-/// - an error returned by the C API
-/// - object type is not one of the valid values above
-// Programmer Binh-Minh Ribler - April, 2014
+ throwException("getObjnameByIdx", "H5Lget_name_by_idx failed");
+ }
+
+ // clean up and return the string
+ name = H5std_string(name_C);
+ delete []name_C;
+ return (name_len);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::childObjType
+///\brief Returns the type of an object in this file/group, given the
+/// object's name.
+///\param objname - IN: Name of the object
+///\return Object type, which can have the following values for group,
+/// dataset, and named datatype
+/// \li \c H5O_TYPE_GROUP
+/// \li \c H5O_TYPE_DATASET
+/// \li \c H5O_TYPE_NAMED_DATATYPE
+/// Refer to the C API documentation for more details:
+/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
+///\exception H5::FileIException or H5::GroupIException
+/// Exception will be thrown when:
+/// - an error returned by the C API
+/// - object type is not one of the valid values above
+// Programmer Binh-Minh Ribler - April, 2014
//--------------------------------------------------------------------------
H5O_type_t H5Location::childObjType(const char* objname) const
{
@@ -1418,33 +1417,33 @@ H5O_type_t H5Location::childObjType(const char* objname) const
// Throw exception if C API returns failure
if (ret_value < 0)
- throwException("childObjType", "H5Oget_info_by_name failed");
+ throwException("childObjType", "H5Oget_info_by_name failed");
// Return a valid type or throw an exception for unknown type
else
- switch (objinfo.type)
- {
- case H5O_TYPE_GROUP:
- case H5O_TYPE_DATASET:
- case H5O_TYPE_NAMED_DATATYPE:
- objtype = objinfo.type;
- break;
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- throwException("childObjType", "Unknown type of object");
- }
+ switch (objinfo.type)
+ {
+ case H5O_TYPE_GROUP:
+ case H5O_TYPE_DATASET:
+ case H5O_TYPE_NAMED_DATATYPE:
+ objtype = objinfo.type;
+ break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ throwException("childObjType", "Unknown type of object");
+ }
return(objtype);
}
//--------------------------------------------------------------------------
-// Function: H5Location::childObjType
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes an \a H5std_string for the object's name.
-///\brief Returns the type of an object in this group, given the
-/// object's name.
-///\param objname - IN: Name of the object (H5std_string&)
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - April, 2014
+// Function: H5Location::childObjType
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes an \a H5std_string for the object's name.
+///\brief Returns the type of an object in this group, given the
+/// object's name.
+///\param objname - IN: Name of the object (H5std_string&)
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - April, 2014
//--------------------------------------------------------------------------
H5O_type_t H5Location::childObjType(const H5std_string& objname) const
{
@@ -1454,33 +1453,33 @@ H5O_type_t H5Location::childObjType(const H5std_string& objname) const
}
//--------------------------------------------------------------------------
-// Function: H5Location::childObjType
-///\brief Returns the type of an object in this file/group, given the
-/// object's index and its type and order.
-///\param index - IN: Position of the object
-///\param index_type - IN: Type of the index, default to H5_INDEX_NAME
-///\param order - IN: Traversing order, default to H5_ITER_INC
-///\param objname - IN: Name of the object, default to "."
-///\return Object type, which can have the following values for group,
-/// dataset, and named datatype
-/// \li \c H5O_TYPE_GROUP
-/// \li \c H5O_TYPE_DATASET
-/// \li \c H5O_TYPE_NAMED_DATATYPE
-/// Refer to the C API documentation for more details:
-/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
-///\exception H5::FileIException or H5::GroupIException
-/// Exception will be thrown when:
-/// - an error returned by the C API
-/// - object type is not one of the valid values above
+// Function: H5Location::childObjType
+///\brief Returns the type of an object in this file/group, given the
+/// object's index and its type and order.
+///\param index - IN: Position of the object
+///\param index_type - IN: Type of the index, default to H5_INDEX_NAME
+///\param order - IN: Traversing order, default to H5_ITER_INC
+///\param objname - IN: Name of the object, default to "."
+///\return Object type, which can have the following values for group,
+/// dataset, and named datatype
+/// \li \c H5O_TYPE_GROUP
+/// \li \c H5O_TYPE_DATASET
+/// \li \c H5O_TYPE_NAMED_DATATYPE
+/// Refer to the C API documentation for more details:
+/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfo
+///\exception H5::FileIException or H5::GroupIException
+/// Exception will be thrown when:
+/// - an error returned by the C API
+/// - object type is not one of the valid values above
// Developer's Notes:
-// - this overload uses H5Oget_info_by_idx instead of H5Oget_info_by_name
-// like the previous childObjType()
-// - index is the required argument so, first
-// - objname is last because it's more likely the location is already
-// fully specified
-// - Leave property list out for now because C API is not using it, it
-// can be added later when needed.
-// Programmer Binh-Minh Ribler - April, 2014
+// - this overload uses H5Oget_info_by_idx instead of H5Oget_info_by_name
+// like the previous childObjType()
+// - index is the required argument so, first
+// - objname is last because it's more likely the location is already
+// fully specified
+// - Leave property list out for now because C API is not using it, it
+// can be added later when needed.
+// Programmer Binh-Minh Ribler - April, 2014
//--------------------------------------------------------------------------
H5O_type_t H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_iter_order_t order, const char* objname) const
{
@@ -1493,37 +1492,37 @@ H5O_type_t H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_ite
// Throw exception if C API returns failure
if (ret_value < 0)
- throwException("childObjType", "H5Oget_info_by_idx failed");
+ throwException("childObjType", "H5Oget_info_by_idx failed");
// Return a valid type or throw an exception for unknown type
else
- switch (objinfo.type)
- {
- case H5O_TYPE_GROUP:
- case H5O_TYPE_DATASET:
- case H5O_TYPE_NAMED_DATATYPE:
- objtype = objinfo.type;
- break;
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- throwException("childObjType", "Unknown type of object");
- }
+ switch (objinfo.type)
+ {
+ case H5O_TYPE_GROUP:
+ case H5O_TYPE_DATASET:
+ case H5O_TYPE_NAMED_DATATYPE:
+ objtype = objinfo.type;
+ break;
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ throwException("childObjType", "Unknown type of object");
+ }
return(objtype);
}
//--------------------------------------------------------------------------
-// Function: H5Location::childObjVersion
-///\brief Returns the object header version of an object in this file/group,
-/// given the object's name.
-///\param objname - IN: Name of the object
-///\return Object version, which can have the following values:
-/// \li \c H5O_VERSION_1
-/// \li \c H5O_VERSION_2
-///\exception H5::FileIException or H5::GroupIException
-/// Exception will be thrown when:
-/// - an error returned by the C API
-/// - version number is not one of the valid values above
-// Programmer Binh-Minh Ribler - April, 2014
+// Function: H5Location::childObjVersion
+///\brief Returns the object header version of an object in this file/group,
+/// given the object's name.
+///\param objname - IN: Name of the object
+///\return Object version, which can have the following values:
+/// \li \c H5O_VERSION_1
+/// \li \c H5O_VERSION_2
+///\exception H5::FileIException or H5::GroupIException
+/// Exception will be thrown when:
+/// - an error returned by the C API
+/// - version number is not one of the valid values above
+// Programmer Binh-Minh Ribler - April, 2014
//--------------------------------------------------------------------------
unsigned H5Location::childObjVersion(const char* objname) const
{
@@ -1535,26 +1534,26 @@ unsigned H5Location::childObjVersion(const char* objname) const
// Throw exception if C API returns failure
if (ret_value < 0)
- throwException("childObjVersion", "H5Oget_info_by_name failed");
+ throwException("childObjVersion", "H5Oget_info_by_name failed");
// Return a valid version or throw an exception for invalid value
else
{
- version = objinfo.hdr.version;
- if (version != H5O_VERSION_1 && version != H5O_VERSION_2)
- throwException("childObjVersion", "Invalid version for object");
+ version = objinfo.hdr.version;
+ if (version != H5O_VERSION_1 && version != H5O_VERSION_2)
+ throwException("childObjVersion", "Invalid version for object");
}
return(version);
}
//--------------------------------------------------------------------------
-// Function: H5Location::childObjVersion
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes an \a H5std_string for the object's name.
-///\brief Returns the type of an object in this group, given the
-/// object's name.
-///\param objname - IN: Name of the object (H5std_string&)
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - April, 2014
+// Function: H5Location::childObjVersion
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes an \a H5std_string for the object's name.
+///\brief Returns the type of an object in this group, given the
+/// object's name.
+///\param objname - IN: Name of the object (H5std_string&)
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - April, 2014
//--------------------------------------------------------------------------
unsigned H5Location::childObjVersion(const H5std_string& objname) const
{
@@ -1566,35 +1565,35 @@ unsigned H5Location::childObjVersion(const H5std_string& objname) const
#ifndef H5_NO_DEPRECATED_SYMBOLS
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5Location::getObjTypeByIdx
-///\brief Returns the type of an object in this group, given the
-/// object's index.
-///\param idx - IN: Transient index of the object
-///\return Object type
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - January, 2003
+// Function: H5Location::getObjTypeByIdx
+///\brief Returns the type of an object in this group, given the
+/// object's index.
+///\param idx - IN: Transient index of the object
+///\return Object type
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx) const
{
H5G_obj_t obj_type = H5Gget_objtype_by_idx(getId(), idx);
if (obj_type == H5G_UNKNOWN)
- throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
+ throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
return (obj_type);
}
//--------------------------------------------------------------------------
-// Function: H5Location::getObjTypeByIdx
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function because it also provides
-/// the returned object type in text (char*)
-///\param idx - IN: Transient index of the object
-///\param type_name - OUT: Object type in text
-///\return Object type
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - May, 2010
+// Function: H5Location::getObjTypeByIdx
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function because it also provides
+/// the returned object type in text (char*)
+///\param idx - IN: Transient index of the object
+///\param type_name - OUT: Object type in text
+///\return Object type
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - May, 2010
// Modification
-// Modified to use the other function. -BMR, 2016/03/07
+// Modified to use the other function. -BMR, 2016/03/07
//--------------------------------------------------------------------------
H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, char* type_name) const
{
@@ -1602,32 +1601,32 @@ H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, char* type_name) const
return(getObjTypeByIdx(idx, stype_name));
}
//--------------------------------------------------------------------------
-// Function: H5Location::getObjTypeByIdx
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function because it also provides
-/// the returned object type in text (H5std_string&)
-///\param idx - IN: Transient index of the object
-///\param type_name - OUT: Object type in text
-///\return Object type
-///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - January, 2003
+// Function: H5Location::getObjTypeByIdx
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function because it also provides
+/// the returned object type in text (H5std_string&)
+///\param idx - IN: Transient index of the object
+///\param type_name - OUT: Object type in text
+///\return Object type
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - January, 2003
//--------------------------------------------------------------------------
H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const
{
H5G_obj_t obj_type = H5Gget_objtype_by_idx(getId(), idx);
switch (obj_type)
{
- case H5G_LINK: type_name = H5std_string("symbolic link"); break;
- case H5G_GROUP: type_name = H5std_string("group"); break;
- case H5G_DATASET: type_name = H5std_string("dataset"); break;
- case H5G_TYPE: type_name = H5std_string("datatype"); break;
- case H5G_UNKNOWN:
- case H5G_UDLINK:
- case H5G_RESERVED_5:
- case H5G_RESERVED_6:
- case H5G_RESERVED_7:
- default:
- throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
+ case H5G_LINK: type_name = H5std_string("symbolic link"); break;
+ case H5G_GROUP: type_name = H5std_string("group"); break;
+ case H5G_DATASET: type_name = H5std_string("dataset"); break;
+ case H5G_TYPE: type_name = H5std_string("datatype"); break;
+ case H5G_UNKNOWN:
+ case H5G_UDLINK:
+ case H5G_RESERVED_5:
+ case H5G_RESERVED_6:
+ case H5G_RESERVED_7:
+ default:
+ throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed");
}
return (obj_type);
}
@@ -1645,34 +1644,34 @@ H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) cons
//--------------------------------------------------------------------------
void H5Location::throwException(const H5std_string& func_name, const H5std_string& msg) const
{
- throwException(func_name, msg);
+ throwException(func_name, msg);
}
//--------------------------------------------------------------------------
-// Function: f_DataSet_setId - friend
+// Function: f_DataSet_setId - friend
// Modification:
-// Moved to H5CommonFG.cpp after the rearrangement of classes
-// -BMR, Dec 2016
+// Moved to H5CommonFG.cpp after the rearrangement of classes
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
// end of From H5CommonFG.cpp
//--------------------------------------------------------------------------
-// Function: f_Attribute_setId - friend
+// Function: f_Attribute_setId - friend
// Modification:
-// Moved to H5Object.cpp after the rearrangement of classes
-// -BMR, Dec 2016
+// Moved to H5Object.cpp after the rearrangement of classes
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
-// Function: f_DataSpace_setId - friend
-// Purpose: This function is friend to class H5::DataSpace so that it can
-// can set DataSpace::id in order to work around a problem
-// described in the JIRA issue HDFFV-7947.
-// Applications shouldn't need to use it.
-// param dspace - IN/OUT: DataSpace object to be changed
-// param new_id - IN: New id to set
-// Programmer Binh-Minh Ribler - 2015
+// Function: f_DataSpace_setId - friend
+// Purpose This function is friend to class H5::DataSpace so that it can
+// can set DataSpace::id in order to work around a problem
+// described in the JIRA issue HDFFV-7947.
+// Applications shouldn't need to use it.
+// param dspace - IN/OUT: DataSpace object to be changed
+// param new_id - IN: New id to set
+// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
void f_DataSpace_setId(DataSpace* dspace, hid_t new_id)
{
@@ -1680,9 +1679,9 @@ void f_DataSpace_setId(DataSpace* dspace, hid_t new_id)
}
//--------------------------------------------------------------------------
-// Function: H5Location destructor
-///\brief Noop destructor.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Location destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5Location::~H5Location() {}
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index 6a449dc..337a2b3 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -17,7 +17,7 @@
#ifndef __H5Location_H
#define __H5Location_H
-#include "H5Classes.h" // constains forward class declarations
+#include "H5Classes.h" // constains forward class declarations
namespace H5 {
@@ -37,188 +37,188 @@ class H5_DLLCPP LinkAccPropList;
class H5_DLLCPP VarLenType;
class H5_DLLCPP H5Location : public IdComponent {
public:
- // Checks if a link of a given name exists in a location
- bool exists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- bool exists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ // Checks if a link of a given name exists in a location
+ bool exists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ bool exists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- // Flushes all buffers associated with this location to disk.
- void flush( H5F_scope_t scope ) const;
+ // Flushes all buffers associated with this location to disk.
+ void flush(H5F_scope_t scope) const;
- // Gets the name of the file, specified by this location.
- H5std_string getFileName() const;
+ // Gets the name of the file, specified by this location.
+ H5std_string getFileName() const;
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Retrieves the type of object that an object reference points to.
- H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
+ // Retrieves the type of object that an object reference points to.
+ H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Retrieves the type of object that an object reference points to.
- H5O_type_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
- // Note: getRefObjType deprecates getObjType, but getObjType's name is
- // misleading, so getRefObjType is used in the new function instead.
-
- // Sets the comment for an HDF5 object specified by its name.
- void setComment(const char* name, const char* comment) const;
- void setComment(const H5std_string& name, const H5std_string& comment) const;
- void setComment(const char* comment) const;
- void setComment(const H5std_string& comment) const;
-
- // Retrieves comment for the HDF5 object specified by its name.
- ssize_t getComment(const char* name, size_t buf_size, char* comment) const;
- H5std_string getComment(const char* name, size_t buf_size=0) const;
- H5std_string getComment(const H5std_string& name, size_t buf_size=0) const;
-
- // Removes the comment for the HDF5 object specified by its name.
- void removeComment(const char* name) const;
- void removeComment(const H5std_string& name) const;
-
- // Creates a reference to a named object or to a dataset region
- // in this object.
- void reference(void* ref, const char* name,
- H5R_type_t ref_type = H5R_OBJECT) const;
- void reference(void* ref, const H5std_string& name,
- H5R_type_t ref_type = H5R_OBJECT) const;
- void reference(void* ref, const char* name, const DataSpace& dataspace,
- H5R_type_t ref_type = H5R_DATASET_REGION) const;
- void reference(void* ref, const H5std_string& name, const DataSpace& dataspace,
- H5R_type_t ref_type = H5R_DATASET_REGION) const;
-
- // Open a referenced object whose location is specified by either
- // a file, an HDF5 object, or an attribute.
- void dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
- //void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
-
- // Retrieves a dataspace with the region pointed to selected.
- DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
+ // Retrieves the type of object that an object reference points to.
+ H5O_type_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
+ // Note: getRefObjType deprecates getObjType, but getObjType's name is
+ // misleading, so getRefObjType is used in the new function instead.
+
+ // Sets the comment for an HDF5 object specified by its name.
+ void setComment(const char* name, const char* comment) const;
+ void setComment(const H5std_string& name, const H5std_string& comment) const;
+ void setComment(const char* comment) const;
+ void setComment(const H5std_string& comment) const;
+
+ // Retrieves comment for the HDF5 object specified by its name.
+ ssize_t getComment(const char* name, size_t buf_size, char* comment) const;
+ H5std_string getComment(const char* name, size_t buf_size=0) const;
+ H5std_string getComment(const H5std_string& name, size_t buf_size=0) const;
+
+ // Removes the comment for the HDF5 object specified by its name.
+ void removeComment(const char* name) const;
+ void removeComment(const H5std_string& name) const;
+
+ // Creates a reference to a named object or to a dataset region
+ // in this object.
+ void reference(void* ref, const char* name,
+ H5R_type_t ref_type = H5R_OBJECT) const;
+ void reference(void* ref, const H5std_string& name,
+ H5R_type_t ref_type = H5R_OBJECT) const;
+ void reference(void* ref, const char* name, const DataSpace& dataspace,
+ H5R_type_t ref_type = H5R_DATASET_REGION) const;
+ void reference(void* ref, const H5std_string& name, const DataSpace& dataspace,
+ H5R_type_t ref_type = H5R_DATASET_REGION) const;
+
+ // Open a referenced object whose location is specified by either
+ // a file, an HDF5 object, or an attribute.
+ void dereference(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
+ //void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
+
+ // Retrieves a dataspace with the region pointed to selected.
+ DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
// From CommonFG
- // Creates a new group at this location which can be a file
- // or another group.
- Group createGroup(const char* name, size_t size_hint = 0) const;
- Group createGroup(const H5std_string& name, size_t size_hint = 0) const;
-
- // Opens an existing group in a location which can be a file
- // or another group.
- Group openGroup(const char* name) const;
- Group openGroup(const H5std_string& name) const;
-
- // Creates a new dataset in this group.
- DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
- DataSet createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
-
- // Opens an existing dataset at this location.
- DataSet openDataSet(const char* name) const;
- DataSet openDataSet(const H5std_string& name) const;
-
- // Returns the value of a symbolic link.
- H5std_string getLinkval(const char* link_name, size_t size=0) const;
- H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
-
- // Returns the number of objects in this group.
- hsize_t getNumObjs() const;
-
- // Retrieves the name of an object in this group, given the
- // object's index.
- H5std_string getObjnameByIdx(hsize_t idx) const;
- ssize_t getObjnameByIdx(hsize_t idx, char* name, size_t size) const;
- ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const;
-
- // Retrieves the type of an object in this file or group, given the
- // object's name
- H5O_type_t childObjType(const H5std_string& objname) const;
- H5O_type_t childObjType(const char* objname) const;
- H5O_type_t childObjType(hsize_t index, H5_index_t index_type=H5_INDEX_NAME, H5_iter_order_t order=H5_ITER_INC, const char* objname=".") const;
-
- // Returns the object header version of an object in this file or group,
- // given the object's name.
- unsigned childObjVersion(const char* objname) const;
- unsigned childObjVersion(const H5std_string& objname) const;
+ // Creates a new group at this location which can be a file
+ // or another group.
+ Group createGroup(const char* name, size_t size_hint = 0) const;
+ Group createGroup(const H5std_string& name, size_t size_hint = 0) const;
+
+ // Opens an existing group in a location which can be a file
+ // or another group.
+ Group openGroup(const char* name) const;
+ Group openGroup(const H5std_string& name) const;
+
+ // Creates a new dataset in this group.
+ DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
+ DataSet createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
+
+ // Opens an existing dataset at this location.
+ DataSet openDataSet(const char* name) const;
+ DataSet openDataSet(const H5std_string& name) const;
+
+ // Returns the value of a symbolic link.
+ H5std_string getLinkval(const char* link_name, size_t size=0) const;
+ H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
+
+ // Returns the number of objects in this group.
+ hsize_t getNumObjs() const;
+
+ // Retrieves the name of an object in this group, given the
+ // object's index.
+ H5std_string getObjnameByIdx(hsize_t idx) const;
+ ssize_t getObjnameByIdx(hsize_t idx, char* name, size_t size) const;
+ ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const;
+
+ // Retrieves the type of an object in this file or group, given the
+ // object's name
+ H5O_type_t childObjType(const H5std_string& objname) const;
+ H5O_type_t childObjType(const char* objname) const;
+ H5O_type_t childObjType(hsize_t index, H5_index_t index_type=H5_INDEX_NAME, H5_iter_order_t order=H5_ITER_INC, const char* objname=".") const;
+
+ // Returns the object header version of an object in this file or group,
+ // given the object's name.
+ unsigned childObjVersion(const char* objname) const;
+ unsigned childObjVersion(const H5std_string& objname) const;
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Returns the type of an object in this group, given the
- // object's index.
- H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
- H5G_obj_t getObjTypeByIdx(hsize_t idx, char* type_name) const;
- H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const;
-
- // Returns information about an HDF5 object, given by its name,
- // at this location.
- void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const;
- void getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const;
- void getObjinfo(const char* name, H5G_stat_t& statbuf) const;
- void getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const;
-
- // Iterates over the elements of this group - not implemented in
- // C++ style yet.
- int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data);
- int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data);
+ // Returns the type of an object in this group, given the
+ // object's index.
+ H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
+ H5G_obj_t getObjTypeByIdx(hsize_t idx, char* type_name) const;
+ H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const;
+
+ // Returns information about an HDF5 object, given by its name,
+ // at this location.
+ void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const;
+ void getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const;
+ void getObjinfo(const char* name, H5G_stat_t& statbuf) const;
+ void getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const;
+
+ // Iterates over the elements of this group - not implemented in
+ // C++ style yet.
+ int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data);
+ int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Creates a link of the specified type from new_name to current_name;
- // both names are interpreted relative to the specified location id.
- void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const;
- void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const;
+ // Creates a link of the specified type from new_name to current_name;
+ // both names are interpreted relative to the specified location id.
+ void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const;
+ void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const;
- // Removes the specified name at this location.
- void unlink(const char* name) const;
- void unlink(const H5std_string& name) const;
+ // Removes the specified name at this location.
+ void unlink(const char* name) const;
+ void unlink(const H5std_string& name) const;
- // Mounts the file 'child' onto this location.
- void mount(const char* name, const H5File& child, const PropList& plist) const;
- //void mount(const char* name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1
- void mount(const H5std_string& name, const H5File& child, const PropList& plist) const;
- //void mount(const H5std_string& name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1
+ // Mounts the file 'child' onto this location.
+ void mount(const char* name, const H5File& child, const PropList& plist) const;
+ //void mount(const char* name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1
+ void mount(const H5std_string& name, const H5File& child, const PropList& plist) const;
+ //void mount(const H5std_string& name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1
- // Unmounts the file named 'name' from this parent location.
- void unmount(const char* name) const;
- void unmount(const H5std_string& name) const;
+ // Unmounts the file named 'name' from this parent location.
+ void unmount(const char* name) const;
+ void unmount(const H5std_string& name) const;
- // Renames an object at this location.
- void move(const char* src, const char* dst) const;
- void move(const H5std_string& src, const H5std_string& dst) const;
+ // Renames an object at this location.
+ void move(const char* src, const char* dst) const;
+ void move(const H5std_string& src, const H5std_string& dst) const;
// end From CommonFG
- /// For subclasses, H5File and Group, to throw appropriate exception.
- virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
+ /// For subclasses, H5File and Group, to throw appropriate exception.
+ virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
- // Default constructor
- H5Location();
+ // Default constructor
+ H5Location();
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // *** Deprecation warning ***
- // The following two constructors are no longer appropriate after the
- // data member "id" had been moved to the sub-classes.
- // The copy constructor is a noop and is removed in 1.8.15 and the
- // other will be removed from 1.10 release, and then from 1.8 if its
- // removal does not raise any problems in two 1.10 releases.
+ // *** Deprecation warning ***
+ // The following two constructors are no longer appropriate after the
+ // data member "id" had been moved to the sub-classes.
+ // The copy constructor is a noop and is removed in 1.8.15 and the
+ // other will be removed from 1.10 release, and then from 1.8 if its
+ // removal does not raise any problems in two 1.10 releases.
- // Creates a copy of an existing object giving the location id.
- H5Location(const hid_t loc_id);
+ // Creates a copy of an existing object giving the location id.
+ H5Location(const hid_t loc_id);
- // Creates a reference to an HDF5 object or a dataset region.
- void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const;
+ // Creates a reference to an HDF5 object or a dataset region.
+ void p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const;
- // Dereferences a ref into an HDF5 id.
- hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist, const char* from_func);
+ // Dereferences a ref into an HDF5 id.
+ hid_t p_dereference(hid_t loc_id, const void* ref, H5R_type_t ref_type, const PropList& plist, const char* from_func);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Retrieves the type of object that an object reference points to.
- H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const;
+ // Retrieves the type of object that an object reference points to.
+ H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Retrieves the type of object that an object reference points to.
- H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const;
+ // Retrieves the type of object that an object reference points to.
+ H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const;
- // Sets the identifier of this object to a new value. - this one
- // doesn't increment reference count
- //virtual void p_setId(const hid_t new_id);
+ // Sets the identifier of this object to a new value. - this one
+ // doesn't increment reference count
+ //virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
- // Noop destructor.
- virtual ~H5Location();
+ // Noop destructor.
+ virtual ~H5Location();
}; /* end class H5Location */
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 48d81f8..b5d0f88 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -15,7 +15,7 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -46,25 +46,25 @@ namespace H5 {
extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name,
const H5A_info_t *ainfo, void *op_data)
{
- H5std_string s_attr_name = H5std_string( attr_name );
+ H5std_string s_attr_name = H5std_string(attr_name);
UserData4Aiterate* myData = reinterpret_cast<UserData4Aiterate *> (op_data);
- myData->op( *myData->location, s_attr_name, myData->opData );
+ myData->op(*myData->location, s_attr_name, myData->opData);
return 0;
}
#endif
//--------------------------------------------------------------------------
-// Function: H5Object default constructor (protected)
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Object default constructor (protected)
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5Object::H5Object() : H5Location() {}
//--------------------------------------------------------------------------
-// Function: H5Object overloaded constructor (protected)
-// Purpose Creates an H5Object object using the id of an existing HDF5
-// object.
-// Parameters object_id - IN: Id of an existing HDF5 object
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Object overloaded constructor (protected)
+// Purpose Creates an H5Object object using the id of an existing HDF5
+// object.
+// Parameters object_id - IN: Id of an existing HDF5 object
+// Programmer Binh-Minh Ribler - 2000
// *** Deprecation warning ***
// This constructor is no longer appropriate because the data member "id" had
// been moved to the sub-classes. It will be removed in 1.10 release. If its
@@ -75,11 +75,11 @@ H5Object::H5Object() : H5Location() {}
//H5Object::H5Object(const hid_t object_id) : H5Location() {}
//--------------------------------------------------------------------------
-// Function: H5Object copy constructor
-///\brief Copy constructor: makes a copy of the original H5Object
-/// instance.
-///\param original - IN: H5Object instance to copy
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Object copy constructor
+///\brief Copy constructor: makes a copy of the original H5Object
+/// instance.
+///\param original - IN: H5Object instance to copy
+// Programmer Binh-Minh Ribler - 2000
// *** Deprecation warning ***
// This constructor is no longer appropriate because the data member "id" had
// been moved to the sub-classes. It is removed from 1.8.15 because it is
@@ -103,158 +103,157 @@ void f_Attribute_setId(Attribute* attr, hid_t new_id)
}
//--------------------------------------------------------------------------
-// Function: H5Object::createAttribute
-///\brief Creates an attribute for a group, dataset, or named datatype.
-///\param name - IN: Name of the attribute
-///\param data_type - IN: Datatype for the attribute
-///\param data_space - IN: Dataspace for the attribute - only simple
-/// dataspaces are allowed at this time
-///\param create_plist - IN: Creation property list - default to
-/// PropList::DEFAULT
-///\return Attribute instance
-///\exception H5::AttributeIException
+// Function: H5Object::createAttribute
+///\brief Creates an attribute for a group, dataset, or named datatype.
+///\param name - IN: Name of the attribute
+///\param data_type - IN: Datatype for the attribute
+///\param data_space - IN: Dataspace for the attribute - only simple
+/// dataspaces are allowed at this time
+///\param create_plist - IN: Creation property list - default to
+/// PropList::DEFAULT
+///\return Attribute instance
+///\exception H5::AttributeIException
///\par Description
-/// The attribute name specified in \a name must be unique.
-/// Attempting to create an attribute with the same name as an
-/// existing attribute will raise an exception, leaving the
-/// pre-existing attribute intact. To overwrite an existing
-/// attribute with a new attribute of the same name, first
-/// delete the existing one with \c H5Object::removeAttr, then
-/// recreate it with this function.
-// Programmer Binh-Minh Ribler - 2000
-//--------------------------------------------------------------------------
-Attribute H5Object::createAttribute( const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const
+/// The attribute name specified in \a name must be unique.
+/// Attempting to create an attribute with the same name as an
+/// existing attribute will raise an exception, leaving the
+/// pre-existing attribute intact. To overwrite an existing
+/// attribute with a new attribute of the same name, first
+/// delete the existing one with \c H5Object::removeAttr, then
+/// recreate it with this function.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Attribute H5Object::createAttribute(const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist) const
{
- hid_t type_id = data_type.getId();
- hid_t space_id = data_space.getId();
- hid_t plist_id = create_plist.getId();
- hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT );
-
- // If the attribute id is valid, create and return the Attribute object
- if( attr_id > 0 )
- {
- Attribute attr;
- f_Attribute_setId(&attr, attr_id);
- return( attr );
- }
- else
- throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed");
+ hid_t type_id = data_type.getId();
+ hid_t space_id = data_space.getId();
+ hid_t plist_id = create_plist.getId();
+ hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT);
+
+ // If the attribute id is valid, create and return the Attribute object
+ if (attr_id > 0)
+ {
+ Attribute attr;
+ f_Attribute_setId(&attr, attr_id);
+ return(attr);
+ }
+ else
+ throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed");
}
//--------------------------------------------------------------------------
-// Function: H5Object::createAttribute
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Object::createAttribute
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute H5Object::createAttribute( const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist ) const
+Attribute H5Object::createAttribute(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist) const
{
- return( createAttribute( name.c_str(), data_type, data_space, create_plist ));
+ return(createAttribute( name.c_str(), data_type, data_space, create_plist));
}
//--------------------------------------------------------------------------
-// Function: H5Object::openAttribute
-///\brief Opens an attribute given its name.
-///\param name - IN: Name of the attribute
-///\return Attribute instance
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Object::openAttribute
+///\brief Opens an attribute given its name.
+///\param name - IN: Name of the attribute
+///\return Attribute instance
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute H5Object::openAttribute( const char* name ) const
+Attribute H5Object::openAttribute(const char* name) const
{
- hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT);
- if( attr_id > 0 )
- {
- Attribute attr;
- f_Attribute_setId(&attr, attr_id);
- return( attr );
- }
- else
- {
- throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed");
- }
+ hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT);
+ if (attr_id > 0)
+ {
+ Attribute attr;
+ f_Attribute_setId(&attr, attr_id);
+ return(attr);
+ }
+ else
+ {
+ throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: H5Object::openAttribute
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Object::openAttribute
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute H5Object::openAttribute( const H5std_string& name ) const
+Attribute H5Object::openAttribute(const H5std_string& name) const
{
- return( openAttribute( name.c_str()) );
+ return(openAttribute( name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: H5Object::openAttribute
-///\brief Opens an attribute given its index.
-///\param idx - IN: Index of the attribute, a 0-based, non-negative integer
-///\return Attribute instance
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Object::openAttribute
+///\brief Opens an attribute given its index.
+///\param idx - IN: Index of the attribute, a 0-based, non-negative integer
+///\return Attribute instance
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Attribute H5Object::openAttribute( const unsigned int idx ) const
+Attribute H5Object::openAttribute(const unsigned int idx) const
{
- hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER,
- H5_ITER_INC, static_cast<hsize_t>(idx), H5P_DEFAULT, H5P_DEFAULT);
- if( attr_id > 0 )
- {
- Attribute attr;
- f_Attribute_setId(&attr, attr_id);
- return(attr);
- }
- else
- {
- throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed");
- }
+ hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER,
+ H5_ITER_INC, static_cast<hsize_t>(idx), H5P_DEFAULT, H5P_DEFAULT);
+ if (attr_id > 0)
+ {
+ Attribute attr;
+ f_Attribute_setId(&attr, attr_id);
+ return(attr);
+ }
+ else
+ {
+ throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: H5Object::iterateAttrs
-///\brief Iterates a user's function over all the attributes of an H5
-/// object, which may be a group, dataset or named datatype.
-///\param user_op - IN: User's function to operate on each attribute
-///\param _idx - IN/OUT: Starting (IN) and ending (OUT) attribute indices
-///\param op_data - IN: User's data to pass to user's operator function
-///\return Returned value of the last operator if it was non-zero, or
-/// zero if all attributes were processed
-///\exception H5::AttributeIException
+// Function: H5Object::iterateAttrs
+///\brief Iterates a user's function over all the attributes of an H5
+/// object, which may be a group, dataset or named datatype.
+///\param user_op - IN: User's function to operate on each attribute
+///\param _idx - IN/OUT: Starting (IN) and ending (OUT) attribute indices
+///\param op_data - IN: User's data to pass to user's operator function
+///\return Returned value of the last operator if it was non-zero, or
+/// zero if all attributes were processed
+///\exception H5::AttributeIException
///\par Description
-/// The signature of user_op is
-/// void (*)(H5::H5Location&, H5std_string, void*).
-/// For information, please refer to the C layer Reference Manual
-/// at:
+/// The signature of user_op is
+/// void (*)(H5::H5Location&, H5std_string, void*).
+/// For information, please refer to the C layer Reference Manual
+/// at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Iterate
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_data )
+int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_data)
{
- // store the user's function and data
- UserData4Aiterate* userData = new UserData4Aiterate;
- userData->opData = op_data;
- userData->op = user_op;
- userData->location = this;
-
- // call the C library routine H5Aiterate2 to iterate the attributes
- hsize_t idx = _idx ? static_cast<hsize_t>(*_idx) : 0;
- int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx,
- userAttrOpWrpr, reinterpret_cast<void *>(userData));
-
- // release memory
- delete userData;
-
- if( ret_value >= 0 ) {
- /* Pass back update index value to calling code */
- if (_idx)
- *_idx = static_cast<unsigned>(idx);
-
- return( ret_value );
- }
- else // raise exception when H5Aiterate returns a negative value
- throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed");
+ // store the user's function and data
+ UserData4Aiterate* userData = new UserData4Aiterate;
+ userData->opData = op_data;
+ userData->op = user_op;
+ userData->location = this;
+
+ // call the C library routine H5Aiterate2 to iterate the attributes
+ hsize_t idx = _idx ? static_cast<hsize_t>(*_idx) : 0;
+ int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx,
+ userAttrOpWrpr, reinterpret_cast<void *>(userData));
+
+ // release memory
+ delete userData;
+
+ if (ret_value >= 0) {
+ /* Pass back update index value to calling code */
+ if (_idx)
+ *_idx = static_cast<unsigned>(idx);
+ return(ret_value);
+ }
+ else // raise exception when H5Aiterate returns a negative value
+ throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed");
}
//--------------------------------------------------------------------------
@@ -291,106 +290,106 @@ unsigned H5Object::objVersion() const
}
//--------------------------------------------------------------------------
-// Function: H5Object::getNumAttrs
-///\brief Returns the number of attributes attached to this HDF5 object.
-///\return Number of attributes
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Object::getNumAttrs
+///\brief Returns the number of attributes attached to this HDF5 object.
+///\return Number of attributes
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int H5Object::getNumAttrs() const
{
- H5O_info_t oinfo; /* Object info */
+ H5O_info_t oinfo; /* Object info */
- if(H5Oget_info(getId(), &oinfo) < 0)
- throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed");
- else
- return(static_cast<int>(oinfo.num_attrs));
+ if(H5Oget_info(getId(), &oinfo) < 0)
+ throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed");
+ else
+ return(static_cast<int>(oinfo.num_attrs));
}
//--------------------------------------------------------------------------
-// Function: H5Object::attrExists
-///\brief Checks whether the named attribute exists at this location.
-///\param name - IN: Name of the attribute to be queried
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2013
+// Function: H5Object::attrExists
+///\brief Checks whether the named attribute exists at this location.
+///\param name - IN: Name of the attribute to be queried
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2013
//--------------------------------------------------------------------------
bool H5Object::attrExists(const char* name) const
{
- // Call C routine H5Aexists to determine whether an attribute exists
- // at this location, which could be specified by a file, group, dataset,
- // or named datatype.
- herr_t ret_value = H5Aexists(getId(), name);
- if( ret_value > 0 )
- return true;
- else if(ret_value == 0)
- return false;
- else // Raise exception when H5Aexists returns a negative value
- throw AttributeIException(inMemFunc("attrExists"), "H5Aexists failed");
+ // Call C routine H5Aexists to determine whether an attribute exists
+ // at this location, which could be specified by a file, group, dataset,
+ // or named datatype.
+ herr_t ret_value = H5Aexists(getId(), name);
+ if (ret_value > 0)
+ return true;
+ else if(ret_value == 0)
+ return false;
+ else // Raise exception when H5Aexists returns a negative value
+ throw AttributeIException(inMemFunc("attrExists"), "H5Aexists failed");
}
//--------------------------------------------------------------------------
-// Function: H5Object::attrExists
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Object::attrExists
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
bool H5Object::attrExists(const H5std_string& name) const
{
- return(attrExists(name.c_str()));
+ return(attrExists(name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: H5Object::removeAttr
-///\brief Removes the named attribute from this object.
-///\param name - IN: Name of the attribute to be removed
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Object::removeAttr
+///\brief Removes the named attribute from this object.
+///\param name - IN: Name of the attribute to be removed
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Object::removeAttr( const char* name ) const
+void H5Object::removeAttr(const char* name) const
{
- herr_t ret_value = H5Adelete(getId(), name);
- if( ret_value < 0 )
- throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed");
+ herr_t ret_value = H5Adelete(getId(), name);
+ if (ret_value < 0)
+ throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed");
}
//--------------------------------------------------------------------------
-// Function: H5Object::removeAttr
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Object::removeAttr
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void H5Object::removeAttr( const H5std_string& name ) const
+void H5Object::removeAttr(const H5std_string& name) const
{
- removeAttr( name.c_str() );
+ removeAttr(name.c_str());
}
//--------------------------------------------------------------------------
-// Function: H5Object::renameAttr
-///\brief Renames the named attribute from this object.
-///\param oldname - IN: Name of the attribute to be renamed
-///\param newname - IN: New name ame of the attribute
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - Mar, 2005
+// Function: H5Object::renameAttr
+///\brief Renames the named attribute from this object.
+///\param oldname - IN: Name of the attribute to be renamed
+///\param newname - IN: New name ame of the attribute
+///\exception H5::AttributeIException
+// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
void H5Object::renameAttr(const char* oldname, const char* newname) const
{
- herr_t ret_value = H5Arename(getId(), oldname, newname);
- if (ret_value < 0)
- throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed");
+ herr_t ret_value = H5Arename(getId(), oldname, newname);
+ if (ret_value < 0)
+ throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed");
}
//--------------------------------------------------------------------------
-// Function: H5Object::renameAttr
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for the names.
-// Programmer Binh-Minh Ribler - Mar, 2005
+// Function: H5Object::renameAttr
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes
+/// a reference to an \c H5std_string for the names.
+// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newname) const
{
- renameAttr (oldname.c_str(), newname.c_str());
+ renameAttr (oldname.c_str(), newname.c_str());
}
//--------------------------------------------------------------------------
// Function: getObjName
@@ -405,11 +404,11 @@ ssize_t H5Object::getObjName(char *obj_name, size_t buf_size) const
// If H5Iget_name returns a negative value, raise an exception
if (name_size < 0)
- {
+ {
throw Exception(inMemFunc("getObjName"), "H5Iget_name failed");
}
else if (name_size == 0)
- {
+ {
throw Exception(inMemFunc("getObjName"), "Object must have a name, but name length is 0");
}
// Return length of the name
@@ -433,16 +432,16 @@ H5std_string H5Object::getObjName() const
// If H5Iget_name failed, throw exception
if (name_size < 0)
- {
+ {
throw Exception(inMemFunc("getObjName"), "H5Iget_name failed");
}
else if (name_size == 0)
- {
+ {
throw Exception(inMemFunc("getObjName"), "Object must have a name, but name length is 0");
}
// Object's name exists, retrieve it
else if (name_size > 0)
- {
+ {
char* name_C = new char[name_size+1]; // temporary C-string
HDmemset(name_C, 0, name_size+1); // clear buffer
@@ -478,13 +477,13 @@ ssize_t H5Object::getObjName(H5std_string& obj_name, size_t len) const
// If no length is provided, get the entire object name
if (len == 0)
- {
+ {
obj_name = getObjName();
name_size = obj_name.length();
}
// If length is provided, get that number of characters in name
else
- {
+ {
char* name_C = new char[len+1]; // temporary C-string
HDmemset(name_C, 0, len+1); // clear buffer
@@ -505,9 +504,9 @@ ssize_t H5Object::getObjName(H5std_string& obj_name, size_t len) const
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: H5Object destructor
-///\brief Noop destructor.
-// Programmer Binh-Minh Ribler - 2000
+// Function: H5Object destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5Object::~H5Object() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h
index 5ea8937..866d739 100644
--- a/c++/src/H5Object.h
+++ b/c++/src/H5Object.h
@@ -24,20 +24,20 @@ namespace H5 {
and Group.
Modification:
- Sept 18, 2012: Added class H5Location in between IdComponent and
- H5Object. An H5File now inherits from H5Location. All HDF5
- wrappers in H5Object are moved up to H5Location. H5Object
- is left mostly empty for future wrappers that are only for
- group, dataset, and named datatype. Note that the reason for
- adding H5Location instead of simply moving H5File to be under
- H5Object is H5File is not an HDF5 object, and renaming H5Object
- to H5Location will risk breaking user applications.
- -BMR
- Apr 2, 2014: Added wrapper getObjName for H5Iget_name
- Sep 21, 2016: Rearranging classes (HDFFV-9920) moved H5A wrappers back
- into H5Object. This way, C functions that takes attribute id
- can be in H5Location and those that cannot take attribute id
- can be in H5Object.
+ Sept 18, 2012: Added class H5Location in between IdComponent and
+ H5Object. An H5File now inherits from H5Location. All HDF5
+ wrappers in H5Object are moved up to H5Location. H5Object
+ is left mostly empty for future wrappers that are only for
+ group, dataset, and named datatype. Note that the reason for
+ adding H5Location instead of simply moving H5File to be under
+ H5Object is H5File is not an HDF5 object, and renaming H5Object
+ to H5Location will risk breaking user applications.
+ -BMR
+ Apr 2, 2014: Added wrapper getObjName for H5Iget_name
+ Sep 21, 2016: Rearranging classes (HDFFV-9920) moved H5A wrappers back
+ into H5Object. This way, C functions that takes attribute id
+ can be in H5Location and those that cannot take attribute id
+ can be in H5Object.
Inheritance: H5Location -> IdComponent
*/
@@ -46,88 +46,88 @@ class H5_DLLCPP H5Object;
class H5_DLLCPP Attribute;
// Define the operator function pointer for H5Aiterate().
-typedef void (*attr_operator_t)( H5Object& loc/*in*/,
+typedef void (*attr_operator_t)(H5Object& loc/*in*/,
const H5std_string attr_name/*in*/,
void *operator_data/*in,out*/);
// User data for attribute iteration
class UserData4Aiterate {
public:
- attr_operator_t op;
- void* opData;
- H5Object* location;
+ attr_operator_t op;
+ void* opData;
+ H5Object* location;
};
class H5_DLLCPP H5Object : public H5Location {
public:
- // Creates an attribute for the specified object
- // PropList is currently not used, so always be default.
- Attribute createAttribute( const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const;
- Attribute createAttribute( const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT ) const;
+ // Creates an attribute for the specified object
+ // PropList is currently not used, so always be default.
+ Attribute createAttribute(const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
+ Attribute createAttribute(const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
- // Given its name, opens the attribute that belongs to an object at
- // this location.
- Attribute openAttribute( const char* name ) const;
- Attribute openAttribute( const H5std_string& name ) const;
+ // Given its name, opens the attribute that belongs to an object at
+ // this location.
+ Attribute openAttribute(const char* name) const;
+ Attribute openAttribute(const H5std_string& name) const;
- // Given its index, opens the attribute that belongs to an object at
- // this location.
- Attribute openAttribute( const unsigned int idx ) const;
+ // Given its index, opens the attribute that belongs to an object at
+ // this location.
+ Attribute openAttribute(const unsigned int idx) const;
- // Iterate user's function over the attributes of this object.
- int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL);
+ // Iterate user's function over the attributes of this object.
+ int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL);
- // Returns the object header version of an object
- unsigned objVersion() const;
+ // Returns the object header version of an object
+ unsigned objVersion() const;
- // Determines the number of attributes belong to this object.
- int getNumAttrs() const;
+ // Determines the number of attributes belong to this object.
+ int getNumAttrs() const;
- // Checks whether the named attribute exists for this object.
- bool attrExists(const char* name) const;
- bool attrExists(const H5std_string& name) const;
+ // Checks whether the named attribute exists for this object.
+ bool attrExists(const char* name) const;
+ bool attrExists(const H5std_string& name) const;
- // Renames the named attribute to a new name.
- void renameAttr(const char* oldname, const char* newname) const;
- void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
+ // Renames the named attribute to a new name.
+ void renameAttr(const char* oldname, const char* newname) const;
+ void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
- // Removes the named attribute from this object.
- void removeAttr(const char* name) const;
- void removeAttr(const H5std_string& name) const;
+ // Removes the named attribute from this object.
+ void removeAttr(const char* name) const;
+ void removeAttr(const H5std_string& name) const;
- // Returns an identifier.
- virtual hid_t getId() const = 0;
+ // Returns an identifier.
+ virtual hid_t getId() const = 0;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Gets the name of this HDF5 object, i.e., Group, DataSet, or
- // DataType. These should have const but are retiring anyway.
- ssize_t getObjName(char *obj_name, size_t buf_size = 0) const;
- ssize_t getObjName(H5std_string& obj_name, size_t len = 0) const;
- H5std_string getObjName() const;
+ // Gets the name of this HDF5 object, i.e., Group, DataSet, or
+ // DataType. These should have const but are retiring anyway.
+ ssize_t getObjName(char *obj_name, size_t buf_size = 0) const;
+ ssize_t getObjName(H5std_string& obj_name, size_t len = 0) const;
+ H5std_string getObjName() const;
protected:
- // Default constructor
- H5Object();
+ // Default constructor
+ H5Object();
- // *** Deprecation warning ***
- // The following two constructors are no longer appropriate after the
- // data member "id" had been moved to the sub-classes.
- // The copy constructor is a noop and is removed in 1.8.15 and the
- // other will be removed from 1.10 release, and then from 1.8 if its
- // removal does not raise any problems in two 1.10 releases.
+ // *** Deprecation warning ***
+ // The following two constructors are no longer appropriate after the
+ // data member "id" had been moved to the sub-classes.
+ // The copy constructor is a noop and is removed in 1.8.15 and the
+ // other will be removed from 1.10 release, and then from 1.8 if its
+ // removal does not raise any problems in two 1.10 releases.
- // Creates a copy of an existing object giving the object id
- H5Object( const hid_t object_id );
+ // Creates a copy of an existing object giving the object id
+ H5Object(const hid_t object_id);
- // Copy constructor: makes copy of an H5Object object.
- // H5Object(const H5Object& original);
+ // Copy constructor: makes copy of an H5Object object.
+ // H5Object(const H5Object& original);
- // Sets the identifier of this object to a new value. - this one
- // doesn't increment reference count
- virtual void p_setId(const hid_t new_id) = 0;
+ // Sets the identifier of this object to a new value. - this one
+ // doesn't increment reference count
+ virtual void p_setId(const hid_t new_id) = 0;
- // Noop destructor.
- virtual ~H5Object();
+ // Noop destructor.
+ virtual ~H5Object();
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5OcreatProp.cpp b/c++/src/H5OcreatProp.cpp
index 397a96f..6fdd9dc 100644
--- a/c++/src/H5OcreatProp.cpp
+++ b/c++/src/H5OcreatProp.cpp
@@ -75,49 +75,49 @@ void ObjCreatPropList::deleteConstants()
}
//--------------------------------------------------------------------------
-// Purpose: Constant for default property
+// Purpose: Constant for default property
//--------------------------------------------------------------------------
const ObjCreatPropList& ObjCreatPropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: Default Constructor
-///\brief Creates a file access property list
-// Programmer: Binh-Minh Ribler - 2000
+// Function: Default Constructor
+///\brief Creates a file access property list
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
ObjCreatPropList::ObjCreatPropList() : PropList(H5P_OBJECT_CREATE) {}
//--------------------------------------------------------------------------
-// Function: ObjCreatPropList copy constructor
-///\brief Copy Constructor: makes a copy of the original
-///\param original - IN: ObjCreatPropList instance to copy
-// Programmer: Binh-Minh Ribler - 2000
+// Function: ObjCreatPropList copy constructor
+///\brief Copy Constructor: makes a copy of the original
+///\param original - IN: ObjCreatPropList instance to copy
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
ObjCreatPropList::ObjCreatPropList(const ObjCreatPropList& original) : PropList(original) {}
//--------------------------------------------------------------------------
-// Function: ObjCreatPropList overloaded constructor
-///\brief Creates a file access property list using the id of an
-/// existing one.
-// Programmer: Binh-Minh Ribler - 2000
+// Function: ObjCreatPropList overloaded constructor
+///\brief Creates a file access property list using the id of an
+/// existing one.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
ObjCreatPropList::ObjCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
//--------------------------------------------------------------------------
-// Function: ObjCreatPropList::setAttrPhaseChange
-///\brief Sets attribute storage phase change thresholds.
-///\param max_compact - IN: Maximum number of attributes to be stored in
-/// compact storage. Default to 8
-///\param min_dense - IN: Minimum number of attributes to be stored in
-/// dense storage. Default to 6
-///\exception H5::PropListIException
+// Function: ObjCreatPropList::setAttrPhaseChange
+///\brief Sets attribute storage phase change thresholds.
+///\param max_compact - IN: Maximum number of attributes to be stored in
+/// compact storage. Default to 8
+///\param min_dense - IN: Minimum number of attributes to be stored in
+/// dense storage. Default to 6
+///\exception H5::PropListIException
///\par Description
-/// If \c max_compact is set to 0, dense storage will be used.
-/// For more detail about on attribute storage, please refer to the
-/// C layer Reference Manual at:
+/// If \c max_compact is set to 0, dense storage will be used.
+/// For more detail about on attribute storage, please refer to the
+/// C layer Reference Manual at:
/// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetAttrPhaseChange
-// Programmer: Binh-Minh Ribler - September 2015
+// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
void ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_dense) const
{
@@ -129,19 +129,19 @@ void ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_den
}
//--------------------------------------------------------------------------
-// Function: ObjCreatPropList::getAttrPhaseChange
-///\brief Gets attribute storage phase change thresholds.
-///\param max_compact - OUT: Maximum number of attributes to be stored in
-/// compact storage.
-///\param min_dense - OUT: Minimum number of attributes to be stored in
-/// dense storage.
-///\exception H5::PropListIException
+// Function: ObjCreatPropList::getAttrPhaseChange
+///\brief Gets attribute storage phase change thresholds.
+///\param max_compact - OUT: Maximum number of attributes to be stored in
+/// compact storage.
+///\param min_dense - OUT: Minimum number of attributes to be stored in
+/// dense storage.
+///\exception H5::PropListIException
///\par Description
-/// If \c max_compact is set to 0, dense storage will be used.
-/// For more detail about on attribute storage, please refer to the
-/// C layer Reference Manual at:
+/// If \c max_compact is set to 0, dense storage will be used.
+/// For more detail about on attribute storage, please refer to the
+/// C layer Reference Manual at:
/// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetAttrPhaseChange
-// Programmer: Binh-Minh Ribler - September 2015
+// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
void ObjCreatPropList::getAttrPhaseChange(unsigned& max_compact, unsigned& min_dense) const
{
@@ -154,23 +154,23 @@ void ObjCreatPropList::getAttrPhaseChange(unsigned& max_compact, unsigned& min_d
}
//--------------------------------------------------------------------------
-// Function: ObjCreatPropList::setAttrCrtOrder
-///\brief Sets tracking and indexing of attribute creation order.
-///\param crt_order_flags - IN: Flags specifying whether to track and
-/// index attribute creation order. Default: No flag set
-///\exception H5::PropListIException
+// Function: ObjCreatPropList::setAttrCrtOrder
+///\brief Sets tracking and indexing of attribute creation order.
+///\param crt_order_flags - IN: Flags specifying whether to track and
+/// index attribute creation order. Default: No flag set
+///\exception H5::PropListIException
///\par Description
-/// Valid flags are:
-/// \li \c H5P_CRT_ORDER_TRACKED - Attribute creation order is tracked
-/// \li \c H5P_CRT_ORDER_INDEXED - Attribute creation order is
-/// indexed (requires H5P_CRT_ORDER_TRACKED).
-/// When no flag is set, attribute creation order is neither
-/// tracked not indexed. Note that HDF5 currently provides no
-/// mechanism to turn on attribute creation order tracking at object
-/// creation time and to build the index later.
-/// The C layer Reference Manual at can be found at:
+/// Valid flags are:
+/// \li \c H5P_CRT_ORDER_TRACKED - Attribute creation order is tracked
+/// \li \c H5P_CRT_ORDER_INDEXED - Attribute creation order is
+/// indexed (requires H5P_CRT_ORDER_TRACKED).
+/// When no flag is set, attribute creation order is neither
+/// tracked not indexed. Note that HDF5 currently provides no
+/// mechanism to turn on attribute creation order tracking at object
+/// creation time and to build the index later.
+/// The C layer Reference Manual at can be found at:
/// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetAttrCreationOrder
-// Programmer: Binh-Minh Ribler - September 2015
+// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
void ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const
{
@@ -182,18 +182,18 @@ void ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const
}
//--------------------------------------------------------------------------
-// Function: ObjCreatPropList::getAttrCrtOrder
-///\brief Gets tracking and indexing settings for attribute
-/// creation order.
-///\param crt_order_flags - OUT: Flags specifying whether to track and
-/// index attribute creation order
-///\exception H5::PropListIException
+// Function: ObjCreatPropList::getAttrCrtOrder
+///\brief Gets tracking and indexing settings for attribute
+/// creation order.
+///\param crt_order_flags - OUT: Flags specifying whether to track and
+/// index attribute creation order
+///\exception H5::PropListIException
///\par Description
-/// When no flag is set, i.e. crt_order_flags = 0, attribute
-/// creation order is neither tracked not indexed.
-/// The C layer Reference Manual at can be found at:
+/// When no flag is set, i.e. crt_order_flags = 0, attribute
+/// creation order is neither tracked not indexed.
+/// The C layer Reference Manual at can be found at:
/// https://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetAttrCreationOrder
-// Programmer: Binh-Minh Ribler - September 2015
+// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
unsigned ObjCreatPropList::getAttrCrtOrder() const
{
@@ -208,9 +208,9 @@ unsigned ObjCreatPropList::getAttrCrtOrder() const
}
//--------------------------------------------------------------------------
-// Function: ObjCreatPropList destructor
-///\brief Noop destructor
-// Programmer Binh-Minh Ribler - 2000
+// Function: ObjCreatPropList destructor
+///\brief Noop destructor
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
ObjCreatPropList::~ObjCreatPropList() {}
diff --git a/c++/src/H5OcreatProp.h b/c++/src/H5OcreatProp.h
index bfba1c4..4858e07 100644
--- a/c++/src/H5OcreatProp.h
+++ b/c++/src/H5OcreatProp.h
@@ -27,37 +27,37 @@ namespace H5 {
*/
class H5_DLLCPP ObjCreatPropList : public PropList {
public:
- ///\brief Default object creation property list.
- static const ObjCreatPropList& DEFAULT;
+ ///\brief Default object creation property list.
+ static const ObjCreatPropList& DEFAULT;
- // Creates a object creation property list.
- ObjCreatPropList();
+ // Creates a object creation property list.
+ ObjCreatPropList();
- // Sets attribute storage phase change thresholds.
- void setAttrPhaseChange(unsigned max_compact = 8, unsigned min_dense = 6) const;
+ // Sets attribute storage phase change thresholds.
+ void setAttrPhaseChange(unsigned max_compact = 8, unsigned min_dense = 6) const;
- // Gets attribute storage phase change thresholds.
- void getAttrPhaseChange(unsigned& max_compact, unsigned& min_dense) const;
+ // Gets attribute storage phase change thresholds.
+ void getAttrPhaseChange(unsigned& max_compact, unsigned& min_dense) const;
- // Sets tracking and indexing of attribute creation order.
- void setAttrCrtOrder(unsigned crt_order_flags) const;
+ // Sets tracking and indexing of attribute creation order.
+ void setAttrCrtOrder(unsigned crt_order_flags) const;
- // Gets tracking and indexing settings for attribute creation order.
- unsigned getAttrCrtOrder() const;
+ // Gets tracking and indexing settings for attribute creation order.
+ unsigned getAttrCrtOrder() const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("ObjCreatPropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("ObjCreatPropList"); }
- // Copy constructor: creates a copy of a ObjCreatPropList object.
- ObjCreatPropList( const ObjCreatPropList& original );
+ // Copy constructor: creates a copy of a ObjCreatPropList object.
+ ObjCreatPropList(const ObjCreatPropList& original);
- // Creates a copy of an existing object creation property list
- // using the property list id.
- ObjCreatPropList (const hid_t plist_id);
+ // Creates a copy of an existing object creation property list
+ // using the property list id.
+ ObjCreatPropList (const hid_t plist_id);
- // Noop destructor
- virtual ~ObjCreatPropList();
+ // Noop destructor
+ virtual ~ObjCreatPropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp
index e2eed18..03327c8 100644
--- a/c++/src/H5PredType.cpp
+++ b/c++/src/H5PredType.cpp
@@ -32,14 +32,14 @@ namespace H5 {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: PredType overloaded constructor
-///\brief Creates a PredType object using the id of an existing
-/// predefined datatype.
-///\param predtype_id - IN: Id of a predefined datatype
+// Function: PredType overloaded constructor
+///\brief Creates a PredType object using the id of an existing
+/// predefined datatype.
+///\param predtype_id - IN: Id of a predefined datatype
// Description
-// This constructor creates a PredType object by copying
-// the provided HDF5 predefined datatype.
-// Programmer Binh-Minh Ribler - 2000
+// This constructor creates a PredType object by copying
+// the provided HDF5 predefined datatype.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
PredType::PredType(const hid_t predtype_id) : AtomType(predtype_id)
{
@@ -47,69 +47,69 @@ PredType::PredType(const hid_t predtype_id) : AtomType(predtype_id)
}
//--------------------------------------------------------------------------
-// Function: PredType default constructor
-///\brief Default constructor: Creates a stub predefined datatype
-// Programmer Binh-Minh Ribler - 2000
+// Function: PredType default constructor
+///\brief Default constructor: Creates a stub predefined datatype
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
PredType::PredType() : AtomType() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: PredType copy constructor
-///\brief Copy constructor: makes a copy of the original PredType object.
-///\param original - IN: PredType instance to copy
-// Programmer Binh-Minh Ribler - 2000
+// Function: PredType copy constructor
+///\brief Copy constructor: makes a copy of the original PredType object.
+///\param original - IN: PredType instance to copy
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
PredType::PredType(const PredType& original) : AtomType(original) {}
//--------------------------------------------------------------------------
-// Function: PredType::operator=
-///\brief Assignment operator.
-///\param rhs - IN: Reference to the predefined datatype
-///\return Reference to PredType instance
-///\exception H5::DataTypeIException
+// Function: PredType::operator=
+///\brief Assignment operator.
+///\param rhs - IN: Reference to the predefined datatype
+///\return Reference to PredType instance
+///\exception H5::DataTypeIException
// Description
-// Makes a copy of the type on the right hand side and stores
-// the new id in the left hand side object.
-// Programmer Binh-Minh Ribler - 2000
+// Makes a copy of the type on the right hand side and stores
+// the new id in the left hand side object.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PredType& PredType::operator=( const PredType& rhs )
+PredType& PredType::operator=(const PredType& rhs)
{
if (this != &rhs)
- copy(rhs);
+ copy(rhs);
return(*this);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// These dummy functions do not inherit from DataType - they'll
// throw an DataTypeIException if invoked.
-void PredType::commit(H5Location& loc, const char* name )
+void PredType::commit(H5Location& loc, const char* name)
{
- throw DataTypeIException("PredType::commit", "Error: Attempted to commit a predefined datatype. Invalid operation!" );
+ throw DataTypeIException("PredType::commit", "Error: Attempted to commit a predefined datatype. Invalid operation!");
}
-void PredType::commit(H5Location& loc, const H5std_string& name )
+void PredType::commit(H5Location& loc, const H5std_string& name)
{
- commit( loc, name.c_str());
+ commit(loc, name.c_str());
}
bool PredType::committed()
{
- throw DataTypeIException("PredType::committed", "Error: Attempting to check for commit status on a predefined datatype." );
+ throw DataTypeIException("PredType::committed", "Error: Attempting to check for commit status on a predefined datatype.");
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
// Default destructor
//--------------------------------------------------------------------------
-// Function: PredType destructor
-///\brief Noop destructor.
-// Programmer Binh-Minh Ribler - 2000
+// Function: PredType destructor
+///\brief Noop destructor.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
PredType::~PredType() {}
/*****************************************************************************
- The following section is regarding the global constants PredType,
- DataSpace, and PropList.
+ The following section is regarding the global constants PredType,
+ DataSpace, and PropList.
*****************************************************************************/
@@ -292,18 +292,18 @@ PredType* PredType::NATIVE_UINT_FAST64_;
#endif /* H5_SIZEOF_UINT_FAST64_T */
//--------------------------------------------------------------------------
-// Function: PredType::getPredTypes
-// Purpose: Returns the dummy PredType constant object pointer
-// Return: PredType object pointer
+// Function: PredType::getPredTypes
+// Purpose Returns the dummy PredType constant object pointer
+// Return: PredType object pointer
// Description
-// If the dummy constant PREDTYPE_CONST_ is not allocated yet,
-// call makePredTypes() to allocate all of the PredType constants.
-// Otherwise, just simply return the object pointer PREDTYPE_CONST_.
+// If the dummy constant PREDTYPE_CONST_ is not allocated yet,
+// call makePredTypes() to allocate all of the PredType constants.
+// Otherwise, just simply return the object pointer PREDTYPE_CONST_.
//
-// Note that, there is a similar function to getPredTypes() in
-// other classes, that have global constants, is called getConstant().
+// Note that, there is a similar function to getPredTypes() in
+// other classes, that have global constants, is called getConstant().
//
-// Programmer Binh-Minh Ribler - September 2015
+// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
PredType* PredType::getPredTypes()
{
@@ -318,16 +318,16 @@ PredType* PredType::getPredTypes()
// If the dummy constant pointer is not allocated, allocate all PredType
// constant pointers. Otherwise, throw because it shouldn't be.
if (PREDTYPE_CONST_ == 0)
- makePredTypes();
+ makePredTypes();
else
- throw H5::DataTypeIException("PredType::getPredTypes", "PredType::getPredTypes is being invoked on an allocated PREDTYPE_CONST_");
+ throw H5::DataTypeIException("PredType::getPredTypes", "PredType::getPredTypes is being invoked on an allocated PREDTYPE_CONST_");
return PREDTYPE_CONST_;
}
//--------------------------------------------------------------------------
-// Function: PredType::makePredTypes
-// Purpose: Allocate all PredType constants.
-// Programmer Binh-Minh Ribler - September 2015
+// Function: PredType::makePredTypes
+// Purpose Allocate all PredType constants.
+// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
void PredType::makePredTypes()
{
@@ -515,9 +515,9 @@ void PredType::makePredTypes()
//--------------------------------------------------------------------------
-// Function: PredType::deleteConstants
-// Purpose: Deletes all PredType constant pointers.
-// Programmer Binh-Minh Ribler - September 2015
+// Function: PredType::deleteConstants
+// Purpose Deletes all PredType constant pointers.
+// Programmer Binh-Minh Ribler - September 2015
//--------------------------------------------------------------------------
void PredType::deleteConstants()
{
@@ -891,206 +891,205 @@ const PredType& PredType::NATIVE_UINT_FAST64 = *NATIVE_UINT_FAST64_;
} // end namespace
/***************************************************************************
- Design Note
- ===========
+ Design Note
+ ===========
September 2015:
- The C++ library has several types of global constants from different
- classes, such as PropList, PredType, DataSpace, etc... Previously,
- these global constants were declared statically and the C++ library used
- a constant, called PredType::AtExit, to detect when all the global
- contants are destroyed then close the C library (H5close). This method
- relied on the order of the constants being created and destroyed and
- that PredType constants be the last to be destroyed. In September
- 2015, it was recognized that the order in which the global constants were
- created and destroyed was actually undefined, thus can be different
- between different compilers. This resulted in failure when compilers
- destroy PredType constants before others because when PredType::AtExit
- was destroyed, the C library was closed, so when the constants of other
- classes such as PropList or DataSpace were being deleted, the C library
- would not be available.
-
- These are the classes that have global constants:
- + PredType
- + DataSpace
- + PropList (and its subclasses below)
- + FileAccPropList
- + FileCreatPropList
- + DSetMemXferPropList
- + DSetCreatPropList
-
-
- The new method includes these main points:
-
- - The C++ library uses dynamically allocated constants to have the
- control in which order the global constants are created/destroyed.
-
- - The previous static constants are changed to be the references to
- the dynamically allocated constants to avoid impact on applications.
-
- - The first time an IdComponent default constructor is invoked, it
- will call the function H5Library::initH5cpp which registers the
- terminating functions from each class that has the global constants
- so that these functions can destroy those constants at the exit of the
- application. IdComponent is a baseclass of any object class that has
- an identifier, such as Group, DataSet, DataType,... The classes which
- have the global constants are all derived from IdComponent.
-
- - At the normal termination of the application, each registered function
- for each constant type will delete all the allocated constants in
- that type class, then a different terminating function, which was also
- registered with atexit() by initH5cpp, will call H5close to close the
- C library.
-
- The following list presents the differences between the old and new
- methods and the changes implemented for the new method.
-
- 1. The following items are added to class H5Library:
- // Private instance to be created by H5Library only
- static H5Library* instance;
-
- // Returns a singleton H5Library to initialize the global
- // constants, invoked in IdComponent default constructor
- static H5Library* getInstance(); // public
-
- // Registers cleanup and terminating functions with atexit(),
- // called in IdComponent default constructor
- static void initH5cpp(void); // public
-
- // Calls H5close to terminate the library, registered with
- // atexit(), as the last thing to be done.
- static void termH5cpp(void); // public
-
- 2. The following shows the differences between the old and new methods
- for allocating the PredType constants. There are more than 100
- constants, but only one is shown here for examples.
-
- Old Method:
- ----------
- // Declaration of the constant - in "H5PredType.h"
- static const PredType NATIVE_INT;
-
- // Definition of the constant - in "H5PredType.cpp"
- const PredType PredType::NATIVE_INT(H5T_NATIVE_INT);
-
- New Method:
- ----------
- // Declare pointer for a constant - in "H5PredType.h"
- static PredType* NATIVE_INT_; // "H5PredType.h"
-
- // Change previous constant to reference - in "H5PredType.h"
- static const PredType& NATIVE_INT;
-
- // The assignment of the first static constant, named
- // PREDTYPE_CONST, calls makePredTypes() which allocates the
- // dynamic memory for every PredType constant.
-
- // Creates a dynamic PredType object representing a C constant
- // - in makePredTypes()
- NATIVE_INT_ = new PredType(H5T_NATIVE_INT);
-
- // Assign the constant reference to the dynamic object
- // - in "H5PredType.cpp"
- const PredType& PredType::NATIVE_INT = *NATIVE_INT_;
-
- Functions added to class PredType:
-
- // Creates the constants
- static void makePredTypes(); // private
-
- // Calls makePredTypes to create the constants and returns
- // the dummy constant PREDTYPE_CONST;
- static PredType* getPredTypes(); // private
-
- // Deletes the constants
- static void deleteConstants(); // public
-
- 3. This section shows the differences between the old and new methods
- for allocating the DataSpace constant, DataSpace::ALL.
+ The C++ library has several types of global constants from different
+ classes, such as PropList, PredType, DataSpace, etc... Previously,
+ these global constants were declared statically and the C++ library used
+ a constant, called PredType::AtExit, to detect when all the global
+ contants are destroyed then close the C library (H5close). This method
+ relied on the order of the constants being created and destroyed and
+ that PredType constants be the last to be destroyed. In September
+ 2015, it was recognized that the order in which the global constants were
+ created and destroyed was actually undefined, thus can be different
+ between different compilers. This resulted in failure when compilers
+ destroy PredType constants before others because when PredType::AtExit
+ was destroyed, the C library was closed, so when the constants of other
+ classes such as PropList or DataSpace were being deleted, the C library
+ would not be available.
+
+ These are the classes that have global constants:
+ + PredType
+ + DataSpace
+ + PropList (and its subclasses below)
+ + FileAccPropList
+ + FileCreatPropList
+ + DSetMemXferPropList
+ + DSetCreatPropList
+
+ The new method includes these main points:
+
+ - The C++ library uses dynamically allocated constants to have the
+ control in which order the global constants are created/destroyed.
+
+ - The previous static constants are changed to be the references to
+ the dynamically allocated constants to avoid impact on applications.
+
+ - The first time an IdComponent default constructor is invoked, it
+ will call the function H5Library::initH5cpp which registers the
+ terminating functions from each class that has the global constants
+ so that these functions can destroy those constants at the exit of the
+ application. IdComponent is a baseclass of any object class that has
+ an identifier, such as Group, DataSet, DataType,... The classes which
+ have the global constants are all derived from IdComponent.
+
+ - At the normal termination of the application, each registered function
+ for each constant type will delete all the allocated constants in
+ that type class, then a different terminating function, which was also
+ registered with atexit() by initH5cpp, will call H5close to close the
+ C library.
+
+ The following list presents the differences between the old and new
+ methods and the changes implemented for the new method.
+
+ 1. The following items are added to class H5Library:
+ // Private instance to be created by H5Library only
+ static H5Library* instance;
+
+ // Returns a singleton H5Library to initialize the global
+ // constants, invoked in IdComponent default constructor
+ static H5Library* getInstance(); // public
+
+ // Registers cleanup and terminating functions with atexit(),
+ // called in IdComponent default constructor
+ static void initH5cpp(void); // public
+
+ // Calls H5close to terminate the library, registered with
+ // atexit(), as the last thing to be done.
+ static void termH5cpp(void); // public
+
+ 2. The following shows the differences between the old and new methods
+ for allocating the PredType constants. There are more than 100
+ constants, but only one is shown here for examples.
+
+ Old Method:
+ ----------
+ // Declaration of the constant - in "H5PredType.h"
+ static const PredType NATIVE_INT;
+
+ // Definition of the constant - in "H5PredType.cpp"
+ const PredType PredType::NATIVE_INT(H5T_NATIVE_INT);
+
+ New Method:
+ ----------
+ // Declare pointer for a constant - in "H5PredType.h"
+ static PredType* NATIVE_INT_; // "H5PredType.h"
+
+ // Change previous constant to reference - in "H5PredType.h"
+ static const PredType& NATIVE_INT;
+
+ // The assignment of the first static constant, named
+ // PREDTYPE_CONST, calls makePredTypes() which allocates the
+ // dynamic memory for every PredType constant.
+
+ // Creates a dynamic PredType object representing a C constant
+ // - in makePredTypes()
+ NATIVE_INT_ = new PredType(H5T_NATIVE_INT);
+
+ // Assign the constant reference to the dynamic object
+ // - in "H5PredType.cpp"
+ const PredType& PredType::NATIVE_INT = *NATIVE_INT_;
+
+ Functions added to class PredType:
+
+ // Creates the constants
+ static void makePredTypes(); // private
+
+ // Calls makePredTypes to create the constants and returns
+ // the dummy constant PREDTYPE_CONST;
+ static PredType* getPredTypes(); // private
+
+ // Deletes the constants
+ static void deleteConstants(); // public
+
+ 3. This section shows the differences between the old and new methods
+ for allocating the DataSpace constant, DataSpace::ALL.
- Old Method:
- ----------
- // Declaration of the constant - in "H5DataSpace.h"
- static const DataSpace ALL;
+ Old Method:
+ ----------
+ // Declaration of the constant - in "H5DataSpace.h"
+ static const DataSpace ALL;
- // Definition of the constant - in "H5DataSpace.cpp"
- const DataSpace DataSpace::ALL(H5S_ALL);
+ // Definition of the constant - in "H5DataSpace.cpp"
+ const DataSpace DataSpace::ALL(H5S_ALL);
- New Method:
- ----------
- // Declare pointer for a constant - in "H5DataSpace.h"
- static DataSpace* ALL_; // "H5DataSpace.h"
+ New Method:
+ ----------
+ // Declare pointer for a constant - in "H5DataSpace.h"
+ static DataSpace* ALL_; // "H5DataSpace.h"
- // Change previous constant to reference - in "H5DataSpace.h"
- static const DataSpace& ALL;
+ // Change previous constant to reference - in "H5DataSpace.h"
+ static const DataSpace& ALL;
- // Creates a dynamic DataSpace object representing the C constant
- // - in "H5DataSpace.cpp"
- ALL_ = new DataSpace(H5S_ALL);
+ // Creates a dynamic DataSpace object representing the C constant
+ // - in "H5DataSpace.cpp"
+ ALL_ = new DataSpace(H5S_ALL);
- // Assign the constant reference to the dynamic object
- // - in "H5DataSpace.cpp"
- const DataSpace& DataSpace::ALL = *ALL_;
+ // Assign the constant reference to the dynamic object
+ // - in "H5DataSpace.cpp"
+ const DataSpace& DataSpace::ALL = *ALL_;
- Functions added to class DataSpace:
+ Functions added to class DataSpace:
- // Creates the constant
- static DataSpace* getConstant(); // private
+ // Creates the constant
+ static DataSpace* getConstant(); // private
- // Deletes the constant
- static void deleteConstants(); // public
+ // Deletes the constant
+ static void deleteConstants(); // public
- 4. This section shows the differences between the old and new methods
- for allocating the following constants
- - PropList constant, PropList::DEFAULT.
- - DSetCreatPropList constant, DSetCreatPropList::DEFAULT.
- - DSetMemXferPropList constant, DSetMemXferPropList::DEFAULT.
- - FileCreatPropList constant, FileCreatPropList::DEFAULT.
- - FileAccPropList constant, FileAccPropList::DEFAULT.
+ 4. This section shows the differences between the old and new methods
+ for allocating the following constants
+ - PropList constant, PropList::DEFAULT.
+ - DSetCreatPropList constant, DSetCreatPropList::DEFAULT.
+ - DSetMemXferPropList constant, DSetMemXferPropList::DEFAULT.
+ - FileCreatPropList constant, FileCreatPropList::DEFAULT.
+ - FileAccPropList constant, FileAccPropList::DEFAULT.
- For these constants, the library has the same changes, except the
- class names and the HDF5 corresponding constants. Only the items
- of PropList are listed, and "PropList" can be replaced by any of
- DSetCreatPropList, DSetMemXferPropList, FileCreatPropList,
- FileAccPropList for those classes. The HDF5 C constant "H5P_DEFAULT"
- can be replaced by any of these respectively: H5P_DATASET_CREATE,
- H5P_DATASET_XFER, H5P_FILE_CREATE, and H5P_FILE_ACCESS.
+ For these constants, the library has the same changes, except the
+ class names and the HDF5 corresponding constants. Only the items
+ of PropList are listed, and "PropList" can be replaced by any of
+ DSetCreatPropList, DSetMemXferPropList, FileCreatPropList,
+ FileAccPropList for those classes. The HDF5 C constant "H5P_DEFAULT"
+ can be replaced by any of these respectively: H5P_DATASET_CREATE,
+ H5P_DATASET_XFER, H5P_FILE_CREATE, and H5P_FILE_ACCESS.
- Old Method:
- ----------
- // Declaration of the constant - in "H5PropList.h"
- static const PropList DEFAULT;
+ Old Method:
+ ----------
+ // Declaration of the constant - in "H5PropList.h"
+ static const PropList DEFAULT;
- // Definition of the constant - in "H5PropList.cpp"
- const PropList PropList::DEFAULT(H5P_DEFAULT);
+ // Definition of the constant - in "H5PropList.cpp"
+ const PropList PropList::DEFAULT(H5P_DEFAULT);
- New Method:
- ----------
- // Declare pointer for a constant - in "H5PropList.h"
- static PropList* DEFAULT_; // "H5PropList.h"
+ New Method:
+ ----------
+ // Declare pointer for a constant - in "H5PropList.h"
+ static PropList* DEFAULT_; // "H5PropList.h"
- // Change previous constant to reference - in "H5PropList.h"
- static const PropList& DEFAULT;
+ // Change previous constant to reference - in "H5PropList.h"
+ static const PropList& DEFAULT;
- // Creates a dynamic PropList object representing the C constant
- // - in "H5PropList.cpp"
- DEFAULT_ = new PropList(H5P_DEFAULT);
+ // Creates a dynamic PropList object representing the C constant
+ // - in "H5PropList.cpp"
+ DEFAULT_ = new PropList(H5P_DEFAULT);
- // Assign the constant reference to the dynamic object
- // - in "H5PropList.cpp"
- const PropList& PropList::DEFAULT = *DEFAULT_;
+ // Assign the constant reference to the dynamic object
+ // - in "H5PropList.cpp"
+ const PropList& PropList::DEFAULT = *DEFAULT_;
- Functions added to class PropList:
+ Functions added to class PropList:
- // Creates the constant
- static PropList* getConstant(); // private
+ // Creates the constant
+ static PropList* getConstant(); // private
- // Deletes the constants
- static void deleteConstants(); // public
+ // Deletes the constants
+ static void deleteConstants(); // public
- The same functions are added to the subclasses of PropList instead of
- using PropList's because of the class types and in favor of clarity.
+ The same functions are added to the subclasses of PropList instead of
+ using PropList's because of the class types and in favor of clarity.
****************************************************************************/
diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h
index 750902e..a8d6e37 100644
--- a/c++/src/H5PredType.h
+++ b/c++/src/H5PredType.h
@@ -30,207 +30,207 @@ namespace H5 {
*/
class H5_DLLCPP PredType : public AtomType {
public:
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("PredType"); }
-
- // Makes a copy of the predefined type and stores the new
- // id in the left hand side object.
- PredType& operator=( const PredType& rhs );
-
- // Copy constructor - makes copy of the original object
- PredType( const PredType& original );
-
- // Noop destructor
- virtual ~PredType();
-
- /*! \brief This dummy function do not inherit from DataType - it will
- throw a DataTypeIException if invoked.
- */
- void commit(H5Location& loc, const H5std_string& name );
- /*! \brief This dummy function do not inherit from DataType - it will
- throw a DataTypeIException if invoked.
- */
- void commit(H5Location& loc, const char* name );
- /*! \brief This dummy function do not inherit from DataType - it will
- throw a DataTypeIException if invoked.
- */
- bool committed();
-
- ///\brief PredType constants
- static const PredType& STD_I8BE;
- static const PredType& STD_I8LE;
- static const PredType& STD_I16BE;
- static const PredType& STD_I16LE;
- static const PredType& STD_I32BE;
- static const PredType& STD_I32LE;
- static const PredType& STD_I64BE;
- static const PredType& STD_I64LE;
- static const PredType& STD_U8BE;
- static const PredType& STD_U8LE;
- static const PredType& STD_U16BE;
- static const PredType& STD_U16LE;
- static const PredType& STD_U32BE;
- static const PredType& STD_U32LE;
- static const PredType& STD_U64BE;
- static const PredType& STD_U64LE;
- static const PredType& STD_B8BE;
- static const PredType& STD_B8LE;
- static const PredType& STD_B16BE;
- static const PredType& STD_B16LE;
- static const PredType& STD_B32BE;
- static const PredType& STD_B32LE;
- static const PredType& STD_B64BE;
- static const PredType& STD_B64LE;
- static const PredType& STD_REF_OBJ;
- static const PredType& STD_REF_DSETREG;
-
- static const PredType& C_S1;
- static const PredType& FORTRAN_S1;
-
- static const PredType& IEEE_F32BE;
- static const PredType& IEEE_F32LE;
- static const PredType& IEEE_F64BE;
- static const PredType& IEEE_F64LE;
-
- static const PredType& UNIX_D32BE;
- static const PredType& UNIX_D32LE;
- static const PredType& UNIX_D64BE;
- static const PredType& UNIX_D64LE;
-
- static const PredType& INTEL_I8;
- static const PredType& INTEL_I16;
- static const PredType& INTEL_I32;
- static const PredType& INTEL_I64;
- static const PredType& INTEL_U8;
- static const PredType& INTEL_U16;
- static const PredType& INTEL_U32;
- static const PredType& INTEL_U64;
- static const PredType& INTEL_B8;
- static const PredType& INTEL_B16;
- static const PredType& INTEL_B32;
- static const PredType& INTEL_B64;
- static const PredType& INTEL_F32;
- static const PredType& INTEL_F64;
-
- static const PredType& ALPHA_I8;
- static const PredType& ALPHA_I16;
- static const PredType& ALPHA_I32;
- static const PredType& ALPHA_I64;
- static const PredType& ALPHA_U8;
- static const PredType& ALPHA_U16;
- static const PredType& ALPHA_U32;
- static const PredType& ALPHA_U64;
- static const PredType& ALPHA_B8;
- static const PredType& ALPHA_B16;
- static const PredType& ALPHA_B32;
- static const PredType& ALPHA_B64;
- static const PredType& ALPHA_F32;
- static const PredType& ALPHA_F64;
-
- static const PredType& MIPS_I8;
- static const PredType& MIPS_I16;
- static const PredType& MIPS_I32;
- static const PredType& MIPS_I64;
- static const PredType& MIPS_U8;
- static const PredType& MIPS_U16;
- static const PredType& MIPS_U32;
- static const PredType& MIPS_U64;
- static const PredType& MIPS_B8;
- static const PredType& MIPS_B16;
- static const PredType& MIPS_B32;
- static const PredType& MIPS_B64;
- static const PredType& MIPS_F32;
- static const PredType& MIPS_F64;
-
- static const PredType& NATIVE_CHAR;
- static const PredType& NATIVE_SCHAR;
- static const PredType& NATIVE_UCHAR;
- static const PredType& NATIVE_SHORT;
- static const PredType& NATIVE_USHORT;
- static const PredType& NATIVE_INT;
- static const PredType& NATIVE_UINT;
- static const PredType& NATIVE_LONG;
- static const PredType& NATIVE_ULONG;
- static const PredType& NATIVE_LLONG;
- static const PredType& NATIVE_ULLONG;
- static const PredType& NATIVE_FLOAT;
- static const PredType& NATIVE_DOUBLE;
- static const PredType& NATIVE_LDOUBLE;
- static const PredType& NATIVE_B8;
- static const PredType& NATIVE_B16;
- static const PredType& NATIVE_B32;
- static const PredType& NATIVE_B64;
- static const PredType& NATIVE_OPAQUE;
- static const PredType& NATIVE_HSIZE;
- static const PredType& NATIVE_HSSIZE;
- static const PredType& NATIVE_HERR;
- static const PredType& NATIVE_HBOOL;
-
- static const PredType& NATIVE_INT8;
- static const PredType& NATIVE_UINT8;
- static const PredType& NATIVE_INT16;
- static const PredType& NATIVE_UINT16;
- static const PredType& NATIVE_INT32;
- static const PredType& NATIVE_UINT32;
- static const PredType& NATIVE_INT64;
- static const PredType& NATIVE_UINT64;
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("PredType"); }
+
+ // Makes a copy of the predefined type and stores the new
+ // id in the left hand side object.
+ PredType& operator=(const PredType& rhs);
+
+ // Copy constructor - makes copy of the original object
+ PredType(const PredType& original);
+
+ // Noop destructor
+ virtual ~PredType();
+
+ /*! \brief This dummy function do not inherit from DataType - it will
+ throw a DataTypeIException if invoked.
+ */
+ void commit(H5Location& loc, const H5std_string& name);
+ /*! \brief This dummy function do not inherit from DataType - it will
+ throw a DataTypeIException if invoked.
+ */
+ void commit(H5Location& loc, const char* name);
+ /*! \brief This dummy function do not inherit from DataType - it will
+ throw a DataTypeIException if invoked.
+ */
+ bool committed();
+
+ ///\brief PredType constants
+ static const PredType& STD_I8BE;
+ static const PredType& STD_I8LE;
+ static const PredType& STD_I16BE;
+ static const PredType& STD_I16LE;
+ static const PredType& STD_I32BE;
+ static const PredType& STD_I32LE;
+ static const PredType& STD_I64BE;
+ static const PredType& STD_I64LE;
+ static const PredType& STD_U8BE;
+ static const PredType& STD_U8LE;
+ static const PredType& STD_U16BE;
+ static const PredType& STD_U16LE;
+ static const PredType& STD_U32BE;
+ static const PredType& STD_U32LE;
+ static const PredType& STD_U64BE;
+ static const PredType& STD_U64LE;
+ static const PredType& STD_B8BE;
+ static const PredType& STD_B8LE;
+ static const PredType& STD_B16BE;
+ static const PredType& STD_B16LE;
+ static const PredType& STD_B32BE;
+ static const PredType& STD_B32LE;
+ static const PredType& STD_B64BE;
+ static const PredType& STD_B64LE;
+ static const PredType& STD_REF_OBJ;
+ static const PredType& STD_REF_DSETREG;
+
+ static const PredType& C_S1;
+ static const PredType& FORTRAN_S1;
+
+ static const PredType& IEEE_F32BE;
+ static const PredType& IEEE_F32LE;
+ static const PredType& IEEE_F64BE;
+ static const PredType& IEEE_F64LE;
+
+ static const PredType& UNIX_D32BE;
+ static const PredType& UNIX_D32LE;
+ static const PredType& UNIX_D64BE;
+ static const PredType& UNIX_D64LE;
+
+ static const PredType& INTEL_I8;
+ static const PredType& INTEL_I16;
+ static const PredType& INTEL_I32;
+ static const PredType& INTEL_I64;
+ static const PredType& INTEL_U8;
+ static const PredType& INTEL_U16;
+ static const PredType& INTEL_U32;
+ static const PredType& INTEL_U64;
+ static const PredType& INTEL_B8;
+ static const PredType& INTEL_B16;
+ static const PredType& INTEL_B32;
+ static const PredType& INTEL_B64;
+ static const PredType& INTEL_F32;
+ static const PredType& INTEL_F64;
+
+ static const PredType& ALPHA_I8;
+ static const PredType& ALPHA_I16;
+ static const PredType& ALPHA_I32;
+ static const PredType& ALPHA_I64;
+ static const PredType& ALPHA_U8;
+ static const PredType& ALPHA_U16;
+ static const PredType& ALPHA_U32;
+ static const PredType& ALPHA_U64;
+ static const PredType& ALPHA_B8;
+ static const PredType& ALPHA_B16;
+ static const PredType& ALPHA_B32;
+ static const PredType& ALPHA_B64;
+ static const PredType& ALPHA_F32;
+ static const PredType& ALPHA_F64;
+
+ static const PredType& MIPS_I8;
+ static const PredType& MIPS_I16;
+ static const PredType& MIPS_I32;
+ static const PredType& MIPS_I64;
+ static const PredType& MIPS_U8;
+ static const PredType& MIPS_U16;
+ static const PredType& MIPS_U32;
+ static const PredType& MIPS_U64;
+ static const PredType& MIPS_B8;
+ static const PredType& MIPS_B16;
+ static const PredType& MIPS_B32;
+ static const PredType& MIPS_B64;
+ static const PredType& MIPS_F32;
+ static const PredType& MIPS_F64;
+
+ static const PredType& NATIVE_CHAR;
+ static const PredType& NATIVE_SCHAR;
+ static const PredType& NATIVE_UCHAR;
+ static const PredType& NATIVE_SHORT;
+ static const PredType& NATIVE_USHORT;
+ static const PredType& NATIVE_INT;
+ static const PredType& NATIVE_UINT;
+ static const PredType& NATIVE_LONG;
+ static const PredType& NATIVE_ULONG;
+ static const PredType& NATIVE_LLONG;
+ static const PredType& NATIVE_ULLONG;
+ static const PredType& NATIVE_FLOAT;
+ static const PredType& NATIVE_DOUBLE;
+ static const PredType& NATIVE_LDOUBLE;
+ static const PredType& NATIVE_B8;
+ static const PredType& NATIVE_B16;
+ static const PredType& NATIVE_B32;
+ static const PredType& NATIVE_B64;
+ static const PredType& NATIVE_OPAQUE;
+ static const PredType& NATIVE_HSIZE;
+ static const PredType& NATIVE_HSSIZE;
+ static const PredType& NATIVE_HERR;
+ static const PredType& NATIVE_HBOOL;
+
+ static const PredType& NATIVE_INT8;
+ static const PredType& NATIVE_UINT8;
+ static const PredType& NATIVE_INT16;
+ static const PredType& NATIVE_UINT16;
+ static const PredType& NATIVE_INT32;
+ static const PredType& NATIVE_UINT32;
+ static const PredType& NATIVE_INT64;
+ static const PredType& NATIVE_UINT64;
// LEAST types
#if H5_SIZEOF_INT_LEAST8_T != 0
- static const PredType& NATIVE_INT_LEAST8;
+ static const PredType& NATIVE_INT_LEAST8;
#endif /* H5_SIZEOF_INT_LEAST8_T */
#if H5_SIZEOF_UINT_LEAST8_T != 0
- static const PredType& NATIVE_UINT_LEAST8;
+ static const PredType& NATIVE_UINT_LEAST8;
#endif /* H5_SIZEOF_UINT_LEAST8_T */
#if H5_SIZEOF_INT_LEAST16_T != 0
- static const PredType& NATIVE_INT_LEAST16;
+ static const PredType& NATIVE_INT_LEAST16;
#endif /* H5_SIZEOF_INT_LEAST16_T */
#if H5_SIZEOF_UINT_LEAST16_T != 0
- static const PredType& NATIVE_UINT_LEAST16;
+ static const PredType& NATIVE_UINT_LEAST16;
#endif /* H5_SIZEOF_UINT_LEAST16_T */
#if H5_SIZEOF_INT_LEAST32_T != 0
- static const PredType& NATIVE_INT_LEAST32;
+ static const PredType& NATIVE_INT_LEAST32;
#endif /* H5_SIZEOF_INT_LEAST32_T */
#if H5_SIZEOF_UINT_LEAST32_T != 0
- static const PredType& NATIVE_UINT_LEAST32;
+ static const PredType& NATIVE_UINT_LEAST32;
#endif /* H5_SIZEOF_UINT_LEAST32_T */
#if H5_SIZEOF_INT_LEAST64_T != 0
- static const PredType& NATIVE_INT_LEAST64;
+ static const PredType& NATIVE_INT_LEAST64;
#endif /* H5_SIZEOF_INT_LEAST64_T */
#if H5_SIZEOF_UINT_LEAST64_T != 0
- static const PredType& NATIVE_UINT_LEAST64;
+ static const PredType& NATIVE_UINT_LEAST64;
#endif /* H5_SIZEOF_UINT_LEAST64_T */
// FAST types
#if H5_SIZEOF_INT_FAST8_T != 0
- static const PredType& NATIVE_INT_FAST8;
+ static const PredType& NATIVE_INT_FAST8;
#endif /* H5_SIZEOF_INT_FAST8_T */
#if H5_SIZEOF_UINT_FAST8_T != 0
- static const PredType& NATIVE_UINT_FAST8;
+ static const PredType& NATIVE_UINT_FAST8;
#endif /* H5_SIZEOF_UINT_FAST8_T */
#if H5_SIZEOF_INT_FAST16_T != 0
- static const PredType& NATIVE_INT_FAST16;
+ static const PredType& NATIVE_INT_FAST16;
#endif /* H5_SIZEOF_INT_FAST16_T */
#if H5_SIZEOF_UINT_FAST16_T != 0
- static const PredType& NATIVE_UINT_FAST16;
+ static const PredType& NATIVE_UINT_FAST16;
#endif /* H5_SIZEOF_UINT_FAST16_T */
#if H5_SIZEOF_INT_FAST32_T != 0
- static const PredType& NATIVE_INT_FAST32;
+ static const PredType& NATIVE_INT_FAST32;
#endif /* H5_SIZEOF_INT_FAST32_T */
#if H5_SIZEOF_UINT_FAST32_T != 0
- static const PredType& NATIVE_UINT_FAST32;
+ static const PredType& NATIVE_UINT_FAST32;
#endif /* H5_SIZEOF_UINT_FAST32_T */
#if H5_SIZEOF_INT_FAST64_T != 0
- static const PredType& NATIVE_INT_FAST64;
+ static const PredType& NATIVE_INT_FAST64;
#endif /* H5_SIZEOF_INT_FAST64_T */
#if H5_SIZEOF_UINT_FAST64_T != 0
- static const PredType& NATIVE_UINT_FAST64;
+ static const PredType& NATIVE_UINT_FAST64;
#endif /* H5_SIZEOF_UINT_FAST64_T */
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -242,11 +242,11 @@ class H5_DLLCPP PredType : public AtomType {
static const PredType& PREDTYPE_CONST; // dummy constant
protected:
- // Default constructor
- PredType();
+ // Default constructor
+ PredType();
- // Creates a pre-defined type using an HDF5 pre-defined constant
- PredType( const hid_t predtype_id ); // used by the library only
+ // Creates a pre-defined type using an HDF5 pre-defined constant
+ PredType(const hid_t predtype_id); // used by the library only
private:
// Activates the creation of the PredType global constants
diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp
index 1564a93..c4176c2 100644
--- a/c++/src/H5PropList.cpp
+++ b/c++/src/H5PropList.cpp
@@ -21,7 +21,7 @@
#include <string>
-#include "H5private.h" // for HDmemset
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -42,7 +42,7 @@ PropList* PropList::DEFAULT_ = 0;
//--------------------------------------------------------------------------
// Function: PropList::getConstant
-// Purpose: Creates a PropList object representing the HDF5 constant
+// Purpose Creates a PropList object representing the HDF5 constant
// H5P_DEFAULT, pointed to by PropList::DEFAULT_.
// Exception H5::PropListIException
// Description
@@ -71,7 +71,7 @@ PropList* PropList::getConstant()
//--------------------------------------------------------------------------
// Function: PropList::deleteConstants
-// Purpose: Deletes the constant object that PropList::DEFAULT_ points to.
+// Purpose Deletes the constant object that PropList::DEFAULT_ points to.
// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
void PropList::deleteConstants()
@@ -81,24 +81,24 @@ void PropList::deleteConstants()
}
//--------------------------------------------------------------------------
-// Purpose Constant for default property.
+// Purpose Constant for default property.
//--------------------------------------------------------------------------
const PropList& PropList::DEFAULT = *getConstant();
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function Default constructor
-///\brief Default constructor: creates a stub property list object.
-// Programmer Binh-Minh Ribler - 2000
+// Function: Default constructor
+///\brief Default constructor: creates a stub property list object.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
PropList::PropList() : IdComponent(), id(H5P_DEFAULT) {}
//--------------------------------------------------------------------------
-// Function: PropList copy constructor
-///\brief Copy constructor
-///\param original - IN: The original property list to copy
-// Programmer Binh-Minh Ribler - 2000
+// Function: PropList copy constructor
+///\brief Copy constructor
+///\param original - IN: The original property list to copy
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
PropList::PropList(const PropList& original) : IdComponent(), id(original.id)
{
@@ -106,166 +106,166 @@ PropList::PropList(const PropList& original) : IdComponent(), id(original.id)
}
//--------------------------------------------------------------------------
-// Function: PropList overloaded constructor
-///\brief Creates a property list using the id of an existing property.
-///\param plist_id - IN: Id of the existing property list
-///\exception H5::PropListIException
+// Function: PropList overloaded constructor
+///\brief Creates a property list using the id of an existing property.
+///\param plist_id - IN: Id of the existing property list
+///\exception H5::PropListIException
// Description
-// This function creates a new property list if a property
-// class is provided or makes a copy of a property list if one
-// is given. If the given id is anything else, then set this
-// property's id to H5P_DEFAULT.
-// Programmer Binh-Minh Ribler - 2000
+// This function creates a new property list if a property
+// class is provided or makes a copy of a property list if one
+// is given. If the given id is anything else, then set this
+// property's id to H5P_DEFAULT.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PropList::PropList( const hid_t plist_id ) : IdComponent()
+PropList::PropList(const hid_t plist_id) : IdComponent()
{
if (plist_id <= 0)
- id = H5P_DEFAULT;
+ id = H5P_DEFAULT;
H5I_type_t id_type = H5Iget_type(plist_id);
switch (id_type) {
- case H5I_GENPROP_CLS:
- // call C routine to create a new property from the given prop class
- id = H5Pcreate(plist_id);
- if( id < 0 )
- {
- throw PropListIException("PropList constructor", "H5Pcreate failed");
- }
- break;
- case H5I_GENPROP_LST:
- // call C routine to make a copy of the given property list
- id = H5Pcopy(plist_id);
- if( id < 0 )
- {
- throw PropListIException("PropList constructor", "H5Pcopy failed");
- }
- break;
- default:
- id = H5P_DEFAULT;
- break;
+ case H5I_GENPROP_CLS:
+ // call C routine to create a new property from the given prop class
+ id = H5Pcreate(plist_id);
+ if (id < 0)
+ {
+ throw PropListIException("PropList constructor", "H5Pcreate failed");
+ }
+ break;
+ case H5I_GENPROP_LST:
+ // call C routine to make a copy of the given property list
+ id = H5Pcopy(plist_id);
+ if (id < 0)
+ {
+ throw PropListIException("PropList constructor", "H5Pcopy failed");
+ }
+ break;
+ default:
+ id = H5P_DEFAULT;
+ break;
}
}
//--------------------------------------------------------------------------
-// Function: PropList::copy
-///\brief Makes a copy of an existing property list.
-///\param like_plist - IN: Reference to the existing property list
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: PropList::copy
+///\brief Makes a copy of an existing property list.
+///\param like_plist - IN: Reference to the existing property list
+///\exception H5::PropListIException
+// 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
//--------------------------------------------------------------------------
-void PropList::copy( const PropList& like_plist )
+void PropList::copy(const PropList& like_plist)
{
// If this object is representing an hdf5 object, close it before
// copying like_plist to it
try {
- close();
+ close();
}
catch (Exception& close_error) {
- throw PropListIException(inMemFunc("copy"), close_error.getDetailMsg());
+ throw PropListIException(inMemFunc("copy"), close_error.getDetailMsg());
}
// call C routine to copy the property list
- id = H5Pcopy( like_plist.getId() );
- if( id < 0 )
- throw PropListIException(inMemFunc("copy"), "H5Pcopy failed");
+ id = H5Pcopy(like_plist.getId());
+ if (id < 0)
+ throw PropListIException(inMemFunc("copy"), "H5Pcopy failed");
}
//--------------------------------------------------------------------------
-// Function: PropList::operator=
-///\brief Assignment operator.
-///\param rhs - IN: Reference to the existing property list
-///\return Reference to PropList instance
-///\exception H5::PropListIException
+// Function: PropList::operator=
+///\brief Assignment operator.
+///\param rhs - IN: Reference to the existing property list
+///\return Reference to PropList instance
+///\exception H5::PropListIException
// Description
-// Makes a copy of the property list on the right hand side
-// and stores the new id in the left hand side object.
-// Programmer Binh-Minh Ribler - 2000
+// Makes a copy of the property list on the right hand side
+// and stores the new id in the left hand side object.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PropList& PropList::operator=( const PropList& rhs )
+PropList& PropList::operator=(const PropList& rhs)
{
if (this != &rhs)
- copy(rhs);
+ copy(rhs);
return(*this);
}
//--------------------------------------------------------------------------
-// Function: PropList::copyProp
-///\brief Copies a property from this property list or class to another
-///\param dest - IN: Destination property list or class
-///\param name - IN: Name of the property to copy - \c char pointer
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - Jul, 2005
+// Function: PropList::copyProp
+///\brief Copies a property from this property list or class to another
+///\param dest - IN: Destination property list or class
+///\param name - IN: Name of the property to copy - \c char pointer
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
void PropList::copyProp(PropList& dest, const char *name) const
{
- hid_t dst_id = dest.getId();
- herr_t ret_value = H5Pcopy_prop(dst_id, id, name);
- if( ret_value < 0 )
- {
- throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed");
- }
+ hid_t dst_id = dest.getId();
+ herr_t ret_value = H5Pcopy_prop(dst_id, id, name);
+ if (ret_value < 0)
+ {
+ throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: PropList::copyProp
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in what arguments it
-/// accepts.
-///\param dest - IN: Destination property list or class
-///\param name - IN: Name of the property to copy - \c H5std_string
-// Programmer Binh-Minh Ribler - Jul, 2005
+// Function: PropList::copyProp
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts.
+///\param dest - IN: Destination property list or class
+///\param name - IN: Name of the property to copy - \c H5std_string
+// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
-void PropList::copyProp( PropList& dest, const H5std_string& name ) const
+void PropList::copyProp(PropList& dest, const H5std_string& name) const
{
- copyProp( dest, name.c_str());
+ copyProp(dest, name.c_str());
}
//--------------------------------------------------------------------------
-// Function: PropList::copyProp
-///\brief Copies a property from one list or class to another - Obsolete
-///\param dest - IN: Destination property list or class
-///\param src - IN: Source property list or class
-///\param name - IN: Name of the property to copy - \c char pointer
-///\note This member function will be removed in the next release
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: PropList::copyProp
+///\brief Copies a property from one list or class to another - Obsolete
+///\param dest - IN: Destination property list or class
+///\param src - IN: Source property list or class
+///\param name - IN: Name of the property to copy - \c char pointer
+///\note This member function will be removed in the next release
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void PropList::copyProp( PropList& dest, PropList& src, const char *name ) const
+void PropList::copyProp(PropList& dest, PropList& src, const char *name) const
{
- hid_t dst_id = dest.getId();
- hid_t src_id = src.getId();
- herr_t ret_value = H5Pcopy_prop(dst_id, src_id, name);
- if( ret_value < 0 )
- {
- throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed");
- }
+ hid_t dst_id = dest.getId();
+ hid_t src_id = src.getId();
+ herr_t ret_value = H5Pcopy_prop(dst_id, src_id, name);
+ if (ret_value < 0)
+ {
+ throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: PropList::copyProp
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in what arguments it
-/// accepts. - Obsolete
-///\param dest - IN: Destination property list or class
-///\param src - IN: Source property list or class
-///\param name - IN: Name of the property to copy - \c H5std_string
-// Programmer Binh-Minh Ribler - 2000
+// Function: PropList::copyProp
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts. - Obsolete
+///\param dest - IN: Destination property list or class
+///\param src - IN: Source property list or class
+///\param name - IN: Name of the property to copy - \c H5std_string
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void PropList::copyProp( PropList& dest, PropList& src, const H5std_string& name ) const
+void PropList::copyProp(PropList& dest, PropList& src, const H5std_string& name) const
{
- copyProp( dest, src, name.c_str());
+ copyProp(dest, src, name.c_str());
}
//--------------------------------------------------------------------------
// Function: PropList::getId
-///\brief Get the id of this property list
-///\return Property list identifier
+///\brief Get the id of this property list
+///\return Property list identifier
// Description:
// Class hierarchy is revised to address bugzilla 1068. Class
// AbstractDS and Attribute are moved out of H5Object. In
@@ -275,7 +275,7 @@ void PropList::copyProp( PropList& dest, PropList& src, const H5std_string& name
//--------------------------------------------------------------------------
hid_t PropList::getId() const
{
- return(id);
+ return(id);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -307,444 +307,441 @@ void PropList::p_setId(const hid_t new_id)
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: PropList::close
-///\brief Closes the property list if it is not a default one.
+// Function: PropList::close
+///\brief Closes the property list if it is not a default one.
///
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - Mar 9, 2005
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
void PropList::close()
{
if (p_valid_id(id))
{
- herr_t ret_value = H5Pclose( id );
- if( ret_value < 0 )
- {
- throw PropListIException(inMemFunc("close"), "H5Pclose failed");
- }
- // reset the id
- id = H5I_INVALID_HID;
+ herr_t ret_value = H5Pclose(id);
+ if (ret_value < 0)
+ {
+ throw PropListIException(inMemFunc("close"), "H5Pclose failed");
+ }
+ // reset the id
+ id = H5I_INVALID_HID;
}
}
//--------------------------------------------------------------------------
-// Function: PropList::getClass
-///\brief Returns the class of this property list, i.e. \c H5P_FILE_CREATE...
-///\return The property list class if it is not equal to \c H5P_ROOT
-///\exception H5::PropListIException
-// Programmer Binh-Minh Ribler - April, 2004
+// Function: PropList::getClass
+///\brief Returns the class of this property list, i.e. \c H5P_FILE_CREATE...
+///\return The property list class if it is not equal to \c H5P_ROOT
+///\exception H5::PropListIException
+// Programmer Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
hid_t PropList::getClass() const
{
- hid_t plist_class = H5Pget_class( id );
- if( plist_class == H5P_ROOT )
- {
- throw PropListIException(inMemFunc("getClass"),
- "H5Pget_class failed - returned H5P_ROOT");
- }
- return( plist_class );
+ hid_t plist_class = H5Pget_class(id);
+ if (plist_class == H5P_ROOT)
+ {
+ throw PropListIException(inMemFunc("getClass"),
+ "H5Pget_class failed - returned H5P_ROOT");
+ }
+ return(plist_class);
}
//--------------------------------------------------------------------------
-// Function: PropList::propExist
-///\brief Queries the existence of a property in a property object.
-///\param name - IN: Name of property to check for - \c char pointer
-///\return true if the property exists in the property object, and
-/// false, otherwise.
-///\exception H5::PropListIException
+// Function: PropList::propExist
+///\brief Queries the existence of a property in a property object.
+///\param name - IN: Name of property to check for - \c char pointer
+///\return true if the property exists in the property object, and
+/// false, otherwise.
+///\exception H5::PropListIException
///\par Description
-/// This routine checks if a property exists within a property
-/// list or class.
+/// This routine checks if a property exists within a property
+/// list or class.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-bool PropList::propExist(const char* name ) const
-{
- // Calls C routine H5Pexist to determine whether a property exists
- // within a property list or class. It returns a positive value, 0,
- // or a negative value
- htri_t ret_value = H5Pexist(id, name);
- if( ret_value > 0 )
- return true;
- else if( ret_value == 0 )
- return false;
- else // Raise exception when H5Pexist returns a negative value
- {
- throw PropListIException(inMemFunc("propExist"), "H5Pexist failed");
- }
-}
-//--------------------------------------------------------------------------
-// Function: PropList::propExist
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in what arguments it
-/// accepts.
-///\param name - IN: Name of property to check for - \c H5std_string
+bool PropList::propExist(const char* name) const
+{
+ // Calls C routine H5Pexist to determine whether a property exists
+ // within a property list or class. It returns a positive value, 0,
+ // or a negative value
+ htri_t ret_value = H5Pexist(id, name);
+ if (ret_value > 0)
+ return true;
+ else if (ret_value == 0)
+ return false;
+ else // Raise exception when H5Pexist returns a negative value
+ {
+ throw PropListIException(inMemFunc("propExist"), "H5Pexist failed");
+ }
+}
+//--------------------------------------------------------------------------
+// Function: PropList::propExist
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts.
+///\param name - IN: Name of property to check for - \c H5std_string
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
-bool PropList::propExist(const H5std_string& name ) const
+bool PropList::propExist(const H5std_string& name) const
{
- return( propExist( name.c_str()) );
+ return(propExist( name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: PropList::closeClass
-///\brief Close a property list class.
+// Function: PropList::closeClass
+///\brief Close a property list class.
///
-///\exception H5::PropListIException
+///\exception H5::PropListIException
///\par Description
-/// Releases memory and detaches a class from the property
-/// list class hierarchy.
+/// Releases memory and detaches a class from the property
+/// list class hierarchy.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void PropList::closeClass() const
{
- herr_t ret_value = H5Pclose_class(id);
- if( ret_value < 0 )
- {
- throw PropListIException(inMemFunc("closeClass"), "H5Pclose_class failed");
- }
+ herr_t ret_value = H5Pclose_class(id);
+ if (ret_value < 0)
+ {
+ throw PropListIException(inMemFunc("closeClass"), "H5Pclose_class failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: PropList::getProperty
-///\brief Query the value of a property in a property list.
-///\param name - IN: Name of property to query - \c char pointer
-///\param value - OUT: Pointer to the buffer for the property value
-///\exception H5::PropListIException
+// Function: PropList::getProperty
+///\brief Query the value of a property in a property list.
+///\param name - IN: Name of property to query - \c char pointer
+///\param value - OUT: Pointer to the buffer for the property value
+///\exception H5::PropListIException
///\par Description
-/// Retrieves a copy of the value for a property in a property
-/// list. The property name must exist or this routine will
-/// throw an exception.
+/// Retrieves a copy of the value for a property in a property
+/// list. The property name must exist or this routine will
+/// throw an exception.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void PropList::getProperty(const char* name, void* value) const
{
- herr_t ret_value = H5Pget(id, name, value);
- if (ret_value < 0)
- {
- throw PropListIException(inMemFunc("getProperty"), "H5Pget failed");
- }
+ herr_t ret_value = H5Pget(id, name, value);
+ if (ret_value < 0)
+ {
+ throw PropListIException(inMemFunc("getProperty"), "H5Pget failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: PropList::getProperty
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in what arguments it
-/// accepts.
-///\param name - IN: Name of property to query - \c char pointer
-///\return The property that is a \c H5std_string.
-///\exception H5::PropListIException
+// Function: PropList::getProperty
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts.
+///\param name - IN: Name of property to query - \c char pointer
+///\return The property that is a \c H5std_string.
+///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
H5std_string PropList::getProperty(const char* name) const
{
- // Get property size first
- size_t size = getPropSize(name);
+ // Get property size first
+ size_t size = getPropSize(name);
- // Allocate buffer then get the property
- char* prop_strg_C = new char[size+1]; // temporary C-string for C API
- HDmemset(prop_strg_C, 0, size+1); // clear buffer
+ // Allocate buffer then get the property
+ char* prop_strg_C = new char[size+1]; // temporary C-string for C API
+ HDmemset(prop_strg_C, 0, size+1); // clear buffer
- herr_t ret_value = H5Pget(id, name, prop_strg_C); // call C API
+ herr_t ret_value = H5Pget(id, name, prop_strg_C); // call C API
- // Throw exception if H5Pget returns failure
- if (ret_value < 0)
- {
+ // Throw exception if H5Pget returns failure
+ if (ret_value < 0)
+ {
delete []prop_strg_C;
- throw PropListIException(inMemFunc("getProperty"), "H5Pget failed");
- }
+ throw PropListIException(inMemFunc("getProperty"), "H5Pget failed");
+ }
- // Return propety value as a string after deleting temp C-string
- H5std_string prop_strg(prop_strg_C);
- delete []prop_strg_C;
- return (prop_strg);
+ // Return propety value as a string after deleting temp C-string
+ H5std_string prop_strg(prop_strg_C);
+ delete []prop_strg_C;
+ return (prop_strg);
}
//--------------------------------------------------------------------------
-// Function: PropList::getProperty
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in what arguments it
-/// accepts.
-///\param name - IN: Name of property to query - \c H5std_string
-///\param value - OUT: Pointer to the buffer for the property value
+// Function: PropList::getProperty
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts.
+///\param name - IN: Name of property to query - \c H5std_string
+///\param value - OUT: Pointer to the buffer for the property value
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void PropList::getProperty(const H5std_string& name, void* value) const
{
- getProperty(name.c_str(), value);
+ getProperty(name.c_str(), value);
}
//--------------------------------------------------------------------------
-// Function: PropList::getProperty
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in what arguments it
-/// accepts.
-///\param name - IN: Name of property to query - \c H5std_string
-///\return The property that is a \c H5std_string.
+// Function: PropList::getProperty
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts.
+///\param name - IN: Name of property to query - \c H5std_string
+///\return The property that is a \c H5std_string.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
H5std_string PropList::getProperty(const H5std_string& name) const
{
- return (getProperty(name.c_str()));
+ return (getProperty(name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: PropList::getPropSize
-///\brief Query the size of a property in a property list or class.
-///\param name - IN: Name of property to query
-///\return Size of the property
-///\exception H5::PropListIException
+// Function: PropList::getPropSize
+///\brief Query the size of a property in a property list or class.
+///\param name - IN: Name of property to query
+///\return Size of the property
+///\exception H5::PropListIException
///\par Description
-/// This routine retrieves the size of a property's value
-/// in bytes. Zero-sized properties are allowed and the return
-/// value will be of 0. This function works for both property
-/// lists and classes.
+/// This routine retrieves the size of a property's value
+/// in bytes. Zero-sized properties are allowed and the return
+/// value will be of 0. This function works for both property
+/// lists and classes.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
size_t PropList::getPropSize(const char *name) const
{
- size_t prop_size;
- herr_t ret_value = H5Pget_size(id, name, &prop_size);
- if (ret_value < 0)
- {
- throw PropListIException(inMemFunc("getPropSize"), "H5Pget_size failed");
- }
- return(prop_size);
+ size_t prop_size;
+ herr_t ret_value = H5Pget_size(id, name, &prop_size);
+ if (ret_value < 0)
+ {
+ throw PropListIException(inMemFunc("getPropSize"), "H5Pget_size failed");
+ }
+ return(prop_size);
}
//--------------------------------------------------------------------------
-// Function: PropList::getPropSize
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in what arguments it
-/// accepts.
-///\param name - IN: Name of property to query - \c H5std_string
+// Function: PropList::getPropSize
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts.
+///\param name - IN: Name of property to query - \c H5std_string
///
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
size_t PropList::getPropSize(const H5std_string& name) const
{
- return (getPropSize(name.c_str()));
+ return (getPropSize(name.c_str()));
}
//--------------------------------------------------------------------------
-// Function: PropList::getClassName
-///\brief Return the name of a generic property list class.
-///\return A string containing the class name, if success, otherwise,
-/// a NULL string.
+// Function: PropList::getClassName
+///\brief Return the name of a generic property list class.
+///\return A string containing the class name, if success, otherwise,
+/// a NULL string.
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
H5std_string PropList::getClassName() const
{
- char* temp_str;
- temp_str = H5Pget_class_name(id); // this API specified that temp_str must
- // be freed.
-
- if (temp_str != NULL)
- {
- H5std_string class_name(temp_str);
- H5free_memory(temp_str);
- return(class_name);
- }
- else
- return 0;
+ char* temp_str;
+ temp_str = H5Pget_class_name(id);
+ if (temp_str != NULL)
+ {
+ H5std_string class_name(temp_str);
+ H5free_memory(temp_str);
+ return(class_name);
+ }
+ else
+ return 0;
}
//--------------------------------------------------------------------------
-// Function: PropList::getNumProps
-///\brief Returns the number of properties in this property list or class.
-///\return Size of the property.
-///\exception H5::PropListIException
+// Function: PropList::getNumProps
+///\brief Returns the number of properties in this property list or class.
+///\return Size of the property.
+///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
size_t PropList::getNumProps() const
{
- size_t nprops;
- herr_t ret_value = H5Pget_nprops (id, &nprops);
- if (ret_value < 0)
- {
- throw PropListIException(inMemFunc("getNumProps"), "H5Pget_nprops failed");
- }
- return (nprops);
+ size_t nprops;
+ herr_t ret_value = H5Pget_nprops (id, &nprops);
+ if (ret_value < 0)
+ {
+ throw PropListIException(inMemFunc("getNumProps"), "H5Pget_nprops failed");
+ }
+ return (nprops);
}
//--------------------------------------------------------------------------
-// Function: PropList::setProperty
-///\brief Set a property's value in a property list.
-///\param name - IN: Name of property to set - \c char pointer
-///\param value - IN: Void pointer to the value for the property
-///\exception H5::PropListIException
+// Function: PropList::setProperty
+///\brief Set a property's value in a property list.
+///\param name - IN: Name of property to set - \c char pointer
+///\param value - IN: Void pointer to the value for the property
+///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void PropList::setProperty(const char* name, void* value) const
{
- herr_t ret_value = H5Pset(id, name, value);
- if (ret_value < 0)
- {
- throw PropListIException(inMemFunc("setProperty"), "H5Pset failed");
- }
+ herr_t ret_value = H5Pset(id, name, value);
+ if (ret_value < 0)
+ {
+ throw PropListIException(inMemFunc("setProperty"), "H5Pset failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: PropList::setProperty
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in what arguments it
-/// accepts.
-///\param name - IN: Name of property to set - \c char pointer
-///\param charptr - IN: Char pointer to the value for the property
+// Function: PropList::setProperty
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts.
+///\param name - IN: Name of property to set - \c char pointer
+///\param charptr - IN: Char pointer to the value for the property
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void PropList::setProperty(const char* name, const char* charptr) const
{
- herr_t ret_value = H5Pset(id, name, (void*)charptr);
- if (ret_value < 0)
- {
- throw PropListIException(inMemFunc("setProperty"), "H5Pset failed");
- }
+ herr_t ret_value = H5Pset(id, name, (void*)charptr);
+ if (ret_value < 0)
+ {
+ throw PropListIException(inMemFunc("setProperty"), "H5Pset failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: PropList::setProperty
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in what arguments it
-/// accepts.
-///\param name - IN: Name of property to set - \c char pointer
-///\param strg - IN: Value for the property is a \c H5std_string
+// Function: PropList::setProperty
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts.
+///\param name - IN: Name of property to set - \c char pointer
+///\param strg - IN: Value for the property is a \c H5std_string
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void PropList::setProperty(const char* name, H5std_string& strg) const
{
- setProperty(name, strg.c_str());
+ setProperty(name, strg.c_str());
}
//--------------------------------------------------------------------------
-// Function: PropList::setProperty
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in what arguments it
-/// accepts.
-///\param name - IN: Name of property to set - \c H5std_string
-///\param value - IN: Void pointer to the value for the property
+// Function: PropList::setProperty
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts.
+///\param name - IN: Name of property to set - \c H5std_string
+///\param value - IN: Void pointer to the value for the property
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void PropList::setProperty(const H5std_string& name, void* value) const
{
- setProperty(name.c_str(), value);
+ setProperty(name.c_str(), value);
}
//--------------------------------------------------------------------------
-// Function: PropList::setProperty
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in what arguments it
-/// accepts.
-///\param name - IN: Name of property to set - \c H5std_string
-///\param strg - IN: Value for the property is a \c H5std_string
+// Function: PropList::setProperty
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts.
+///\param name - IN: Name of property to set - \c H5std_string
+///\param strg - IN: Value for the property is a \c H5std_string
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void PropList::setProperty(const H5std_string& name, H5std_string& strg) const
{
- setProperty(name.c_str(), strg.c_str());
+ setProperty(name.c_str(), strg.c_str());
}
//--------------------------------------------------------------------------
-// Function: PropList::isAClass
-///\brief Determines whether a property list is a certain class.
-///\param prop_class - IN: Property class to query
-///\return true if the property list is a member of the property list
-/// class, and false, otherwise.
-///\exception H5::PropListIException
+// Function: PropList::isAClass
+///\brief Determines whether a property list is a certain class.
+///\param prop_class - IN: Property class to query
+///\return true if the property list is a member of the property list
+/// class, and false, otherwise.
+///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
bool PropList::isAClass(const PropList& prop_class) const
{
- htri_t ret_value = H5Pisa_class(id, prop_class.getId());
- if( ret_value > 0 )
- return true;
- else if( ret_value == 0 )
- return false;
- else // Raise exception when H5Pisa_class returns a negative value
- {
- throw PropListIException(inMemFunc("isAClass"), "H5Pisa_class failed");
- }
-
+ htri_t ret_value = H5Pisa_class(id, prop_class.getId());
+ if (ret_value > 0)
+ return true;
+ else if (ret_value == 0)
+ return false;
+ else // Raise exception when H5Pisa_class returns a negative value
+ {
+ throw PropListIException(inMemFunc("isAClass"), "H5Pisa_class failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: PropList::removeProp
-///\brief Removes a property from a property list.
-///\param name - IN: Name of property to remove - \c char pointer
-///\exception H5::PropListIException
+// Function: PropList::removeProp
+///\brief Removes a property from a property list.
+///\param name - IN: Name of property to remove - \c char pointer
+///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void PropList::removeProp(const char *name) const
{
- herr_t ret_value = H5Premove(id, name);
- if (ret_value < 0)
- {
- throw PropListIException(inMemFunc("removeProp"), "H5Premove failed");
- }
+ herr_t ret_value = H5Premove(id, name);
+ if (ret_value < 0)
+ {
+ throw PropListIException(inMemFunc("removeProp"), "H5Premove failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: PropList::removeProp
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function only in what arguments it
-/// accepts.
-///\param name - IN: Name of property to remove - \c H5std_string
+// Function: PropList::removeProp
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function only in what arguments it
+/// accepts.
+///\param name - IN: Name of property to remove - \c H5std_string
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void PropList::removeProp(const H5std_string& name) const
{
- removeProp(name.c_str());
+ removeProp(name.c_str());
}
//--------------------------------------------------------------------------
-// Function: PropList::operator==
-///\brief Compares this property list or class against the given list or class.
-///\param rhs - IN: Reference to the property list to compare
-///\return true if the property lists or classes are equal, and
-/// false, otherwise.
-///\exception H5::PropListIException
+// Function: PropList::operator==
+///\brief Compares this property list or class against the given list or class.
+///\param rhs - IN: Reference to the property list to compare
+///\return true if the property lists or classes are equal, and
+/// false, otherwise.
+///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
bool PropList::operator==(const PropList& rhs) const
{
- htri_t ret_value = H5Pequal(id, rhs.getId());
- if( ret_value > 0 )
- return true;
- else if( ret_value == 0 )
- return false;
- else // Raise exception when H5Pequal returns a negative value
- {
- throw PropListIException(inMemFunc("operator=="), "H5Pequal failed");
- }
+ htri_t ret_value = H5Pequal(id, rhs.getId());
+ if (ret_value > 0)
+ return true;
+ else if (ret_value == 0)
+ return false;
+ else // Raise exception when H5Pequal returns a negative value
+ {
+ throw PropListIException(inMemFunc("operator=="), "H5Pequal failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: PropList::getClassParent
-///\brief Returns the parent class of a generic property class
-///\return The parent class of a property class
-///\exception H5::PropListIException
+// Function: PropList::getClassParent
+///\brief Returns the parent class of a generic property class
+///\return The parent class of a property class
+///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
PropList PropList::getClassParent() const
{
- hid_t class_id = H5Pget_class_parent(id);
- if (class_id < 0)
- {
- throw PropListIException(inMemFunc("getClassParent"), "H5Pget_class_parent failed");
- }
- PropList pclass(class_id);
- return(pclass);
+ hid_t class_id = H5Pget_class_parent(id);
+ if (class_id < 0)
+ {
+ throw PropListIException(inMemFunc("getClassParent"), "H5Pget_class_parent failed");
+ }
+ PropList pclass(class_id);
+ return(pclass);
}
//--------------------------------------------------------------------------
-// Function: PropList destructor
-///\brief Properly terminates access to this property list.
-// Programmer Binh-Minh Ribler - 2000
+// Function: PropList destructor
+///\brief Properly terminates access to this property list.
+// 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
//--------------------------------------------------------------------------
PropList::~PropList()
{
try {
- close();
+ close();
}
catch (Exception& close_error) {
- cerr << "PropList::~PropList - " << close_error.getDetailMsg() << endl;
+ cerr << "PropList::~PropList - " << close_error.getDetailMsg() << endl;
}
}
diff --git a/c++/src/H5PropList.h b/c++/src/H5PropList.h
index faaf68d..3977774 100644
--- a/c++/src/H5PropList.h
+++ b/c++/src/H5PropList.h
@@ -28,111 +28,111 @@ namespace H5 {
*/
class H5_DLLCPP PropList : public IdComponent {
public:
- ///\brief Default property list
+ ///\brief Default property list
static const PropList& DEFAULT;
- // Creates a property list of a given type or creates a copy of an
- // existing property list giving the property list id.
- PropList(const hid_t plist_id);
+ // Creates a property list of a given type or creates a copy of an
+ // existing property list giving the property list id.
+ PropList(const hid_t plist_id);
- // Make a copy of the given property list using assignment statement
- PropList& operator=( const PropList& rhs );
+ // Make a copy of the given property list using assignment statement
+ PropList& operator=(const PropList& rhs);
- // Compares this property list or class against the given list or class.
- bool operator==(const PropList& rhs) const;
+ // Compares this property list or class against the given list or class.
+ bool operator==(const PropList& rhs) const;
- // Close this property list.
- virtual void close();
+ // Close this property list.
+ virtual void close();
- // Close a property list class.
- void closeClass() const;
+ // Close a property list class.
+ void closeClass() const;
- // Makes a copy of the given property list.
- void copy( const PropList& like_plist );
+ // Makes a copy of the given property list.
+ void copy(const PropList& like_plist);
- // Copies a property from this property list or class to another
- void copyProp( PropList& dest, const char* name) const;
- void copyProp( PropList& dest, const H5std_string& name) const;
+ // Copies a property from this property list or class to another
+ void copyProp(PropList& dest, const char* name) const;
+ void copyProp(PropList& dest, const H5std_string& name) const;
- // Copies a property from one property list or property class to another
- void copyProp( PropList& dest, PropList& src, const char* name) const;
- void copyProp( PropList& dest, PropList& src, const H5std_string& name) const;
+ // Copies a property from one property list or property class to another
+ void copyProp(PropList& dest, PropList& src, const char* name) const;
+ void copyProp(PropList& dest, PropList& src, const H5std_string& name) const;
- // Gets the class of this property list, i.e. H5P_FILE_CREATE,
- // H5P_FILE_ACCESS, ...
- hid_t getClass() const;
+ // Gets the class of this property list, i.e. H5P_FILE_CREATE,
+ // H5P_FILE_ACCESS, ...
+ hid_t getClass() const;
- // Return the name of a generic property list class.
- H5std_string getClassName() const;
+ // Return the name of a generic property list class.
+ H5std_string getClassName() const;
- // Returns the parent class of a generic property class.
- PropList getClassParent() const;
+ // Returns the parent class of a generic property class.
+ PropList getClassParent() const;
- // Returns the number of properties in this property list or class.
- size_t getNumProps() const;
+ // Returns the number of properties in this property list or class.
+ size_t getNumProps() const;
- // Query the value of a property in a property list.
- void getProperty(const char* name, void* value) const;
- void getProperty(const H5std_string& name, void* value) const;
- H5std_string getProperty(const char* name) const;
- H5std_string getProperty(const H5std_string& name) const;
+ // Query the value of a property in a property list.
+ void getProperty(const char* name, void* value) const;
+ void getProperty(const H5std_string& name, void* value) const;
+ H5std_string getProperty(const char* name) const;
+ H5std_string getProperty(const H5std_string& name) const;
- // Set a property's value in a property list.
- void setProperty(const char* name, void* value) const;
- void setProperty(const char* name, const char* charptr) const;
- void setProperty(const char* name, H5std_string& strg) const;
- void setProperty(const H5std_string& name, void* value) const;
- void setProperty(const H5std_string& name, H5std_string& strg) const;
+ // Set a property's value in a property list.
+ void setProperty(const char* name, void* value) const;
+ void setProperty(const char* name, const char* charptr) const;
+ void setProperty(const char* name, H5std_string& strg) const;
+ void setProperty(const H5std_string& name, void* value) const;
+ void setProperty(const H5std_string& name, H5std_string& strg) const;
- // Query the size of a property in a property list or class.
- size_t getPropSize(const char *name) const;
- size_t getPropSize(const H5std_string& name) const;
+ // Query the size of a property in a property list or class.
+ size_t getPropSize(const char *name) const;
+ size_t getPropSize(const H5std_string& name) const;
- // Determines whether a property list is a certain class.
- bool isAClass(const PropList& prop_class) const;
+ // Determines whether a property list is a certain class.
+ bool isAClass(const PropList& prop_class) const;
- /// Query the existance of a property in a property object.
- bool propExist(const char* name) const;
- bool propExist(const H5std_string& name) const;
+ /// Query the existance of a property in a property object.
+ bool propExist(const char* name) const;
+ bool propExist(const H5std_string& name) const;
- // Removes a property from a property list.
- void removeProp(const char *name) const;
- void removeProp(const H5std_string& name) const;
+ // Removes a property from a property list.
+ void removeProp(const char *name) const;
+ void removeProp(const H5std_string& name) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("PropList"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("PropList"); }
- // Default constructor: creates a stub PropList object.
- PropList();
+ // Default constructor: creates a stub PropList object.
+ PropList();
- // Copy constructor: creates a copy of a PropList object.
- PropList(const PropList& original);
+ // Copy constructor: creates a copy of a PropList object.
+ PropList(const PropList& original);
- // Gets the property list id.
- virtual hid_t getId() const;
+ // Gets the property list id.
+ virtual hid_t getId() const;
- // Destructor: properly terminates access to this property list.
- virtual ~PropList();
+ // Destructor: properly terminates access to this property list.
+ virtual ~PropList();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Deletes the PropList global constant
- static void deleteConstants();
+ // Deletes the PropList global constant
+ static void deleteConstants();
protected:
- hid_t id; // HDF5 property list id
+ hid_t id; // HDF5 property list id
- // Sets the property list id.
- virtual void p_setId(const hid_t new_id);
+ // Sets the property list id.
+ virtual void p_setId(const hid_t new_id);
private:
- static PropList* DEFAULT_;
+ static PropList* DEFAULT_;
- // Dynamically allocates the PropList global constant
- static PropList* getConstant();
+ // Dynamically allocates the PropList global constant
+ static PropList* getConstant();
- // Friend function to set PropList id. For library use only.
- friend void f_PropList_setId(PropList* plist, hid_t new_id);
+ // Friend function to set PropList id. For library use only.
+ friend void f_PropList_setId(PropList* plist, hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
};
diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp
index 50c9e45..54981ab 100644
--- a/c++/src/H5StrType.cpp
+++ b/c++/src/H5StrType.cpp
@@ -36,249 +36,247 @@
namespace H5 {
//--------------------------------------------------------------------------
-// Function: StrType default constructor
-///\brief Default constructor: Creates a stub string datatype
-// Programmer Binh-Minh Ribler - 2000
+// Function: StrType default constructor
+///\brief Default constructor: Creates a stub string datatype
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
StrType::StrType() : AtomType() {}
//--------------------------------------------------------------------------
-// Function: StrType overloaded constructor
-///\brief Creates a string datatype using a predefined type.
-///\param pred_type - IN: Predefined datatype
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: StrType overloaded constructor
+///\brief Creates a string datatype using a predefined type.
+///\param pred_type - IN: Predefined datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType::StrType( const PredType& pred_type ) : AtomType()
+StrType::StrType(const PredType& pred_type) : AtomType()
{
- // use DataType::copy to make a copy of this predefined type
- copy( pred_type );
+ // use DataType::copy to make a copy of this predefined type
+ copy(pred_type);
}
//--------------------------------------------------------------------------
-// Function: StrType overloaded constructor
-// Purpose Creates a string datatype with a specified length
-// Param pred_type - IN: String predefined type to replicate.
-// Param size - IN: Length of the new string type
-// Exception H5::DataTypeIException
+// Function: StrType overloaded constructor
+// Purpose Creates a string datatype with a specified length
+// Param pred_type - IN: String predefined type to replicate.
+// Param size - IN: Length of the new string type
+// Exception H5::DataTypeIException
// Description
-// The 1st argument could have been skipped, but this
-// constructor will collide with the one that takes an
-// existing id.
+// The 1st argument could have been skipped, but this
+// constructor will collide with the one that takes an
+// existing id.
//
-// Update: replacing the 1st argument with a dummy 0 to
-// avoid the clashing problem, that doesn't eliminate the
-// the 1st argument but it's simpler for the user to type
-// a '0' than PredType::C_S1. - Dec 2, 2005
+// Update: replacing the 1st argument with a dummy 0 to
+// avoid the clashing problem, that doesn't eliminate the
+// the 1st argument but it's simpler for the user to type
+// a '0' than PredType::C_S1. - Dec 2, 2005
// Note
-// The use of this constructor can be shortened by using
-// its overloaded below as StrType(0, size).
-// Programmer Binh-Minh Ribler - 2000
+// The use of this constructor can be shortened by using
+// its overloaded below as StrType(0, size).
+// Programmer Binh-Minh Ribler - 2000
// Modification
-// Planned for removal. -BMR, 2005/12/02
-// Removed from documentation. -BMR, 2016/03/07
+// Planned for removal. -BMR, 2005/12/02
+// Removed from documentation. -BMR, 2016/03/07
//--------------------------------------------------------------------------
-StrType::StrType( const PredType& pred_type, const size_t& size ) : AtomType()
+StrType::StrType(const PredType& pred_type, const size_t& size) : AtomType()
{
- // use DataType::copy to make a copy of the string predefined type
- // then set its length
- copy(pred_type);
- setSize(size);
+ // use DataType::copy to make a copy of the string predefined type
+ // then set its length
+ copy(pred_type);
+ setSize(size);
}
//--------------------------------------------------------------------------
-// Function: StrType overloaded constructor
-///\brief Creates a string datatype with a specified length
-///\param dummy - IN: To simplify calling the previous constructor
-/// and avoid prototype clash with another constructor
-///\param size - IN: Length of the new string type
-///\exception H5::DataTypeIException
+// Function: StrType overloaded constructor
+///\brief Creates a string datatype with a specified length
+///\param dummy - IN: To simplify calling the previous constructor
+/// and avoid prototype clash with another constructor
+///\param size - IN: Length of the new string type
+///\exception H5::DataTypeIException
///\par Description
-/// The 1st argument is just a dummy to simplify calling the
-/// previous constructor, such as:
-/// StrType atype(0, size) instead of
-/// StrType atype(PredType::C_S1, size)
+/// The 1st argument is just a dummy to simplify calling the
+/// previous constructor, such as:
+/// StrType atype(0, size) instead of
+/// StrType atype(PredType::C_S1, size)
// Note
-// This constructor replaced the previous one.
-// Programmer Binh-Minh Ribler - Nov 28, 2005
+// This constructor replaced the previous one.
+// Programmer Binh-Minh Ribler - Nov 28, 2005
//--------------------------------------------------------------------------
-StrType::StrType( const int dummy, const size_t& size ) : AtomType()
+StrType::StrType(const int dummy, const size_t& size) : AtomType()
{
- // use DataType::copy to make a copy of the string predefined type
- // then set its length
- copy(PredType::C_S1);
- setSize(size);
+ // use DataType::copy to make a copy of the string predefined type
+ // then set its length
+ copy(PredType::C_S1);
+ setSize(size);
}
//--------------------------------------------------------------------------
-// Function: StrType overloaded constructor
-///\brief Creates an StrType object using the id of an existing datatype.
-///\param existing_id - IN: Id of an existing datatype
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: StrType overloaded constructor
+///\brief Creates an StrType object using the id of an existing datatype.
+///\param existing_id - IN: Id of an existing datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType::StrType( const hid_t existing_id ) : AtomType( existing_id ) {}
+StrType::StrType(const hid_t existing_id) : AtomType( existing_id ) {}
//--------------------------------------------------------------------------
-// Function: StrType copy constructor
-///\brief Copy constructor: makes a copy of the original StrType object.
-// Programmer Binh-Minh Ribler - 2000
+// Function: StrType copy constructor
+///\brief Copy constructor: makes a copy of the original StrType object.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType::StrType( const StrType& original ) : AtomType ( original ) {}
+StrType::StrType(const StrType& original) : AtomType ( original ) {}
//--------------------------------------------------------------------------
-// Function: StrType overloaded constructor
-///\brief Gets the string datatype of the specified dataset
-///\param dataset - IN: Dataset that this string datatype associates with
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: StrType overloaded constructor
+///\brief Gets the string datatype of the specified dataset
+///\param dataset - IN: Dataset that this string datatype associates with
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-StrType::StrType( const DataSet& dataset ) : AtomType ()
+StrType::StrType(const DataSet& dataset) : AtomType ()
{
- // Calls C function H5Dget_type to get the id of the datatype
- id = H5Dget_type( dataset.getId() );
+ // Calls C function H5Dget_type to get the id of the datatype
+ id = H5Dget_type(dataset.getId());
- if( id < 0 )
- {
- throw DataSetIException("StrType constructor", "H5Dget_type failed");
- }
+ if (id < 0)
+ {
+ throw DataSetIException("StrType constructor", "H5Dget_type failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: StrType overloaded constructor
-///\brief Creates an StrType instance by opening an HDF5 string datatype
-/// given its name, provided as a C character string.
-///\param dtype_name - IN: String type name
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Dec 2016
+// Function: StrType overloaded constructor
+///\brief Creates an StrType instance by opening an HDF5 string datatype
+/// given its name, provided as a C character string.
+///\param dtype_name - IN: String type name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openStrType(const char*) to
-// improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openStrType(const char*) to
+// improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
StrType::StrType(const H5Location& loc, const char *dtype_name) : AtomType()
{
- id = p_opentype(loc, dtype_name);
+ id = p_opentype(loc, dtype_name);
}
//--------------------------------------------------------------------------
-// Function: StrType overloaded constructor
-///\brief Creates an StrType instance by opening an HDF5 string datatype
-/// given its name, provided as an \c H5std_string.
-///\param dtype_name - IN: String type name
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Dec 2016
+// Function: StrType overloaded constructor
+///\brief Creates an StrType instance by opening an HDF5 string datatype
+/// given its name, provided as an \c H5std_string.
+///\param dtype_name - IN: String type name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openStrType(const H5std_string&)
-// to improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openStrType(const H5std_string&)
+// to improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
StrType::StrType(const H5Location& loc, const H5std_string& dtype_name) : AtomType()
{
- id = p_opentype(loc, dtype_name.c_str());
+ id = p_opentype(loc, dtype_name.c_str());
}
//--------------------------------------------------------------------------
-// Function: StrType::getCset
-///\brief Retrieves the character set type of this string datatype.
-///\return Character set type, which can be:
-/// \li \c H5T_CSET_ASCII (0) - Character set is US ASCII.
+// Function: StrType::getCset
+///\brief Retrieves the character set type of this string datatype.
+///\return Character set type, which can be:
+/// \li \c H5T_CSET_ASCII (0) - Character set is US ASCII.
///\note
-/// ASCII and UTF-8 Unicode are the only currently supported character
-/// encodings. Extended ASCII encodings (for example, ISO 8859) are not
-/// supported. This encoding policy is not enforced by the HDF5 Library.
-/// Using encodings other than ASCII and UTF-8 can lead to compatibility
-/// and usability problems. See the C API entry H5Pset_char_encoding for
-/// more information.
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+/// ASCII and UTF-8 Unicode are the only currently supported character
+/// encodings. Extended ASCII encodings (for example, ISO 8859) are not
+/// supported. This encoding policy is not enforced by the HDF5 Library.
+/// Using encodings other than ASCII and UTF-8 can lead to compatibility
+/// and usability problems. See the C API entry H5Pset_char_encoding for
+/// more information.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5T_cset_t StrType::getCset() const
{
- H5T_cset_t cset = H5Tget_cset( id );
+ H5T_cset_t cset = H5Tget_cset(id);
- // Returns a valid character set type if successful
- if( cset == H5T_CSET_ERROR )
- {
- throw DataTypeIException("StrType::getCset", "H5Tget_cset failed");
- }
- return( cset );
+ // Returns a valid character set type if successful
+ if (cset == H5T_CSET_ERROR)
+ {
+ throw DataTypeIException("StrType::getCset", "H5Tget_cset failed");
+ }
+ return(cset);
}
//--------------------------------------------------------------------------
-// Function: StrType::setCset
-///\brief Sets character set to be used.
-///\param cset - IN: character set type, which can be:
-/// \li \c H5T_CSET_ASCII (0) - Character set is US ASCII.
+// Function: StrType::setCset
+///\brief Sets character set to be used.
+///\param cset - IN: character set type, which can be:
+/// \li \c H5T_CSET_ASCII (0) - Character set is US ASCII.
///\note
-/// ASCII and UTF-8 Unicode are the only currently supported character
-/// encodings. Extended ASCII encodings (for example, ISO 8859) are not
-/// supported. This encoding policy is not enforced by the HDF5 Library.
-/// Using encodings other than ASCII and UTF-8 can lead to compatibility
-/// and usability problems. See the C API entry H5Pset_char_encoding for
-/// more information.
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+/// ASCII and UTF-8 Unicode are the only currently supported character
+/// encodings. Extended ASCII encodings (for example, ISO 8859) are not
+/// supported. This encoding policy is not enforced by the HDF5 Library.
+/// Using encodings other than ASCII and UTF-8 can lead to compatibility
+/// and usability problems. See the C API entry H5Pset_char_encoding for
+/// more information.
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void StrType::setCset( H5T_cset_t cset ) const
+void StrType::setCset(H5T_cset_t cset) const
{
- herr_t ret_value = H5Tset_cset( id, cset );
-
- if( ret_value < 0 )
- {
- throw DataTypeIException("StrType::setCset", "H5Tset_cset failed");
- }
+ herr_t ret_value = H5Tset_cset(id, cset);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException("StrType::setCset", "H5Tset_cset failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: StrType::getStrpad
-///\brief Retrieves the storage mechanism for of this string datatype.
-///\return String storage mechanism, which can be:
-/// \li \c H5T_STR_NULLTERM (0) - Null terminate (as C does)
-/// \li \c H5T_STR_NULLPAD (0) - Pad with zeros
-/// \li \c H5T_STR_SPACEPAD (0) - pad with spaces (as FORTRAN does)
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// Function: StrType::getStrpad
+///\brief Retrieves the storage mechanism for of this string datatype.
+///\return String storage mechanism, which can be:
+/// \li \c H5T_STR_NULLTERM (0) - Null terminate (as C does)
+/// \li \c H5T_STR_NULLPAD (0) - Pad with zeros
+/// \li \c H5T_STR_SPACEPAD (0) - pad with spaces (as FORTRAN does)
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5T_str_t StrType::getStrpad() const
{
- H5T_str_t strpad = H5Tget_strpad( id );
+ H5T_str_t strpad = H5Tget_strpad(id);
- // Returns a valid string padding type if successful
- if( strpad == H5T_STR_ERROR )
- {
- throw DataTypeIException("StrType::getStrpad",
- "H5Tget_strpad failed - returned H5T_STR_ERROR");
- }
- return( strpad );
+ // Returns a valid string padding type if successful
+ if (strpad == H5T_STR_ERROR)
+ {
+ throw DataTypeIException("StrType::getStrpad",
+ "H5Tget_strpad failed - returned H5T_STR_ERROR");
+ }
+ return(strpad);
}
//--------------------------------------------------------------------------
-// Function: StrType::setStrpad
-///\brief Defines the storage mechanism for this string datatype.
-///\param strpad - IN: String padding type
-///\exception H5::DataTypeIException
+// Function: StrType::setStrpad
+///\brief Defines the storage mechanism for this string datatype.
+///\param strpad - IN: String padding type
+///\exception H5::DataTypeIException
///\par Description
-/// For detail, please refer to the C layer Reference Manual at:
+/// For detail, please refer to the C layer Reference Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetStrpad
-// Programmer Binh-Minh Ribler - 2000
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-void StrType::setStrpad( H5T_str_t strpad ) const
+void StrType::setStrpad(H5T_str_t strpad) const
{
- herr_t ret_value = H5Tset_strpad( id, strpad );
-
- if( ret_value < 0 )
- {
- throw DataTypeIException("StrType::setStrpad", "H5Tset_strpad failed");
- }
+ herr_t ret_value = H5Tset_strpad(id, strpad);
+ if (ret_value < 0)
+ {
+ throw DataTypeIException("StrType::setStrpad", "H5Tset_strpad failed");
+ }
}
//--------------------------------------------------------------------------
-// Function: StrType destructor
-///\brief Properly terminates access to this string datatype.
-// Programmer Binh-Minh Ribler - 2000
+// Function: StrType destructor
+///\brief Properly terminates access to this string datatype.
+// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
StrType::~StrType() {}
diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h
index b920a3b..3272ad3 100644
--- a/c++/src/H5StrType.h
+++ b/c++/src/H5StrType.h
@@ -27,48 +27,48 @@ namespace H5 {
*/
class H5_DLLCPP StrType : public AtomType {
public:
- // Creates a string type using a predefined type
- StrType(const PredType& pred_type);
+ // Creates a string type using a predefined type
+ StrType(const PredType& pred_type);
- // Creates a string type with specified length - may be obsolete
- StrType(const PredType& pred_type, const size_t& size);
+ // Creates a string type with specified length - may be obsolete
+ StrType(const PredType& pred_type, const size_t& size);
- // Creates a string type with specified length
- StrType(const int dummy, const size_t& size);
+ // Creates a string type with specified length
+ StrType(const int dummy, const size_t& size);
// Gets the string datatype of the specified dataset
- StrType(const DataSet& dataset);
+ StrType(const DataSet& dataset);
- // Constructors that open an HDF5 string datatype, given a location.
- StrType(const H5Location& loc, const char* name);
- StrType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open an HDF5 string datatype, given a location.
+ StrType(const H5Location& loc, const char* name);
+ StrType(const H5Location& loc, const H5std_string& name);
- // Retrieves the character set type of this string datatype.
- H5T_cset_t getCset() const;
+ // Retrieves the character set type of this string datatype.
+ H5T_cset_t getCset() const;
- // Sets character set to be used.
- void setCset(H5T_cset_t cset) const;
+ // Sets character set to be used.
+ void setCset(H5T_cset_t cset) const;
- // Retrieves the string padding method for this string datatype.
- H5T_str_t getStrpad() const;
+ // Retrieves the string padding method for this string datatype.
+ H5T_str_t getStrpad() const;
- // Defines the storage mechanism for character strings.
- void setStrpad(H5T_str_t strpad) const;
+ // Defines the storage mechanism for character strings.
+ void setStrpad(H5T_str_t strpad) const;
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("StrType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("StrType"); }
- // default constructor
- StrType();
+ // default constructor
+ StrType();
- // Creates a string datatype using an existing id
- StrType(const hid_t existing_id);
+ // Creates a string datatype using an existing id
+ StrType(const hid_t existing_id);
- // Copy constructor - makes a copy of the original object
- StrType(const StrType& original);
+ // Copy constructor - makes a copy of the original object
+ StrType(const StrType& original);
- // Noop destructor.
- virtual ~StrType();
+ // Noop destructor.
+ virtual ~StrType();
};
}
#endif // __H5StrType_H
diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp
index 5ecc39b..7f50b9a 100644
--- a/c++/src/H5VarLenType.cpp
+++ b/c++/src/H5VarLenType.cpp
@@ -30,88 +30,88 @@
namespace H5 {
//--------------------------------------------------------------------------
-// Function: VarLenType default constructor
-///\brief Default constructor: Creates a stub variable-length datatype.
+// Function: VarLenType default constructor
+///\brief Default constructor: Creates a stub variable-length datatype.
//--------------------------------------------------------------------------
VarLenType::VarLenType() : DataType() {}
//--------------------------------------------------------------------------
-// Function: VarLenType overloaded constructor
-///\brief Creates an VarLenType object using an existing id.
-///\param existing_id - IN: Id of an existing datatype
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - May, 2004
+// Function: VarLenType overloaded constructor
+///\brief Creates an VarLenType object using an existing id.
+///\param existing_id - IN: Id of an existing datatype
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
VarLenType::VarLenType(const hid_t existing_id) : DataType(existing_id) {}
//--------------------------------------------------------------------------
-// Function: VarLenType copy constructor
-///\brief Copy constructor: makes a copy of the original VarLenType object.
-// Programmer Binh-Minh Ribler - May, 2004
+// Function: VarLenType copy constructor
+///\brief Copy constructor: makes a copy of the original VarLenType object.
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
VarLenType::VarLenType(const VarLenType& original) : DataType(original) {}
//--------------------------------------------------------------------------
-// Function: VarLenType overloaded constructor
-///\brief Creates a new variable-length datatype based on the specified
-/// \a base_type.
-///\param base_type - IN: Pointer to existing datatype
-///\exception H5::DataTypeIException
+// Function: VarLenType overloaded constructor
+///\brief Creates a new variable-length datatype based on the specified
+/// \a base_type.
+///\param base_type - IN: Pointer to existing datatype
+///\exception H5::DataTypeIException
// Description
-// DataType passed by pointer to avoid clashing with copy
-// constructor.
-// Programmer Binh-Minh Ribler - May, 2004
+// DataType passed by pointer to avoid clashing with copy
+// constructor.
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
VarLenType::VarLenType(const DataType* base_type) : DataType()
{
- id = H5Tvlen_create(base_type->getId());
- if (id < 0)
- {
- throw DataTypeIException("VarLenType constructor",
+ id = H5Tvlen_create(base_type->getId());
+ if (id < 0)
+ {
+ throw DataTypeIException("VarLenType constructor",
"H5Tvlen_create returns negative value");
- }
+ }
}
//--------------------------------------------------------------------------
-// Function: VarLenType overloaded constructor
-///\brief Creates an VarLenType instance by opening an HDF5 variable
-/// length datatype given its name, provided as a C char*.
-///\param dtype_name - IN: Variable length type name
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Dec 2016
+// Function: VarLenType overloaded constructor
+///\brief Creates an VarLenType instance by opening an HDF5 variable
+/// length datatype given its name, provided as a C char*.
+///\param dtype_name - IN: Variable length type name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openVarLenType(const char*) to
-// improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openVarLenType(const char*) to
+// improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
VarLenType::VarLenType(const H5Location& loc, const char *dtype_name) : DataType()
{
- id = p_opentype(loc, dtype_name);
+ id = p_opentype(loc, dtype_name);
}
//--------------------------------------------------------------------------
-// Function: VarLenType overloaded constructor
-///\brief Creates an VarLenType instance by opening an HDF5 variable
-/// length datatype given its name, provided as an \c H5std_string.
-///\param dtype_name - IN: Variable length type name
-///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Dec 2016
+// Function: VarLenType overloaded constructor
+///\brief Creates an VarLenType instance by opening an HDF5 variable
+/// length datatype given its name, provided as an \c H5std_string.
+///\param dtype_name - IN: Variable length type name
+///\exception H5::DataTypeIException
+// Programmer Binh-Minh Ribler - Dec 2016
// Description
-// In 1.10.1, this constructor was introduced and will replace the
-// existing function CommonFG::openVarLenType(const H5std_string&)
-// to improve usability.
-// -BMR, Dec 2016
+// In 1.10.1, this constructor was introduced and will replace the
+// existing function CommonFG::openVarLenType(const H5std_string&)
+// to improve usability.
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
VarLenType::VarLenType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
{
- id = p_opentype(loc, dtype_name.c_str());
+ id = p_opentype(loc, dtype_name.c_str());
}
//--------------------------------------------------------------------------
-// Function: VarLenType destructor
-///\brief Properly terminates access to this datatype.
-// Programmer Binh-Minh Ribler - May, 2004
+// Function: VarLenType destructor
+///\brief Properly terminates access to this datatype.
+// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
VarLenType::~VarLenType() {}
diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h
index af4f7b7..a93f44d 100644
--- a/c++/src/H5VarLenType.h
+++ b/c++/src/H5VarLenType.h
@@ -27,28 +27,28 @@ namespace H5 {
*/
class H5_DLLCPP VarLenType : public DataType {
public:
- // Constructor that creates a variable-length datatype based
- // on the specified base type.
- VarLenType(const DataType* base_type);
+ // Constructor that creates a variable-length datatype based
+ // on the specified base type.
+ VarLenType(const DataType* base_type);
- ///\brief Returns this class name.
- virtual H5std_string fromClass () const { return("VarLenType"); }
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("VarLenType"); }
- // Copy constructor: makes copy of the original object.
- VarLenType( const VarLenType& original );
+ // Copy constructor: makes copy of the original object.
+ VarLenType(const VarLenType& original);
- // Constructor that takes an existing id
- VarLenType( const hid_t existing_id );
+ // Constructor that takes an existing id
+ VarLenType(const hid_t existing_id);
- // Constructors that open a variable-length datatype, given a location.
- VarLenType(const H5Location& loc, const char* name);
- VarLenType(const H5Location& loc, const H5std_string& name);
+ // Constructors that open a variable-length datatype, given a location.
+ VarLenType(const H5Location& loc, const char* name);
+ VarLenType(const H5Location& loc, const H5std_string& name);
- // Noop destructor
- virtual ~VarLenType();
+ // Noop destructor
+ virtual ~VarLenType();
- // Default constructor
- VarLenType();
+ // Default constructor
+ VarLenType();
};
}
#endif // __H5VarLenType_H
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 8752744..48a0c4d 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -16,12 +16,12 @@
/*****************************************************************************
FILE
dsets.cpp - HDF5 C++ testing the functionalities associated with the
- C dataset interface (H5D)
+ C dataset interface (H5D)
EXTERNAL ROUTINES/VARIABLES:
These routines are in the test directory of the C library:
- h5_reset() -- in h5test.c, resets the library by closing it
- h5_fileaccess() -- in h5test.c, returns a file access template
+ h5_reset() -- in h5test.c, resets the library by closing it
+ h5_fileaccess() -- in h5test.c, returns a file access template
***************************************************************************/
@@ -34,20 +34,20 @@ using std::cerr;
using std::endl;
#include <string>
-#include "H5Cpp.h" // C++ API header file
+#include "H5Cpp.h" // C++ API header file
using namespace H5;
#include "h5test.h"
-#include "h5cpputil.h" // C++ utilility header file
+#include "h5cpputil.h" // C++ utilility header file
-const H5std_string FILE1("dataset.h5");
-const H5std_string DSET_DEFAULT_NAME("default");
-const H5std_string DSET_DEFAULT_NAME_PATH("/default");
-const H5std_string DSET_CHUNKED_NAME("chunked");
-const H5std_string DSET_SIMPLE_IO_NAME("simple_io");
-const H5std_string DSET_TCONV_NAME ("tconv");
-const H5std_string DSET_COMPRESS_NAME("compressed");
-const H5std_string DSET_BOGUS_NAME ("bogus");
+const H5std_string FILE1("dataset.h5");
+const H5std_string DSET_DEFAULT_NAME("default");
+const H5std_string DSET_DEFAULT_NAME_PATH("/default");
+const H5std_string DSET_CHUNKED_NAME("chunked");
+const H5std_string DSET_SIMPLE_IO_NAME("simple_io");
+const H5std_string DSET_TCONV_NAME("tconv");
+const H5std_string DSET_COMPRESS_NAME("compressed");
+const H5std_string DSET_BOGUS_NAME("bogus");
/* Temporary filter IDs used for testing */
const int H5Z_FILTER_BOGUS = 305;
@@ -58,16 +58,16 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
/*-------------------------------------------------------------------------
- * Function: test_create
+ * Function: test_create
*
- * Purpose: Attempts to create a dataset.
+ * Purpose Attempts to create a dataset.
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
+ * Programmer Binh-Minh Ribler (using C version)
+ * Friday, January 5, 2001
*
* Modifications:
*
@@ -81,125 +81,125 @@ test_create( H5File& file)
// Setting this to NULL for cleaning up in failure situations
DataSet *dataset = NULL;
try {
- // Create a data space
- hsize_t dims[2];
- dims[0] = 256;
- dims[1] = 512;
- DataSpace space (2, dims, NULL);
-
- // Create a dataset using the default dataset creation properties.
- // We're not sure what they are, so we won't check.
- dataset = new DataSet (file.createDataSet
- (DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
-
-
- // Add a comment to the dataset
- file.setComment (DSET_DEFAULT_NAME, "This is a dataset");
-
- // Close the dataset
- delete dataset;
- dataset = NULL;
-
- // Try creating a dataset that already exists. This should fail since a
- // dataset can only be created once. If an exception is not thrown for
- // this action by createDataSet, then throw an invalid action exception.
- try {
- dataset = new DataSet (file.createDataSet
- (DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
-
- // continuation here, that means no exception has been thrown
- throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset");
- }
- catch (FileIException& E) // catching invalid creating dataset
- {} // do nothing, exception expected
-
- // Open the dataset we created above and then close it. This is one
- // way to open an existing dataset for accessing.
- dataset = new DataSet (file.openDataSet (DSET_DEFAULT_NAME));
-
- // Get and verify the name of this dataset, using
- // H5std_string getObjName()
- H5std_string ds_name = dataset->getObjName();
- verify_val(ds_name, DSET_DEFAULT_NAME_PATH, "DataSet::getObjName", __LINE__, __FILE__);
-
- // Get and verify the comment from this dataset, using
- // H5std_string getComment(const H5std_string& name, <buf_size=0, by default>)
- H5std_string comment = file.getComment(DSET_DEFAULT_NAME);
- verify_val(comment, "This is a dataset", "DataSet::getComment", __LINE__, __FILE__);
-
- // Close the dataset when accessing is completed
- delete dataset;
-
- // This is another way to open an existing dataset for accessing.
- DataSet another_dataset(file.openDataSet (DSET_DEFAULT_NAME));
-
- // Try opening a non-existent dataset. This should fail so if an
- // exception is not thrown for this action by openDataSet, then
- // display failure information and throw an exception.
- try {
- dataset = new DataSet (file.openDataSet( "does_not_exist" ));
-
- // continuation here, that means no exception has been thrown
- throw InvalidActionException("H5File::openDataSet", "Attempted to open a non-existent dataset");
- }
- catch (FileIException& E ) // catching creating non-existent dataset
- {} // do nothing, exception expected
-
- // Create a new dataset that uses chunked storage instead of the default
- // layout.
- DSetCreatPropList create_parms;
- hsize_t csize[2];
- csize[0] = 5;
- csize[1] = 100;
- create_parms.setChunk( 2, csize );
-
- dataset = new DataSet (file.createDataSet
- (DSET_CHUNKED_NAME, PredType::NATIVE_DOUBLE, space, create_parms));
- // Note: this one has no error message in C when failure occurs?
-
- // clean up and return with success
- delete dataset;
-
- PASSED();
- return 0;
- } // outer most try block
+ // Create a data space
+ hsize_t dims[2];
+ dims[0] = 256;
+ dims[1] = 512;
+ DataSpace space (2, dims, NULL);
+
+ // Create a dataset using the default dataset creation properties.
+ // We're not sure what they are, so we won't check.
+ dataset = new DataSet (file.createDataSet
+ (DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
+
+
+ // Add a comment to the dataset
+ file.setComment (DSET_DEFAULT_NAME, "This is a dataset");
+
+ // Close the dataset
+ delete dataset;
+ dataset = NULL;
+
+ // Try creating a dataset that already exists. This should fail since a
+ // dataset can only be created once. If an exception is not thrown for
+ // this action by createDataSet, then throw an invalid action exception.
+ try {
+ dataset = new DataSet (file.createDataSet
+ (DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space));
+
+ // continuation here, that means no exception has been thrown
+ throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset");
+ }
+ catch (FileIException& E) // catching invalid creating dataset
+ {} // do nothing, exception expected
+
+ // Open the dataset we created above and then close it. This is one
+ // way to open an existing dataset for accessing.
+ dataset = new DataSet (file.openDataSet (DSET_DEFAULT_NAME));
+
+ // Get and verify the name of this dataset, using
+ // H5std_string getObjName()
+ H5std_string ds_name = dataset->getObjName();
+ verify_val(ds_name, DSET_DEFAULT_NAME_PATH, "DataSet::getObjName", __LINE__, __FILE__);
+
+ // Get and verify the comment from this dataset, using
+ // H5std_string getComment(const H5std_string& name, <buf_size=0, by default>)
+ H5std_string comment = file.getComment(DSET_DEFAULT_NAME);
+ verify_val(comment, "This is a dataset", "DataSet::getComment", __LINE__, __FILE__);
+
+ // Close the dataset when accessing is completed
+ delete dataset;
+
+ // This is another way to open an existing dataset for accessing.
+ DataSet another_dataset(file.openDataSet (DSET_DEFAULT_NAME));
+
+ // Try opening a non-existent dataset. This should fail so if an
+ // exception is not thrown for this action by openDataSet, then
+ // display failure information and throw an exception.
+ try {
+ dataset = new DataSet (file.openDataSet( "does_not_exist" ));
+
+ // continuation here, that means no exception has been thrown
+ throw InvalidActionException("H5File::openDataSet", "Attempted to open a non-existent dataset");
+ }
+ catch (FileIException& E ) // catching creating non-existent dataset
+ {} // do nothing, exception expected
+
+ // Create a new dataset that uses chunked storage instead of the default
+ // layout.
+ DSetCreatPropList create_parms;
+ hsize_t csize[2];
+ csize[0] = 5;
+ csize[1] = 100;
+ create_parms.setChunk( 2, csize );
+
+ dataset = new DataSet (file.createDataSet(DSET_CHUNKED_NAME,
+ PredType::NATIVE_DOUBLE, space, create_parms));
+ // Note: this one has no error message in C when failure occurs?
+
+ // clean up and return with success
+ delete dataset;
+
+ PASSED();
+ return 0;
+ } // outer most try block
catch (InvalidActionException& E)
{
- cerr << " FAILED" << endl;
- cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
+ cerr << " FAILED" << endl;
+ cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
- // clean up and return with failure
- if (dataset != NULL)
- delete dataset;
- return -1;
+ // clean up and return with failure
+ if (dataset != NULL)
+ delete dataset;
+ return -1;
}
// catch all other exceptions
catch (Exception& E)
{
- issue_fail_msg("test_create", __LINE__, __FILE__);
+ issue_fail_msg("test_create", __LINE__, __FILE__);
- // clean up and return with failure
- if (dataset != NULL)
- delete dataset;
- return -1;
+ // clean up and return with failure
+ if (dataset != NULL)
+ delete dataset;
+ return -1;
}
} // test_create
/*-------------------------------------------------------------------------
- * Function: test_simple_io
+ * Function: test_simple_io
*
- * Purpose: Tests simple I/O. That is, reading and writing a complete
- * multi-dimensional array without data type or data space
- * conversions, without compression, and stored contiguously.
+ * Purpose Tests simple I/O. That is, reading and writing a complete
+ * multi-dimensional array without data type or data space
+ * conversions, without compression, and stored contiguously.
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
+ * Programmer Binh-Minh Ribler (using C version)
+ * Friday, January 5, 2001
*
* Modifications:
*
@@ -211,81 +211,81 @@ test_simple_io( H5File& file)
SUBTEST("Simple I/O");
- int points[100][200];
- int check[100][200];
- int i, j, n;
+ int points[100][200];
+ int check[100][200];
+ int i, j, n;
// Initialize the dataset
for (i = n = 0; i < 100; i++)
{
- for (j = 0; j < 200; j++) {
- points[i][j] = n++;
- }
+ for (j = 0; j < 200; j++) {
+ points[i][j] = n++;
+ }
}
char* tconv_buf = new char [1000];
try
{
- // Create the data space
- hsize_t dims[2];
- dims[0] = 100;
- dims[1] = 200;
- DataSpace space (2, dims, NULL);
-
- // Create a small conversion buffer to test strip mining
- DSetMemXferPropList xfer;
-
- xfer.setBuffer (1000, tconv_buf, NULL);
-
- // Create the dataset
- DataSet dataset (file.createDataSet (DSET_SIMPLE_IO_NAME, PredType::NATIVE_INT, space));
-
- // Write the data to the dataset
- dataset.write(static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
-
- // Read the dataset back
- dataset.read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
-
- // Check that the values read are the same as the values written
- for (i = 0; i < 100; i++)
- for (j = 0; j < 200; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
- if (status == -1)
- throw Exception("DataSet::read");
- }
-
- // clean up and return with success
- delete [] tconv_buf;
- PASSED();
- return 0;
+ // Create the data space
+ hsize_t dims[2];
+ dims[0] = 100;
+ dims[1] = 200;
+ DataSpace space (2, dims, NULL);
+
+ // Create a small conversion buffer to test strip mining
+ DSetMemXferPropList xfer;
+
+ xfer.setBuffer (1000, tconv_buf, NULL);
+
+ // Create the dataset
+ DataSet dataset (file.createDataSet (DSET_SIMPLE_IO_NAME, PredType::NATIVE_INT, space));
+
+ // Write the data to the dataset
+ dataset.write(static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+
+ // Read the dataset back
+ dataset.read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+
+ // Check that the values read are the same as the values written
+ for (i = 0; i < 100; i++)
+ for (j = 0; j < 200; j++)
+ {
+ int status = check_values (i, j, points[i][j], check[i][j]);
+ if (status == -1)
+ throw Exception("DataSet::read");
+ }
+
+ // clean up and return with success
+ delete [] tconv_buf;
+ PASSED();
+ return 0;
} // end try
// catch all dataset, space, plist exceptions
catch (Exception& E)
{
- cerr << " FAILED" << endl;
- cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
+ cerr << " FAILED" << endl;
+ cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
- // clean up and return with failure
- if (tconv_buf)
- delete [] tconv_buf;
- return -1;
+ // clean up and return with failure
+ if (tconv_buf)
+ delete [] tconv_buf;
+ return -1;
}
} // test_simple_io
/*-------------------------------------------------------------------------
- * Function: test_datasize
+ * Function: test_datasize
*
- * Purpose: Tests DataSet::getInMemDataSize().
+ * Purpose Tests DataSet::getInMemDataSize().
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler
- * Thursday, March 22, 2012
+ * Programmer Binh-Minh Ribler
+ * Thursday, March 22, 2012
*
* Modifications:
*
@@ -297,65 +297,65 @@ test_datasize(FileAccPropList &fapl)
SUBTEST("DataSet::getInMemDataSize()");
try
{
- // Open FILE1.
- H5File file(FILE1, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl);
-
- // Open dataset DSET_SIMPLE_IO_NAME.
- DataSet dset = file.openDataSet (DSET_SIMPLE_IO_NAME);
-
- // Get the dataset's dataspace to calculate the size for verification.
- DataSpace space(dset.getSpace());
-
- // Get the dimension sizes.
- hsize_t dims[2];
- int n_dims = space.getSimpleExtentDims(dims);
- if (n_dims < 0)
- {
- throw Exception("test_compression", "DataSpace::getSimpleExtentDims() failed");
- }
-
- // Calculate the supposed size. Size of each value is int (4), from
- // test_simple_io.
- size_t expected_size = 4 * dims[0] * dims[1];
-
- // getInMemDataSize() returns the in memory size of the data.
- size_t ds_size = dset.getInMemDataSize();
-
- // Verify the data size.
- if (ds_size != expected_size)
- {
- H5_FAILED();
- cerr << " Expected data size = " << expected_size;
- cerr << " but dset.getInMemDataSize() returned " << ds_size << endl;
- throw Exception("test_compression", "Failed in testing DataSet::getInMemDataSize()");
- }
-
- PASSED();
- return 0;
+ // Open FILE1.
+ H5File file(FILE1, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl);
+
+ // Open dataset DSET_SIMPLE_IO_NAME.
+ DataSet dset = file.openDataSet (DSET_SIMPLE_IO_NAME);
+
+ // Get the dataset's dataspace to calculate the size for verification.
+ DataSpace space(dset.getSpace());
+
+ // Get the dimension sizes.
+ hsize_t dims[2];
+ int n_dims = space.getSimpleExtentDims(dims);
+ if (n_dims < 0)
+ {
+ throw Exception("test_compression", "DataSpace::getSimpleExtentDims() failed");
+ }
+
+ // Calculate the supposed size. Size of each value is int (4), from
+ // test_simple_io.
+ size_t expected_size = 4 * dims[0] * dims[1];
+
+ // getInMemDataSize() returns the in memory size of the data.
+ size_t ds_size = dset.getInMemDataSize();
+
+ // Verify the data size.
+ if (ds_size != expected_size)
+ {
+ H5_FAILED();
+ cerr << " Expected data size = " << expected_size;
+ cerr << " but dset.getInMemDataSize() returned " << ds_size << endl;
+ throw Exception("test_compression", "Failed in testing DataSet::getInMemDataSize()");
+ }
+
+ PASSED();
+ return 0;
} // end try
// catch all dataset, space, plist exceptions
catch (Exception& E)
{
- cerr << " FAILED" << endl;
- cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
+ cerr << " FAILED" << endl;
+ cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
- return -1;
+ return -1;
}
} // test_datasize
/*-------------------------------------------------------------------------
- * Function: test_tconv
+ * Function: test_tconv
*
- * Purpose: Test some simple data type conversion stuff.
+ * Purpose Test some simple data type conversion stuff.
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
+ * Programmer Binh-Minh Ribler (using C version)
+ * Friday, January 5, 2001
*
* Modifications:
*
@@ -365,7 +365,7 @@ static herr_t
test_tconv(H5File& file)
{
// Prepare buffers for input/output
- char *out=NULL, *in=NULL;
+ char *out=NULL, *in=NULL;
out = new char [4*1000000];
// assert (out); - should use exception handler for new - BMR
in = new char [4*1000000];
@@ -375,81 +375,81 @@ test_tconv(H5File& file)
// Initialize the dataset
for (int i = 0; i < 1000000; i++) {
- out[i*4+0] = 0x11;
- out[i*4+1] = 0x22;
- out[i*4+2] = 0x33;
- out[i*4+3] = 0x44;
+ out[i*4+0] = 0x11;
+ out[i*4+1] = 0x22;
+ out[i*4+2] = 0x33;
+ out[i*4+3] = 0x44;
}
try
{
- // Create the data space
- hsize_t dims[1];
- dims[0] = 1000000;
- DataSpace space (1, dims, NULL);
-
- // Create the data set
- DataSet dataset (file.createDataSet (DSET_TCONV_NAME, PredType::STD_I32LE, space));
-
- // Write the data to the dataset
- dataset.write (static_cast<void*>(out), PredType::STD_I32LE);
-
- // Read data with byte order conversion
- dataset.read (static_cast<void*>(in), PredType::STD_I32BE);
-
- // Check
- for (int i = 0; i < 1000000; i++) {
- if (in[4*i+0]!=out[4*i+3] ||
- in[4*i+1]!=out[4*i+2] ||
- in[4*i+2]!=out[4*i+1] ||
- in[4*i+3]!=out[4*i+0])
- {
- throw Exception("DataSet::read", "Read with byte order conversion failed");
- }
- }
-
- // clean up and return with success
- delete [] out;
- delete [] in;
- PASSED();
- return 0;
+ // Create the data space
+ hsize_t dims[1];
+ dims[0] = 1000000;
+ DataSpace space (1, dims, NULL);
+
+ // Create the data set
+ DataSet dataset (file.createDataSet (DSET_TCONV_NAME, PredType::STD_I32LE, space));
+
+ // Write the data to the dataset
+ dataset.write (static_cast<void*>(out), PredType::STD_I32LE);
+
+ // Read data with byte order conversion
+ dataset.read (static_cast<void*>(in), PredType::STD_I32BE);
+
+ // Check
+ for (int i = 0; i < 1000000; i++) {
+ if (in[4*i+0]!=out[4*i+3] ||
+ in[4*i+1]!=out[4*i+2] ||
+ in[4*i+2]!=out[4*i+1] ||
+ in[4*i+3]!=out[4*i+0])
+ {
+ throw Exception("DataSet::read", "Read with byte order conversion failed");
+ }
+ }
+
+ // clean up and return with success
+ delete [] out;
+ delete [] in;
+ PASSED();
+ return 0;
} // end try
// catch all dataset and space exceptions
catch (Exception& E)
{
- cerr << " FAILED" << endl;
- cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
+ cerr << " FAILED" << endl;
+ cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
- // clean up and return with failure
- delete [] out;
- delete [] in;
- return -1;
+ // clean up and return with failure
+ delete [] out;
+ delete [] in;
+ return -1;
}
} // test_tconv
/* This message derives from H5Z */
const H5Z_class2_t H5Z_BOGUS[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version number */
- H5Z_FILTER_BOGUS, /* Filter id number */
- 1, 1, /* Encode and decode enabled */
- "bogus", /* Filter name for debugging */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version number */
+ H5Z_FILTER_BOGUS, /* Filter id number */
+ 1, 1, /* Encode and decode enabled */
+ "bogus", /* Filter name for debugging */
NULL, /* The "can apply" callback */
NULL, /* The "set local" callback */
- (H5Z_func_t)filter_bogus, /* The actual filter function */
+ (H5Z_func_t)filter_bogus, /* The actual filter function */
}};
/*-------------------------------------------------------------------------
- * Function: bogus
+ * Function: bogus
*
- * Purpose: A bogus compression method that doesn't do anything.
+ * Purpose A bogus compression method that doesn't do anything.
*
- * Return: Success: Data chunk size
+ * Return Success: Data chunk size
*
- * Failure: 0
+ * Failure: 0
*
- * Programmer: Robb Matzke
- * Tuesday, April 21, 1998
+ * Programmer Robb Matzke
+ * Tuesday, April 21, 1998
*
* Modifications:
*
@@ -466,19 +466,19 @@ filter_bogus(unsigned int flags, size_t cd_nelmts,
/*-------------------------------------------------------------------------
- * Function: test_compression
+ * Function: test_compression
*
- * Purpose: Tests dataset compression. If compression is requested when
- * it hasn't been compiled into the library (such as when
- * updating an existing compressed dataset) then data is sent to
- * the file uncompressed but no errors are returned.
+ * Purpose Tests dataset compression. If compression is requested when
+ * it hasn't been compiled into the library (such as when
+ * updating an existing compressed dataset) then data is sent to
+ * the file uncompressed but no errors are returned.
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
+ * Programmer Binh-Minh Ribler (using C version)
+ * Friday, January 5, 2001
*
* Modifications:
*
@@ -488,266 +488,266 @@ static herr_t
test_compression(H5File& file)
{
#ifndef H5_HAVE_FILTER_DEFLATE
- const char *not_supported;
+ const char *not_supported;
not_supported = " Deflate compression is not enabled.";
#endif /* H5_HAVE_FILTER_DEFLATE */
- int points[100][200];
- int check[100][200];
- hsize_t i, j, n;
+ int points[100][200];
+ int check[100][200];
+ hsize_t i, j, n;
// Initialize the dataset
for (i = n = 0; i < 100; i++)
{
- for (j = 0; j < 200; j++) {
- points[i][j] = static_cast<int>(n++);
- }
+ for (j = 0; j < 200; j++) {
+ points[i][j] = static_cast<int>(n++);
+ }
}
char* tconv_buf = new char [1000];
DataSet* dataset = NULL;
try
{
- const hsize_t size[2] = {100, 200};
- // Create the data space
- DataSpace space1(2, size, NULL);
+ const hsize_t size[2] = {100, 200};
+ // Create the data space
+ DataSpace space1(2, size, NULL);
- // Create a small conversion buffer to test strip mining
- DSetMemXferPropList xfer;
+ // Create a small conversion buffer to test strip mining
+ DSetMemXferPropList xfer;
- xfer.setBuffer (1000, tconv_buf, NULL);
+ xfer.setBuffer (1000, tconv_buf, NULL);
- // Use chunked storage with compression
- DSetCreatPropList dscreatplist;
+ // Use chunked storage with compression
+ DSetCreatPropList dscreatplist;
- const hsize_t chunk_size[2] = {2, 25};
- dscreatplist.setChunk (2, chunk_size);
- dscreatplist.setDeflate (6);
+ const hsize_t chunk_size[2] = {2, 25};
+ dscreatplist.setChunk (2, chunk_size);
+ dscreatplist.setDeflate (6);
#ifdef H5_HAVE_FILTER_DEFLATE
- SUBTEST("Compression (setup)");
-
- // Create the dataset
- dataset = new DataSet (file.createDataSet
- (DSET_COMPRESS_NAME, PredType::NATIVE_INT, space1, dscreatplist));
-
- PASSED();
-
- /*----------------------------------------------------------------------
- * STEP 1: Read uninitialized data. It should be zero.
- *----------------------------------------------------------------------
- */
- SUBTEST("Compression (uninitialized read)");
-
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
-
- for (i=0; i<size[0]; i++) {
- for (j=0; j<size[1]; j++) {
- if (0!=check[i][j]) {
- H5_FAILED();
- cerr << " Read a non-zero value." << endl;
- cerr << " At index " << static_cast<unsigned long>(i) << "," <<
- static_cast<unsigned long>(j) << endl;
- throw Exception("test_compression", "Failed in uninitialized read");
- }
- }
- }
- PASSED();
-
- /*----------------------------------------------------------------------
- * STEP 2: Test compression by setting up a chunked dataset and writing
- * to it.
- *----------------------------------------------------------------------
- */
- SUBTEST("Compression (write)");
-
- for (i=n=0; i<size[0]; i++)
- {
- for (j=0; j<size[1]; j++)
- {
- points[i][j] = static_cast<int>(n++);
- }
- }
-
- dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
-
- PASSED();
-
- /*----------------------------------------------------------------------
- * STEP 3: Try to read the data we just wrote.
- *----------------------------------------------------------------------
- */
- SUBTEST("Compression (read)");
-
- // Read the dataset back
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
-
- // Check that the values read are the same as the values written
- for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
- if (status == -1)
- throw Exception("test_compression", "Failed in read");
- }
-
- PASSED();
-
- /*----------------------------------------------------------------------
- * STEP 4: Write new data over the top of the old data. The new data is
- * random thus not very compressible, and will cause the chunks to move
- * around as they grow. We only change values for the left half of the
- * dataset although we rewrite the whole thing.
- *----------------------------------------------------------------------
- */
- SUBTEST("Compression (modify)");
-
- for (i=0; i<size[0]; i++)
- {
- for (j=0; j<size[1]/2; j++)
- {
- points[i][j] = rand ();
- }
- }
- dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
-
- // Read the dataset back and check it
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
-
- // Check that the values read are the same as the values written
- for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
- if (status == -1)
- throw Exception("test_compression", "Failed in modify");
- }
-
- PASSED();
-
- /*----------------------------------------------------------------------
- * STEP 5: Close the dataset and then open it and read it again. This
- * insures that the compression message is picked up properly from the
- * object header.
- *----------------------------------------------------------------------
- */
- SUBTEST("Compression (re-open)");
-
- // close this dataset to reuse the var
- delete dataset;
-
- dataset = new DataSet (file.openDataSet (DSET_COMPRESS_NAME));
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
-
- // Check that the values read are the same as the values written
- for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
- if (status == -1)
- throw Exception("test_compression", "Failed in re-open");
- }
-
- PASSED();
-
-
- /*----------------------------------------------------------------------
- * STEP 6: Test partial I/O by writing to and then reading from a
- * hyperslab of the dataset. The hyperslab does not line up on chunk
- * boundaries (we know that case already works from above tests).
- *----------------------------------------------------------------------
- */
- SUBTEST("Compression (partial I/O)");
-
- const hsize_t hs_size[2] = {4, 50};
- const hsize_t hs_offset[2] = {7, 30};
- for (i = 0; i < hs_size[0]; i++) {
- for (j = 0; j < hs_size[1]; j++) {
- points[hs_offset[0]+i][hs_offset[1]+j] = rand ();
- }
- }
- space1.selectHyperslab( H5S_SELECT_SET, hs_size, hs_offset );
- dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, space1, space1, xfer);
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, space1, space1, xfer);
-
- // Check that the values read are the same as the values written
- for (i=0; i<hs_size[0]; i++) {
- for (j=0; j<hs_size[1]; j++) {
- if (points[hs_offset[0]+i][hs_offset[1]+j] !=
- check[hs_offset[0]+i][hs_offset[1]+j]) {
- H5_FAILED();
- cerr << " Read different values than written.\n" << endl;
- cerr << " At index " << static_cast<unsigned long>((hs_offset[0]+i)) <<
- "," << static_cast<unsigned long>((hs_offset[1]+j)) << endl;
-
- cerr << " At original: " << static_cast<int>(points[hs_offset[0]+i][hs_offset[1]+j]) << endl;
- cerr << " At returned: " << static_cast<int>(check[hs_offset[0]+i][hs_offset[1]+j]) << endl;
- throw Exception("test_compression", "Failed in partial I/O");
- }
- } // for j
- } // for i
-
- delete dataset;
- dataset = NULL;
-
- PASSED();
+ SUBTEST("Compression (setup)");
+
+ // Create the dataset
+ dataset = new DataSet (file.createDataSet
+ (DSET_COMPRESS_NAME, PredType::NATIVE_INT, space1, dscreatplist));
+
+ PASSED();
+
+ /*----------------------------------------------------------------------
+ * STEP 1: Read uninitialized data. It should be zero.
+ *----------------------------------------------------------------------
+ */
+ SUBTEST("Compression (uninitialized read)");
+
+ dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+
+ for (i=0; i<size[0]; i++) {
+ for (j=0; j<size[1]; j++) {
+ if (0!=check[i][j]) {
+ H5_FAILED();
+ cerr << " Read a non-zero value." << endl;
+ cerr << " At index " << static_cast<unsigned long>(i)
+ << "," << static_cast<unsigned long>(j) << endl;
+ throw Exception("test_compression", "Failed in uninitialized read");
+ }
+ }
+ }
+ PASSED();
+
+ /*----------------------------------------------------------------------
+ * STEP 2: Test compression by setting up a chunked dataset and writing
+ * to it.
+ *----------------------------------------------------------------------
+ */
+ SUBTEST("Compression (write)");
+
+ for (i=n=0; i<size[0]; i++)
+ {
+ for (j=0; j<size[1]; j++)
+ {
+ points[i][j] = static_cast<int>(n++);
+ }
+ }
+
+ dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+
+ PASSED();
+
+ /*----------------------------------------------------------------------
+ * STEP 3: Try to read the data we just wrote.
+ *----------------------------------------------------------------------
+ */
+ SUBTEST("Compression (read)");
+
+ // Read the dataset back
+ dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+
+ // Check that the values read are the same as the values written
+ for (i = 0; i < size[0]; i++)
+ for (j = 0; j < size[1]; j++)
+ {
+ int status = check_values (i, j, points[i][j], check[i][j]);
+ if (status == -1)
+ throw Exception("test_compression", "Failed in read");
+ }
+
+ PASSED();
+
+ /*----------------------------------------------------------------------
+ * STEP 4: Write new data over the top of the old data. The new data is
+ * random thus not very compressible, and will cause the chunks to move
+ * around as they grow. We only change values for the left half of the
+ * dataset although we rewrite the whole thing.
+ *----------------------------------------------------------------------
+ */
+ SUBTEST("Compression (modify)");
+
+ for (i=0; i<size[0]; i++)
+ {
+ for (j=0; j<size[1]/2; j++)
+ {
+ points[i][j] = rand ();
+ }
+ }
+ dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+
+ // Read the dataset back and check it
+ dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+
+ // Check that the values read are the same as the values written
+ for (i = 0; i < size[0]; i++)
+ for (j = 0; j < size[1]; j++)
+ {
+ int status = check_values (i, j, points[i][j], check[i][j]);
+ if (status == -1)
+ throw Exception("test_compression", "Failed in modify");
+ }
+
+ PASSED();
+
+ /*----------------------------------------------------------------------
+ * STEP 5: Close the dataset and then open it and read it again. This
+ * insures that the compression message is picked up properly from the
+ * object header.
+ *----------------------------------------------------------------------
+ */
+ SUBTEST("Compression (re-open)");
+
+ // close this dataset to reuse the var
+ delete dataset;
+
+ dataset = new DataSet (file.openDataSet (DSET_COMPRESS_NAME));
+ dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+
+ // Check that the values read are the same as the values written
+ for (i = 0; i < size[0]; i++)
+ for (j = 0; j < size[1]; j++)
+ {
+ int status = check_values (i, j, points[i][j], check[i][j]);
+ if (status == -1)
+ throw Exception("test_compression", "Failed in re-open");
+ }
+
+ PASSED();
+
+
+ /*----------------------------------------------------------------------
+ * STEP 6: Test partial I/O by writing to and then reading from a
+ * hyperslab of the dataset. The hyperslab does not line up on chunk
+ * boundaries (we know that case already works from above tests).
+ *----------------------------------------------------------------------
+ */
+ SUBTEST("Compression (partial I/O)");
+
+ const hsize_t hs_size[2] = {4, 50};
+ const hsize_t hs_offset[2] = {7, 30};
+ for (i = 0; i < hs_size[0]; i++) {
+ for (j = 0; j < hs_size[1]; j++) {
+ points[hs_offset[0]+i][hs_offset[1]+j] = rand ();
+ }
+ }
+ space1.selectHyperslab( H5S_SELECT_SET, hs_size, hs_offset );
+ dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, space1, space1, xfer);
+ dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, space1, space1, xfer);
+
+ // Check that the values read are the same as the values written
+ for (i=0; i<hs_size[0]; i++) {
+ for (j=0; j<hs_size[1]; j++) {
+ if (points[hs_offset[0]+i][hs_offset[1]+j] !=
+ check[hs_offset[0]+i][hs_offset[1]+j]) {
+ H5_FAILED();
+ cerr << " Read different values than written.\n" << endl;
+ cerr << " At index " << static_cast<unsigned long>((hs_offset[0]+i)) <<
+ "," << static_cast<unsigned long>((hs_offset[1]+j)) << endl;
+
+ cerr << " At original: " << static_cast<int>(points[hs_offset[0]+i][hs_offset[1]+j]) << endl;
+ cerr << " At returned: " << static_cast<int>(check[hs_offset[0]+i][hs_offset[1]+j]) << endl;
+ throw Exception("test_compression", "Failed in partial I/O");
+ }
+ } // for j
+ } // for i
+
+ delete dataset;
+ dataset = NULL;
+
+ PASSED();
#else
- SUBTEST("deflate filter");
- SKIPPED();
- cerr << not_supported << endl;
+ SUBTEST("deflate filter");
+ SKIPPED();
+ cerr << not_supported << endl;
#endif
- /*----------------------------------------------------------------------
- * STEP 7: Register an application-defined compression method and use it
- * to write and then read the dataset.
- *----------------------------------------------------------------------
- */
- SUBTEST("Compression (app-defined method)");
+ /*----------------------------------------------------------------------
+ * STEP 7: Register an application-defined compression method and use it
+ * to write and then read the dataset.
+ *----------------------------------------------------------------------
+ */
+ SUBTEST("Compression (app-defined method)");
if (H5Zregister (H5Z_BOGUS)<0)
- throw Exception("test_compression", "Failed in app-defined method");
- if (H5Pset_filter (dscreatplist.getId(), H5Z_FILTER_BOGUS, 0, 0, NULL)<0)
- throw Exception("test_compression", "Failed in app-defined method");
- dscreatplist.setFilter (H5Z_FILTER_BOGUS, 0, 0, NULL);
-
- DataSpace space2 (2, size, NULL);
- dataset = new DataSet (file.createDataSet (DSET_BOGUS_NAME, PredType::NATIVE_INT, space2, dscreatplist));
-
- dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
- dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
-
- // Check that the values read are the same as the values written
- for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- int status = check_values (i, j, points[i][j], check[i][j]);
- if (status == -1)
- throw Exception("test_compression", "Failed in app-defined method");
- }
-
- PASSED();
-
- /*----------------------------------------------------------------------
- * Cleanup
- *----------------------------------------------------------------------
- */
- delete dataset;
- delete [] tconv_buf;
- return 0;
+ throw Exception("test_compression", "Failed in app-defined method");
+ if (H5Pset_filter (dscreatplist.getId(), H5Z_FILTER_BOGUS, 0, 0, NULL)<0)
+ throw Exception("test_compression", "Failed in app-defined method");
+ dscreatplist.setFilter (H5Z_FILTER_BOGUS, 0, 0, NULL);
+
+ DataSpace space2 (2, size, NULL);
+ dataset = new DataSet (file.createDataSet (DSET_BOGUS_NAME, PredType::NATIVE_INT, space2, dscreatplist));
+
+ dataset->write (static_cast<void*>(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+ dataset->read (static_cast<void*>(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer);
+
+ // Check that the values read are the same as the values written
+ for (i = 0; i < size[0]; i++)
+ for (j = 0; j < size[1]; j++)
+ {
+ int status = check_values (i, j, points[i][j], check[i][j]);
+ if (status == -1)
+ throw Exception("test_compression", "Failed in app-defined method");
+ }
+
+ PASSED();
+
+ /*----------------------------------------------------------------------
+ * Cleanup
+ *----------------------------------------------------------------------
+ */
+ delete dataset;
+ delete [] tconv_buf;
+ return 0;
} // end try
// catch all dataset, file, space, and plist exceptions
catch (Exception& E)
{
- cerr << " FAILED" << endl;
- cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
-
- // clean up and return with failure
- if (dataset != NULL)
- delete dataset;
- if (tconv_buf)
- delete [] tconv_buf;
- return -1;
+ cerr << " FAILED" << endl;
+ cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
+
+ // clean up and return with failure
+ if (dataset != NULL)
+ delete dataset;
+ if (tconv_buf)
+ delete [] tconv_buf;
+ return -1;
}
} // test_compression
@@ -755,18 +755,18 @@ test_compression(H5File& file)
/*-------------------------------------------------------------------------
* Function: test_nbit_methods
*
- * Purpose: Tests setting nbit compression methods.
+ * Purpose Tests setting nbit compression methods.
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler
- * Friday, April 22, 2016
+ * Programmer Binh-Minh Ribler
+ * Friday, April 22, 2016
*
*-------------------------------------------------------------------------
*/
-const H5std_string DSET_NBIT_NAME("nbit_dataset");
+const H5std_string DSET_NBIT_NAME("nbit_dataset");
const hsize_t DIM1 = 2;
const hsize_t DIM2 = 5;
static herr_t test_nbit_compression(H5File& file)
@@ -787,101 +787,101 @@ static herr_t test_nbit_compression(H5File& file)
try
{
- // Define datatypes of members of compound datatype
- IntType i_type(PredType::NATIVE_INT);
- IntType c_type(PredType::NATIVE_CHAR);
- IntType s_type(PredType::NATIVE_SHORT);
-
- // Create a dataset compound datatype
- CompType cmpd(sizeof(s1_t));
- cmpd.insertMember("i", HOFFSET(s1_t, i), i_type);
- cmpd.insertMember("c", HOFFSET(s1_t, c), c_type);
- cmpd.insertMember("s", HOFFSET(s1_t, s), s_type);
-
- // Create a memory compound datatype
- CompType mem_cmpd(sizeof(s1_t));
- mem_cmpd.insertMember("i", HOFFSET(s1_t, i), i_type);
- mem_cmpd.insertMember("c", HOFFSET(s1_t, c), c_type);
- mem_cmpd.insertMember("s", HOFFSET(s1_t, s), s_type);
-
- // Set order of dataset compound datatype
- //cmpd.setOrder(H5T_ORDER_BE); only for atomic type?
-
- // Create the data space
- DataSpace space(2, size);
-
- // Use nbit filter
- DSetCreatPropList dscreat;
- dscreat.setChunk(2, chunk_size);
- dscreat.setNbit();
-
- // Create the dataset
- DataSet dataset(file.createDataSet(DSET_NBIT_NAME, cmpd, space, dscreat));
-
- // Initialize data, assuming size of long long >= size of member datatypes
- for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- orig_data[i][j].i = static_cast<int>(i * j);
- orig_data[i][j].c = static_cast<char>('a' + i);
- orig_data[i][j].s = static_cast<short>(i + j);
-
- // Some even-numbered integer values are negative
- if ((i*size[1]+j+1)%2 == 0) {
- orig_data[i][j].i = -orig_data[i][j].i;
- orig_data[i][j].s = static_cast<short>(-orig_data[i][j].s);
- }
- }
-
- // Write to the dataset
- dataset.write(static_cast<void*>(orig_data), mem_cmpd);
-
- // Read the dataset back */
- dataset.read(static_cast<void*>(new_data), mem_cmpd);
-
- // Check that the values read are the same as the values written.
- for (i = 0; i < size[0]; i++)
- for (j = 0; j < size[1]; j++)
- {
- if((new_data[i][j].i != orig_data[i][j].i) ||
- (new_data[i][j].c != orig_data[i][j].c) ||
- (new_data[i][j].s != orig_data[i][j].s))
- {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", static_cast<unsigned long>(i), static_cast<unsigned long>(j));
- }
+ // Define datatypes of members of compound datatype
+ IntType i_type(PredType::NATIVE_INT);
+ IntType c_type(PredType::NATIVE_CHAR);
+ IntType s_type(PredType::NATIVE_SHORT);
+
+ // Create a dataset compound datatype
+ CompType cmpd(sizeof(s1_t));
+ cmpd.insertMember("i", HOFFSET(s1_t, i), i_type);
+ cmpd.insertMember("c", HOFFSET(s1_t, c), c_type);
+ cmpd.insertMember("s", HOFFSET(s1_t, s), s_type);
+
+ // Create a memory compound datatype
+ CompType mem_cmpd(sizeof(s1_t));
+ mem_cmpd.insertMember("i", HOFFSET(s1_t, i), i_type);
+ mem_cmpd.insertMember("c", HOFFSET(s1_t, c), c_type);
+ mem_cmpd.insertMember("s", HOFFSET(s1_t, s), s_type);
+
+ // Set order of dataset compound datatype
+ //cmpd.setOrder(H5T_ORDER_BE); only for atomic type?
+
+ // Create the data space
+ DataSpace space(2, size);
+
+ // Use nbit filter
+ DSetCreatPropList dscreat;
+ dscreat.setChunk(2, chunk_size);
+ dscreat.setNbit();
+
+ // Create the dataset
+ DataSet dataset(file.createDataSet(DSET_NBIT_NAME, cmpd, space, dscreat));
+
+ // Initialize data, assuming size of long long >= size of member datatypes
+ for (i = 0; i < size[0]; i++)
+ for (j = 0; j < size[1]; j++)
+ {
+ orig_data[i][j].i = static_cast<int>(i * j);
+ orig_data[i][j].c = static_cast<char>('a' + i);
+ orig_data[i][j].s = static_cast<short>(i + j);
+
+ // Some even-numbered integer values are negative
+ if ((i*size[1]+j+1)%2 == 0) {
+ orig_data[i][j].i = -orig_data[i][j].i;
+ orig_data[i][j].s = static_cast<short>(-orig_data[i][j].s);
+ }
+ }
+
+ // Write to the dataset
+ dataset.write(static_cast<void*>(orig_data), mem_cmpd);
+
+ // Read the dataset back */
+ dataset.read(static_cast<void*>(new_data), mem_cmpd);
+
+ // Check that the values read are the same as the values written.
+ for (i = 0; i < size[0]; i++)
+ for (j = 0; j < size[1]; j++)
+ {
+ if((new_data[i][j].i != orig_data[i][j].i) ||
+ (new_data[i][j].c != orig_data[i][j].c) ||
+ (new_data[i][j].s != orig_data[i][j].s))
+ {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %lu,%lu\n", static_cast<unsigned long>(i), static_cast<unsigned long>(j));
+ }
}
- PASSED();
- return 0;
+ PASSED();
+ return 0;
} // end try block
// catch all dataset, file, space, and plist exceptions
catch (Exception& E)
{
- cerr << " FAILED" << endl;
- cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
+ cerr << " FAILED" << endl;
+ cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
- return -1;
+ return -1;
}
} // test_nbit_compression
/*-------------------------------------------------------------------------
- * Function: test_multiopen
+ * Function: test_multiopen
*
- * Purpose: Tests that a bug no longer exists. If a dataset is opened
- * twice and one of the handles is used to extend the dataset,
- * then the other handle should return the new size when
- * queried.
+ * Purpose Tests that a bug no longer exists. If a dataset is opened
+ * twice and one of the handles is used to extend the dataset,
+ * then the other handle should return the new size when
+ * queried.
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler (using C version)
- * Saturday, February 17, 2001
+ * Programmer Binh-Minh Ribler (using C version)
+ * Saturday, February 17, 2001
*
* Modifications:
*
@@ -896,74 +896,75 @@ test_multiopen (H5File& file)
DataSpace* space = NULL;
try {
- // Create a dataset creation property list
- DSetCreatPropList dcpl;
+ // Create a dataset creation property list
+ DSetCreatPropList dcpl;
- // Set chunk size to given size
- hsize_t cur_size[1] = {10};
- dcpl.setChunk (1, cur_size);
+ // Set chunk size to given size
+ hsize_t cur_size[1] = {10};
+ dcpl.setChunk (1, cur_size);
- // Create a simple data space with unlimited size
- hsize_t max_size[1] = {H5S_UNLIMITED};
- space = new DataSpace (1, cur_size, max_size);
+ // Create a simple data space with unlimited size
+ hsize_t max_size[1] = {H5S_UNLIMITED};
+ space = new DataSpace (1, cur_size, max_size);
- // Create first dataset
- DataSet dset1 = file.createDataSet ("multiopen", PredType::NATIVE_INT, *space, dcpl);
+ // Create first dataset
+ DataSet dset1 = file.createDataSet ("multiopen", PredType::NATIVE_INT, *space, dcpl);
- // Open again the first dataset from the file to another DataSet object.
- DataSet dset2 = file.openDataSet ("multiopen");
+ // Open again the first dataset from the file to another DataSet object.
+ DataSet dset2 = file.openDataSet ("multiopen");
- // Relieve the dataspace
- delete space;
- space = NULL;
+ // Relieve the dataspace
+ delete space;
+ space = NULL;
- // Extend the dimensionality of the first dataset
- cur_size[0] = 20;
- dset1.extend (cur_size);
+ // Extend the dimensionality of the first dataset
+ cur_size[0] = 20;
+ dset1.extend (cur_size);
- // Get the size from the second handle
- space = new DataSpace (dset2.getSpace());
+ // Get the size from the second handle
+ space = new DataSpace (dset2.getSpace());
- hsize_t tmp_size[1];
- space->getSimpleExtentDims (tmp_size);
- if (cur_size[0]!=tmp_size[0])
- {
- cerr << " Got " << static_cast<int>(tmp_size[0]) << " instead of "
- << static_cast<int>(cur_size[0]) << "!" << endl;
- throw Exception("test_multiopen", "Failed in multi-open with extending");
- }
+ hsize_t tmp_size[1];
+ space->getSimpleExtentDims (tmp_size);
+ if (cur_size[0]!=tmp_size[0])
+ {
+ cerr << " Got " << static_cast<int>(tmp_size[0])
+ << " instead of " << static_cast<int>(cur_size[0])
+ << "!" << endl;
+ throw Exception("test_multiopen", "Failed in multi-open with extending");
+ }
- // clean up and return with success
- delete space;
- PASSED();
- return 0;
+ // clean up and return with success
+ delete space;
+ PASSED();
+ return 0;
} // end try block
// catch all dataset, file, space, and plist exceptions
catch (Exception& E)
{
- cerr << " FAILED" << endl;
- cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
+ cerr << " FAILED" << endl;
+ cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
- // clean up and return with failure
- if (space != NULL)
- delete space;
- return -1;
+ // clean up and return with failure
+ if (space != NULL)
+ delete space;
+ return -1;
}
} // test_multiopen
/*-------------------------------------------------------------------------
- * Function: test_types
+ * Function: test_types
*
- * Purpose: Test various types - should be moved to dtypes.cpp
+ * Purpose Test various types - should be moved to dtypes.cpp
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler (using C version)
- * February 17, 2001
+ * Programmer Binh-Minh Ribler (using C version)
+ * February 17, 2001
*
* Modifications:
*
@@ -974,239 +975,238 @@ test_types(H5File& file)
{
SUBTEST("Various datatypes");
- size_t i;
+ size_t i;
DataSet* dset = NULL;
try {
- // Create a group in the file that was passed in from the caller
- Group grp = file.createGroup ("typetests");
-
- /* bitfield_1 */
- unsigned char buf[32];
- hsize_t nelmts = sizeof(buf);
- DataType type;
- try { // block of bitfield_1
- // test copying a predefined type
- type.copy (PredType::STD_B8LE);
-
- // Test copying a user-defined type using DataType::copy
- DataType copied_type;
- copied_type.copy(type);
-
- // Test copying a user-defined type using DataType::operator=
- DataType another_copied_type;
- another_copied_type = type;
-
- // Test copying a user-defined int type using DataType::operator=
- IntType orig_int(PredType::STD_B8LE);
- DataType generic_type;
- generic_type = orig_int;
-
- // Test copying an integer predefined type
- IntType new_int_type(PredType::STD_B8LE);
-
- // Test copying an int predefined type using DataType::operator=
- IntType another_int_type;
- another_int_type = new_int_type;
-
- DataSpace space (1, &nelmts);
- dset = new DataSet(grp.createDataSet("bitfield_1", type, space));
-
- // Fill buffer
- for (i=0; i<sizeof buf; i++)
- buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
-
- // Write data from buf using all default dataspaces and property list
- dset->write (buf, type);
-
- // no failure in bitfield_1, close this dataset
- delete dset;
- } // end try block of bitfield_1
-
- // catch exceptions thrown in try block of bitfield_1
- catch (Exception& E)
- {
- cerr << " FAILED" << endl;
- cerr << " <<< " << "bitfield_1: " << E.getFuncName()
- << " - " << E.getDetailMsg() << " >>>" << endl << endl;
- if (dset != NULL)
- delete dset;
- return -1;
- }
-
- /* bitfield_2 */
- nelmts = sizeof(buf)/2;
- try { // bitfield_2 block
- type.copy (PredType::STD_B16LE);
- DataSpace space (1, &nelmts);
- dset = new DataSet(grp.createDataSet("bitfield_2", type, space));
-
- // Fill buffer
- for (i=0; i<sizeof(buf); i++)
- buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
-
- // Write data from buf using all default dataspaces and property
- // list; if writing fails, deallocate dset and return.
- dset->write (buf, type);
-
- // no failure in bitfield_2, close this dataset and reset for
- // variable reuse
- delete dset;
- dset = NULL;
- } // end try block of bitfield_2
-
- // catch exceptions thrown in try block of bitfield_2
- catch (Exception& E)
- {
- cerr << " FAILED" << endl;
- cerr << " <<< " << "bitfield_2: " << E.getFuncName()
- << " - " << E.getDetailMsg() << " >>>" << endl << endl;
- if (dset != NULL)
- delete dset;
- throw E; // propagate the exception
- }
-
- /* opaque_1 */
- DataType* optype = NULL;
- try { // opaque_1 block
- optype = new DataType(H5T_OPAQUE, 1);
- nelmts = sizeof(buf);
- DataSpace space (1, &nelmts);
- optype->setTag ("testing 1-byte opaque type");
- dset = new DataSet(grp.createDataSet("opaque_1", *optype, space));
-
- // Fill buffer
- for (i=0; i<sizeof buf; i++)
- buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
-
- // Write data from buf using all default dataspaces and property
- // list; if writing fails, deallocate dset and return.
- dset->write (buf, *optype);
-
- // no failure in opaque_1
- delete dset; dset = NULL;
- delete optype; optype = NULL;
- } // end try block of opaque_1
-
- // catch exceptions thrown in try block of opaque_1
- catch (Exception& E)
- {
- cerr << " FAILED" << endl;
- cerr << " <<< " << "opaque_1: " << E.getFuncName()
- << " - " << E.getDetailMsg() << " >>>" << endl << endl;
- if (dset != NULL)
- delete dset;
- if (optype != NULL)
- delete optype;
- throw E; // propagate the exception
- }
-
- /* opaque_2 */
- try { // block opaque_2
- nelmts = sizeof(buf)/4;
- DataSpace space (1, &nelmts);
- optype = new DataType(H5T_OPAQUE, 4);
- optype->setTag ("testing 4-byte opaque type");
- dset = new DataSet(grp.createDataSet("opaque_2", *optype, space));
-
- // Fill buffer
- for (i=0; i<sizeof(buf); i++)
- buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
-
- // Write data from buf using all default dataspaces and property
- // list; if writing fails, deallocate dset and return.
- dset->write (buf, *optype);
-
- // no failure in opaque_1
- delete dset; dset = NULL;
- delete optype; optype = NULL;
- } //end try block of opaque_2
-
- // catch exceptions thrown in try block of opaque_2
- catch (Exception& E)
- {
- cerr << " FAILED" << endl;
- cerr << " <<< " << "opaque_2: " << E.getFuncName()
- << " - " << E.getDetailMsg() << " >>>" << endl << endl;
- if (dset != NULL)
- delete dset;
- if (optype != NULL)
- delete optype;
- throw E; // propagate the exception
- }
-
- PASSED();
- return 0;
+ // Create a group in the file that was passed in from the caller
+ Group grp = file.createGroup ("typetests");
+
+ /* bitfield_1 */
+ unsigned char buf[32];
+ hsize_t nelmts = sizeof(buf);
+ DataType type;
+ try { // block of bitfield_1
+ // test copying a predefined type
+ type.copy (PredType::STD_B8LE);
+
+ // Test copying a user-defined type using DataType::copy
+ DataType copied_type;
+ copied_type.copy(type);
+
+ // Test copying a user-defined type using DataType::operator=
+ DataType another_copied_type;
+ another_copied_type = type;
+
+ // Test copying a user-defined int type using DataType::operator=
+ IntType orig_int(PredType::STD_B8LE);
+ DataType generic_type;
+ generic_type = orig_int;
+
+ // Test copying an integer predefined type
+ IntType new_int_type(PredType::STD_B8LE);
+
+ // Test copying an int predefined type using DataType::operator=
+ IntType another_int_type;
+ another_int_type = new_int_type;
+
+ DataSpace space (1, &nelmts);
+ dset = new DataSet(grp.createDataSet("bitfield_1", type, space));
+
+ // Fill buffer
+ for (i=0; i<sizeof buf; i++)
+ buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
+
+ // Write data from buf using all default dataspaces and property list
+ dset->write (buf, type);
+
+ // no failure in bitfield_1, close this dataset
+ delete dset;
+ } // end try block of bitfield_1
+
+ // catch exceptions thrown in try block of bitfield_1
+ catch (Exception& E)
+ {
+ cerr << " FAILED" << endl;
+ cerr << " <<< " << "bitfield_1: " << E.getFuncName()
+ << " - " << E.getDetailMsg() << " >>>" << endl << endl;
+ if (dset != NULL)
+ delete dset;
+ return -1;
+ }
+
+ /* bitfield_2 */
+ nelmts = sizeof(buf)/2;
+ try { // bitfield_2 block
+ type.copy (PredType::STD_B16LE);
+ DataSpace space (1, &nelmts);
+ dset = new DataSet(grp.createDataSet("bitfield_2", type, space));
+
+ // Fill buffer
+ for (i=0; i<sizeof(buf); i++)
+ buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
+
+ // Write data from buf using all default dataspaces and property
+ // list; if writing fails, deallocate dset and return.
+ dset->write (buf, type);
+
+ // no failure in bitfield_2, close this dataset and reset for
+ // variable reuse
+ delete dset;
+ dset = NULL;
+ } // end try block of bitfield_2
+
+ // catch exceptions thrown in try block of bitfield_2
+ catch (Exception& E)
+ {
+ cerr << " FAILED" << endl;
+ cerr << " <<< " << "bitfield_2: " << E.getFuncName()
+ << " - " << E.getDetailMsg() << " >>>" << endl << endl;
+ if (dset != NULL)
+ delete dset;
+ throw E; // propagate the exception
+ }
+
+ /* opaque_1 */
+ DataType* optype = NULL;
+ try { // opaque_1 block
+ optype = new DataType(H5T_OPAQUE, 1);
+ nelmts = sizeof(buf);
+ DataSpace space (1, &nelmts);
+ optype->setTag ("testing 1-byte opaque type");
+ dset = new DataSet(grp.createDataSet("opaque_1", *optype, space));
+
+ // Fill buffer
+ for (i=0; i<sizeof buf; i++)
+ buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
+
+ // Write data from buf using all default dataspaces and property
+ // list; if writing fails, deallocate dset and return.
+ dset->write (buf, *optype);
+
+ // no failure in opaque_1
+ delete dset; dset = NULL;
+ delete optype; optype = NULL;
+ } // end try block of opaque_1
+
+ // catch exceptions thrown in try block of opaque_1
+ catch (Exception& E)
+ {
+ cerr << " FAILED" << endl;
+ cerr << " <<< " << "opaque_1: " << E.getFuncName()
+ << " - " << E.getDetailMsg() << " >>>" << endl << endl;
+ if (dset != NULL)
+ delete dset;
+ if (optype != NULL)
+ delete optype;
+ throw E; // propagate the exception
+ }
+
+ /* opaque_2 */
+ try { // block opaque_2
+ nelmts = sizeof(buf)/4;
+ DataSpace space (1, &nelmts);
+ optype = new DataType(H5T_OPAQUE, 4);
+ optype->setTag ("testing 4-byte opaque type");
+ dset = new DataSet(grp.createDataSet("opaque_2", *optype, space));
+
+ // Fill buffer
+ for (i=0; i<sizeof(buf); i++)
+ buf[i] = static_cast<unsigned char>(0xff) ^ static_cast<unsigned char>(i);
+
+ // Write data from buf using all default dataspaces and property
+ // list; if writing fails, deallocate dset and return.
+ dset->write (buf, *optype);
+
+ // no failure in opaque_1
+ delete dset; dset = NULL;
+ delete optype; optype = NULL;
+ } //end try block of opaque_2
+
+ // catch exceptions thrown in try block of opaque_2
+ catch (Exception& E)
+ {
+ cerr << " FAILED" << endl;
+ cerr << " <<< " << "opaque_2: " << E.getFuncName()
+ << " - " << E.getDetailMsg() << " >>>" << endl << endl;
+ if (dset != NULL)
+ delete dset;
+ if (optype != NULL)
+ delete optype;
+ throw E; // propagate the exception
+ }
+
+ PASSED();
+ return 0;
} // end top try block
catch (Exception& E)
{
- return -1;
+ return -1;
}
} // test_types
/*-------------------------------------------------------------------------
- * Function: test_dset
+ * Function: test_dset
*
- * Purpose: Tests the dataset interface (H5D)
+ * Purpose Tests the dataset interface (H5D)
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler (using C version)
- * Friday, January 5, 2001
+ * Programmer Binh-Minh Ribler (using C version)
+ * Friday, January 5, 2001
*
* Modifications:
- * Nov 12, 01:
- * - moved h5_cleanup to outside of try block because
- * dataset.h5 cannot be removed until "file" is out of
- * scope and dataset.h5 is closed.
- * Feb 20, 05:
- * - cleanup_dsets took care of the cleanup now.
+ * Nov 12, 01:
+ * - moved h5_cleanup to outside of try block because
+ * dataset.h5 cannot be removed until "file" is out of
+ * scope and dataset.h5 is closed.
+ * Feb 20, 05:
+ * - cleanup_dsets took care of the cleanup now.
*
*-------------------------------------------------------------------------
*/
extern "C"
void test_dset()
{
- hid_t fapl_id;
+ hid_t fapl_id;
fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
-
- int nerrors=0; // keep track of number of failures occurr
+ int nerrors=0; // keep track of number of failures occur
try
{
- // Use the file access template id to create a file access prop.
- // list object to pass in H5File::H5File
- FileAccPropList fapl(fapl_id);
+ // Use the file access template id to create a file access prop.
+ // list object to pass in H5File::H5File
+ FileAccPropList fapl(fapl_id);
- H5File file(FILE1, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ H5File file(FILE1, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
- // Cause the library to emit initial messages
- Group grp = file.createGroup( "emit diagnostics", 0);
- grp.setComment("Causes diagnostic messages to be emitted");
+ // Cause the library to emit initial messages
+ Group grp = file.createGroup( "emit diagnostics", 0);
+ grp.setComment("Causes diagnostic messages to be emitted");
- nerrors += test_create(file) < 0 ? 1:0;
- nerrors += test_simple_io(file) < 0 ? 1:0;
- nerrors += test_tconv(file) < 0 ? 1:0;
- nerrors += test_compression(file) < 0 ? 1:0;
- nerrors += test_nbit_compression(file) < 0 ? 1:0;
- nerrors += test_multiopen (file) < 0 ? 1:0;
- nerrors += test_types(file) < 0 ? 1:0;
+ nerrors += test_create(file) < 0 ? 1:0;
+ nerrors += test_simple_io(file) < 0 ? 1:0;
+ nerrors += test_tconv(file) < 0 ? 1:0;
+ nerrors += test_compression(file) < 0 ? 1:0;
+ nerrors += test_nbit_compression(file) < 0 ? 1:0;
+ nerrors += test_multiopen (file) < 0 ? 1:0;
+ nerrors += test_types(file) < 0 ? 1:0;
- // Close group "emit diagnostics".
- grp.close();
+ // Close group "emit diagnostics".
+ grp.close();
- // Close the file before testing data size.
- file.close();
+ // Close the file before testing data size.
+ file.close();
- nerrors += test_datasize(fapl) <0 ? 1:0;
+ nerrors += test_datasize(fapl) <0 ? 1:0;
}
catch (Exception& E)
{
- test_report(nerrors, H5std_string(" Dataset"));
+ test_report(nerrors, H5std_string(" Dataset"));
}
// Clean up data file
@@ -1216,11 +1216,11 @@ void test_dset()
/*-------------------------------------------------------------------------
* Function: cleanup_dsets
*
- * Purpose: Cleanup temporary test files
+ * Purpose Cleanup temporary test files
*
- * Return: none
+ * Return none
*
- * Programmer: (use C version)
+ * Programmer (use C version)
*
* Modifications:
*
diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp
index 95d29a8..cf7fc2c 100644
--- a/c++/test/h5cpputil.cpp
+++ b/c++/test/h5cpputil.cpp
@@ -37,18 +37,18 @@ using namespace H5;
#include "h5cpputil.h" // C++ utilility header file
/*-------------------------------------------------------------------------
- * Function: test_report
+ * Function: test_report
*
- * Purpose: Prints out the number of errors for the tests indicated
- * by 'testname,' if there were any failures occurred. If
- * no failure, test_report prints out the tests passed message.
+ * Purpose Prints out the number of errors for the tests indicated
+ * by 'testname,' if there were any failures occurred. If
+ * no failure, test_report prints out the tests passed message.
*
- * Return: if any failure has occurred: 1
+ * Return if any failure has occurred: 1
*
- * if no failure occurs: 0
+ * if no failure occurs: 0
*
- * Programmer: Binh-Minh Ribler (using C code segment for reporting tests)
- * Friday, February 6, 2001
+ * Programmer Binh-Minh Ribler (using C code segment for reporting tests)
+ * Friday, February 6, 2001
*
* Modifications:
*
@@ -59,12 +59,12 @@ int test_report( int nerrors, const H5std_string& testname )
if (nerrors)
{
nerrors = MAX(1, nerrors);
- if (1 == nerrors)
- cerr << "***** " << nerrors << testname
- << " TEST FAILED! *****" << endl;
- else
- cerr << "***** " << nerrors << testname
- << " TESTS FAILED! *****" << endl;
+ if (1 == nerrors)
+ cerr << "***** " << nerrors << testname
+ << " TEST FAILED! *****" << endl;
+ else
+ cerr << "***** " << nerrors << testname
+ << " TESTS FAILED! *****" << endl;
return 1;
}
else
@@ -75,68 +75,68 @@ int test_report( int nerrors, const H5std_string& testname )
}
/*-------------------------------------------------------------------------
- * Function: issue_fail_msg
+ * Function: issue_fail_msg
*
- * Purpose: Displays that a function has failed with its location.
+ * Purpose Displays that a function has failed with its location.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (copied and modified macro CHECK from C)
- * Monday, December 20, 2004
+ * Programmer Binh-Minh Ribler (copied and modified macro CHECK from C)
+ * Monday, December 20, 2004
*
*-------------------------------------------------------------------------
*/
void issue_fail_msg(const char* where, int line, const char* file_name,
- const char* message)
+ const char* message)
{
if (GetTestVerbosity()>=VERBO_HI)
{
- cerr << endl;
+ cerr << endl;
cerr << ">>> FAILED in " << where << " at line " << line
<< " in " << file_name << " - " << message << endl << endl;
}
}
/*-------------------------------------------------------------------------
- * Function: issue_fail_msg
+ * Function: issue_fail_msg
*
- * Purpose: Displays that a function has failed with its location.
+ * Purpose Displays that a function has failed with its location.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (copied and modified macro CHECK from C)
- * Monday, December 20, 2004
+ * Programmer Binh-Minh Ribler (copied and modified macro CHECK from C)
+ * Monday, December 20, 2004
*
*-------------------------------------------------------------------------
*/
void issue_fail_msg(const char* where, int line, const char* file_name,
- const char* func_name, const char* message)
+ const char* func_name, const char* message)
{
if (GetTestVerbosity()>=VERBO_HI)
{
- cerr << endl;
+ cerr << endl;
cerr << ">>> FAILED in " << where << ": " << func_name << endl <<
- " at line " << line << " in " << file_name << endl <<
- " C library detail: " << message << endl << endl;
+ " at line " << line << " in " << file_name << endl <<
+ " C library detail: " << message << endl << endl;
}
}
/*-------------------------------------------------------------------------
- * Function: check_values
+ * Function: check_values
*
- * Purpose: Checks a read value against the written value. If they are
- * different, the function will print out a message and the
- * different values. This function is made to reuse the code
- * segment that is used in various places throughout
- * the test code. Where the C version of this code segment
- * "goto error," this function will return -1.
+ * Purpose Checks a read value against the written value. If they are
+ * different, the function will print out a message and the
+ * different values. This function is made to reuse the code
+ * segment that is used in various places throughout
+ * the test code. Where the C version of this code segment
+ * "goto error," this function will return -1.
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler (using C code segment for checking values)
- * Friday, February 6, 2001
+ * Programmer Binh-Minh Ribler (using C code segment for checking values)
+ * Friday, February 6, 2001
*
* Modifications:
*
@@ -146,26 +146,26 @@ int check_values (hsize_t i, hsize_t j, int apoint, int acheck)
{
if (apoint != acheck)
{
- cerr << " Read different values than written.\n" << endl;
- cerr << " At index " << static_cast<unsigned long>(i) << "," <<
- static_cast<unsigned long>(j) << endl;
- return -1;
+ cerr << " Read different values than written.\n" << endl;
+ cerr << " At index " << static_cast<unsigned long>(i) << "," <<
+ static_cast<unsigned long>(j) << endl;
+ return -1;
}
return 0;
} // check_values
/*-------------------------------------------------------------------------
- * Function: check_values
+ * Function: check_values
*
- * Purpose: Checks a char string pointer for NULL. If it is NULL,
- * the function will print out a message
+ * Purpose Checks a char string pointer for NULL. If it is NULL,
+ * the function will print out a message
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler (using C code segment for checking values)
- * Friday, September 16, 2016
+ * Programmer Binh-Minh Ribler (using C code segment for checking values)
+ * Friday, September 16, 2016
*
*-------------------------------------------------------------------------
*/
@@ -173,26 +173,26 @@ void check_values(const char *value, const char* msg, int line, const char* file
{
if (value == NULL)
{
- cerr << endl;
+ cerr << endl;
cerr << "*** ERROR: " << msg << ", at line " << line << endl;
- IncTestNumErrs();
- throw TestFailedException(file_name, msg);
+ IncTestNumErrs();
+ throw TestFailedException(file_name, msg);
}
}
/*-------------------------------------------------------------------------
- * Function: verify_val (const char*, const char*,...)
+ * Function: verify_val (const char*, const char*,...)
*
- * Purpose: Compares two character strings. If they are
- * different, the function will print out a message and the
- * different values.
+ * Purpose Compares two character strings. If they are
+ * different, the function will print out a message and the
+ * different values.
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler
- * May 2, 2010
+ * Programmer Binh-Minh Ribler
+ * May 2, 2010
*
* Modifications:
*
@@ -225,12 +225,12 @@ InvalidActionException::InvalidActionException():Exception(){}
//--------------------------------------------------------------------------
// Function: InvalidActionException overloaded constructor
//
-// Purpose: Creates an InvalidActionException with the name of the function,
+// Purpose Creates an InvalidActionException with the name of the function,
// which the failure should have occurred but didn't, and a
-// message explaining why it should fail.
+// message explaining why it should fail.
// Parameters
-// func - IN: Name of the function where failure should occur
-// message - IN: Message
+// func - IN: Name of the function where failure should occur
+// message - IN: Message
//--------------------------------------------------------------------------
InvalidActionException::InvalidActionException(const H5std_string func, const H5std_string message) : Exception(func, message) {}
@@ -247,12 +247,12 @@ TestFailedException::TestFailedException():Exception(){}
//--------------------------------------------------------------------------
// Function: TestFailedException overloaded constructor
//
-// Purpose: Creates an TestFailedException with the name of the function,
+// Purpose Creates an TestFailedException with the name of the function,
// which the failure should have occurred but didn't, and a
-// message explaining why it should fail.
+// message explaining why it should fail.
// Parameters
-// func - IN: Name of the function where failure should occur
-// message - IN: Message
+// func - IN: Name of the function where failure should occur
+// message - IN: Message
//--------------------------------------------------------------------------
TestFailedException::TestFailedException(const H5std_string func, const H5std_string message) : Exception(func, message) {}
diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h
index f8aaec7..7f92e60 100644
--- a/c++/test/h5cpputil.h
+++ b/c++/test/h5cpputil.h
@@ -37,22 +37,22 @@ int check_values (hsize_t i, hsize_t j, int apoint, int acheck);
void check_values(const char *value, const char* msg, int line, const char* file_name);
int test_report (int, const H5std_string&);
void issue_fail_msg(const char* where, int line, const char* file_name,
- const char* message="");
+ const char* message="");
void issue_fail_msg(const char* where, int line, const char* file_name,
- const char* func_name, const char* message);
+ const char* func_name, const char* message);
class InvalidActionException : public Exception {
public:
- InvalidActionException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG);
- InvalidActionException();
- virtual ~InvalidActionException() throw();
+ InvalidActionException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG);
+ InvalidActionException();
+ virtual ~InvalidActionException() throw();
};
class TestFailedException : public Exception {
public:
- TestFailedException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG);
- TestFailedException();
- virtual ~TestFailedException() throw();
+ TestFailedException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG);
+ TestFailedException();
+ virtual ~TestFailedException() throw();
};
// Overloaded/Template functions to verify values and display proper info
@@ -65,18 +65,18 @@ template <class Type1, class Type2>
{
if (GetTestVerbosity()>=VERBO_HI)
{
- cerr << endl;
+ cerr << endl;
cerr << " Call to routine: " << where << " at line " << line
- << " in " << file_name << " had value " << x << endl;
+ << " in " << file_name << " had value " << x << endl;
}
if (x != value)
{
- cerr << endl;
+ cerr << endl;
cerr << "*** UNEXPECTED VALUE from " << where << " should be "
- << value << ", but is " << x << " at line " << line
- << " in " << file_name << endl;
- IncTestNumErrs();
- throw TestFailedException(where, "");
+ << value << ", but is " << x << " at line " << line
+ << " in " << file_name << endl;
+ IncTestNumErrs();
+ throw TestFailedException(where, "");
}
}
@@ -85,12 +85,12 @@ template <class Type1, class Type2>
{
if (x != value)
{
- cerr << endl;
+ cerr << endl;
cerr << "*** UNEXPECTED VALUE: " << file_name << ":line " << line
- << ": " << msg << " different: " << x << ", should be " << value
- << endl;
- IncTestNumErrs();
- throw TestFailedException(file_name, msg);
+ << ": " << msg << " different: " << x << ", should be " << value
+ << endl;
+ IncTestNumErrs();
+ throw TestFailedException(file_name, msg);
}
}
@@ -99,17 +99,17 @@ template <class Type1, class Type2>
{
if (GetTestVerbosity()>=VERBO_HI)
{
- cerr << endl;
+ cerr << endl;
cerr << " Call to routine: " << where << " at line " << line
- << " in " << file_name << " had value " << x << endl;
+ << " in " << file_name << " had value " << x << endl;
}
if (x == value)
{
- cerr << endl;
+ cerr << endl;
cerr << "*** UNEXPECTED VALUE from " << where << " should not be "
- << value << " at line " << line << " in " << file_name << endl;
- IncTestNumErrs();
- throw TestFailedException(where, "");
+ << value << " at line " << line << " in " << file_name << endl;
+ IncTestNumErrs();
+ throw TestFailedException(where, "");
}
}
@@ -118,10 +118,10 @@ template <class Type1, class Type2>
{
if (x == value)
{
- cerr << endl;
+ cerr << endl;
cerr << "*** Function " << msg << " FAILED at line " << line << endl;
- IncTestNumErrs();
- throw TestFailedException(file_name, msg);
+ IncTestNumErrs();
+ throw TestFailedException(file_name, msg);
}
}
@@ -130,12 +130,12 @@ template <class Type1, class Type2>
{
if (x == value)
{
- cerr << endl;
- cerr << "*** UNEXPECTED FLOAT VALUE: " << file_name << ":line " << line
- << ": " << msg << " different: " << x << ", should be " << value
- << " (epsilon=" << epsilon << ")" << endl;
- IncTestNumErrs();
- throw TestFailedException(file_name, msg);
+ cerr << endl;
+ cerr << "*** UNEXPECTED FLOAT VALUE: " << file_name << ":line " << line
+ << ": " << msg << " different: " << x << ", should be " << value
+ << " (epsilon=" << epsilon << ")" << endl;
+ IncTestNumErrs();
+ throw TestFailedException(file_name, msg);
}
}
diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp
index f10016f..490772f 100644
--- a/c++/test/tarray.cpp
+++ b/c++/test/tarray.cpp
@@ -53,12 +53,12 @@ typedef enum int_t {
/*-------------------------------------------------------------------------
* Function: test_array_compound_array
*
- * Purpose: Tests 1-D array of compound datatypes (with array fields)
+ * Purpose Tests 1-D array of compound datatypes (with array fields)
*
- * Return: None.
+ * Return None.
*
- * Programmer: Binh-Minh Ribler (using C version)
- * January, 2016
+ * Programmer Binh-Minh Ribler (using C version)
+ * January, 2016
*
* Modifications:
*
@@ -76,7 +76,7 @@ static void test_array_compound_array()
hsize_t sdims1[] = {SPACE1_DIM1};
hsize_t tdims1[] = {ARRAY1_DIM1};
int nmemb; // Number of compound members
- int ii; // counting variables
+ int ii; // counting variables
hsize_t idxi, idxj, idxk; // dimension indicing variables
H5T_class_t mclass; // Datatype class for field
@@ -85,193 +85,193 @@ static void test_array_compound_array()
for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
wdata[idxi][idxj].i = idxi * 10 + idxj;
for(idxk = 0; idxk < ARRAY1_DIM1; idxk++)
- {
+ {
float temp = idxi * 10.0 + idxj * 2.5 + idxk;
wdata[idxi][idxj].f[idxk] = temp;
- }
+ }
} // end for
try {
- // Create File
- H5File file1(FILENAME, H5F_ACC_TRUNC);
+ // Create File
+ H5File file1(FILENAME, H5F_ACC_TRUNC);
- // Create dataspace for datasets
- DataSpace space(SPACE1_RANK, sdims1, NULL);
+ // Create dataspace for datasets
+ DataSpace space(SPACE1_RANK, sdims1, NULL);
- /*
- * Create an array datatype of compounds, arrtype. Each compound
- * datatype, comptype, contains an integer and an array of floats,
- * arrfltype.
- */
+ /*
+ * Create an array datatype of compounds, arrtype. Each compound
+ * datatype, comptype, contains an integer and an array of floats,
+ * arrfltype.
+ */
- // Create a compound datatype
- CompType comptype(sizeof(s1_t));
+ // Create a compound datatype
+ CompType comptype(sizeof(s1_t));
- // Insert integer field
- comptype.insertMember("i", HOFFSET(s1_t, i), PredType::NATIVE_INT);
+ // Insert integer field
+ comptype.insertMember("i", HOFFSET(s1_t, i), PredType::NATIVE_INT);
- // Create an array of floats datatype
- ArrayType arrfltype(PredType::NATIVE_FLOAT, ARRAY1_RANK, tdims1);
+ // Create an array of floats datatype
+ ArrayType arrfltype(PredType::NATIVE_FLOAT, ARRAY1_RANK, tdims1);
- // Insert float array field
- comptype.insertMember("f", HOFFSET(s1_t, f), arrfltype);
+ // Insert float array field
+ comptype.insertMember("f", HOFFSET(s1_t, f), arrfltype);
- // Close array of floats field datatype
- arrfltype.close();
+ // Close array of floats field datatype
+ arrfltype.close();
- // Create an array datatype of the compound datatype
- ArrayType arrtype(comptype, ARRAY1_RANK, tdims1);
+ // Create an array datatype of the compound datatype
+ ArrayType arrtype(comptype, ARRAY1_RANK, tdims1);
- // Close compound datatype comptype
- comptype.close();
+ // Close compound datatype comptype
+ comptype.close();
- // Create a dataset
- DataSet dataset = file1.createDataSet("Dataset1", arrtype, space);
+ // Create a dataset
+ DataSet dataset = file1.createDataSet("Dataset1", arrtype, space);
- // Write dataset to disk
- dataset.write(wdata, arrtype);
+ // Write dataset to disk
+ dataset.write(wdata, arrtype);
- // Test opening ArrayType with opening constructor (Dec 2016)
+ // Test opening ArrayType with opening constructor (Dec 2016)
- // Commit the arrtype to give it a name
- arrtype.commit(file1, ARRAYTYPE_NAME);
+ // Commit the arrtype to give it a name
+ arrtype.commit(file1, ARRAYTYPE_NAME);
- // Close it, then re-open with the opening constructor
- arrtype.close();
- ArrayType named_type(file1, ARRAYTYPE_NAME);
+ // Close it, then re-open with the opening constructor
+ arrtype.close();
+ ArrayType named_type(file1, ARRAYTYPE_NAME);
- // Get and verify the type's name
- H5std_string type_name = named_type.getObjName();
- verify_val(type_name, ARRAYTYPE_NAME, "DataType::getObjName tests constructor", __LINE__, __FILE__);
- named_type.close();
+ // Get and verify the type's name
+ H5std_string type_name = named_type.getObjName();
+ verify_val(type_name, ARRAYTYPE_NAME, "DataType::getObjName tests constructor", __LINE__, __FILE__);
+ named_type.close();
- // Close all
- dataset.close();
- space.close();
- file1.close();
+ // Close all
+ dataset.close();
+ space.close();
+ file1.close();
- // Re-open file
- file1.openFile(FILENAME, H5F_ACC_RDONLY);
+ // Re-open file
+ file1.openFile(FILENAME, H5F_ACC_RDONLY);
- // Open the dataset
- dataset = file1.openDataSet("Dataset1");
+ // Open the dataset
+ dataset = file1.openDataSet("Dataset1");
- /*
- * Check the datatype array of compounds
- */
+ /*
+ * Check the datatype array of compounds
+ */
- // Verify that it is an array of compounds
- DataType dstype = dataset.getDataType();
- mclass = dstype.getClass();
- verify_val(mclass==H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
+ // Verify that it is an array of compounds
+ DataType dstype = dataset.getDataType();
+ mclass = dstype.getClass();
+ verify_val(mclass==H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
- dstype.close();
+ dstype.close();
- // Get the array datatype to check
- ArrayType atype_check = dataset.getArrayType();
+ // Get the array datatype to check
+ ArrayType atype_check = dataset.getArrayType();
- // Check the array rank
- int ndims = atype_check.getArrayNDims();
- verify_val(ndims, ARRAY1_RANK, "atype_check.getArrayNDims", __LINE__, __FILE__);
+ // Check the array rank
+ int ndims = atype_check.getArrayNDims();
+ verify_val(ndims, ARRAY1_RANK, "atype_check.getArrayNDims", __LINE__, __FILE__);
- // Get the array dimensions
- hsize_t rdims1[H5S_MAX_RANK];
- atype_check.getArrayDims(rdims1);
+ // Get the array dimensions
+ hsize_t rdims1[H5S_MAX_RANK];
+ atype_check.getArrayDims(rdims1);
- // Check the array dimensions
- for (ii =0; ii <ndims; ii++)
- if (rdims1[ii]!=tdims1[ii]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", ii, rdims1[ii], ii, tdims1[ii]);
+ // Check the array dimensions
+ for (ii =0; ii <ndims; ii++)
+ if (rdims1[ii]!=tdims1[ii]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", ii, rdims1[ii], ii, tdims1[ii]);
continue;
} // end if
- // Test ArrayType::ArrayType(const hid_t existing_id)
- ArrayType new_arrtype(atype_check.getId());
+ // Test ArrayType::ArrayType(const hid_t existing_id)
+ ArrayType new_arrtype(atype_check.getId());
- // Check the array rank
- ndims = new_arrtype.getArrayNDims();
- verify_val(ndims, ARRAY1_RANK, "new_arrtype.getArrayNDims", __LINE__, __FILE__);
+ // Check the array rank
+ ndims = new_arrtype.getArrayNDims();
+ verify_val(ndims, ARRAY1_RANK, "new_arrtype.getArrayNDims", __LINE__, __FILE__);
- // Get the array dimensions
- new_arrtype.getArrayDims(rdims1);
+ // Get the array dimensions
+ new_arrtype.getArrayDims(rdims1);
- // Check the array dimensions
- for (ii = 0; ii < ndims; ii++)
- if (rdims1[ii] != tdims1[ii]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n", ii, rdims1[ii], ii, tdims1[ii]);
+ // Check the array dimensions
+ for (ii = 0; ii < ndims; ii++)
+ if (rdims1[ii] != tdims1[ii]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n", ii, rdims1[ii], ii, tdims1[ii]);
continue;
} // end if
- /*
- * Check the compound datatype and the array of floats datatype
- * in the compound.
- */
- // Get the compound datatype, which is the base datatype of the
- // array datatype atype_check.
- DataType base_type = atype_check.getSuper();
- mclass = base_type.getClass();
- verify_val(mclass==H5T_COMPOUND, true, "atype_check.getClass", __LINE__, __FILE__);
-
- // Verify the compound datatype info
- CompType ctype_check(base_type.getId());
- base_type.close();
-
- // Check the number of members
- nmemb = ctype_check.getNmembers();
- verify_val(nmemb, 2, "ctype_check.getNmembers", __LINE__, __FILE__);
-
- // Check the 2nd field's name
- H5std_string field2_name = ctype_check.getMemberName(1);
- if (HDstrcmp(field2_name.c_str(),"f") != 0)
- TestErrPrintf("Compound field name doesn't match!, field2_name=%s\n",field2_name.c_str());
-
- // Get the 2nd field's datatype
- DataType f2_type = ctype_check.getMemberDataType(1);
-
- // Get the 2nd field's class, this 2nd field should have an array type
- mclass = f2_type.getClass();
- verify_val(mclass==H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
- f2_type.close();
-
- // Get the 2nd field, array of floats datatype, to check
- ArrayType f2_atype_check = ctype_check.getMemberArrayType(1);
-
- // Check the array rank
- ndims = f2_atype_check.getArrayNDims();
- verify_val(ndims, ARRAY1_RANK, "f2_atype_check.getArrayNDims", __LINE__, __FILE__);
-
- // Get the array dimensions
- HDmemset(rdims1, 0, H5S_MAX_RANK);
- f2_atype_check.getArrayDims(rdims1);
-
- // Check the array dimensions
- for (ii = 0; ii < ndims; ii++)
- if (rdims1[ii] != tdims1[ii]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n", ii, rdims1[ii], ii, tdims1[ii]);
- continue;
- } // end if
-
- // Close done datatypes
- f2_atype_check.close();
- ctype_check.close();
-
- // Read dataset from disk
- dataset.read(rdata, atype_check);
-
- // Compare data read in
- for (idxi = 0; idxi < SPACE1_DIM1; idxi++) {
- for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
- if (wdata[idxi][idxj].i != rdata[idxi][idxj].i) {
- TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n",idxi,idxj,wdata[idxi][idxj].i,idxi,idxj,rdata[idxi][idxj].i);
- continue;
- } // end if
- } // end for
- } // end for
-
- // Close all
- atype_check.close();
- dataset.close();
- file1.close();
+ /*
+ * Check the compound datatype and the array of floats datatype
+ * in the compound.
+ */
+ // Get the compound datatype, which is the base datatype of the
+ // array datatype atype_check.
+ DataType base_type = atype_check.getSuper();
+ mclass = base_type.getClass();
+ verify_val(mclass==H5T_COMPOUND, true, "atype_check.getClass", __LINE__, __FILE__);
+
+ // Verify the compound datatype info
+ CompType ctype_check(base_type.getId());
+ base_type.close();
+
+ // Check the number of members
+ nmemb = ctype_check.getNmembers();
+ verify_val(nmemb, 2, "ctype_check.getNmembers", __LINE__, __FILE__);
+
+ // Check the 2nd field's name
+ H5std_string field2_name = ctype_check.getMemberName(1);
+ if (HDstrcmp(field2_name.c_str(),"f") != 0)
+ TestErrPrintf("Compound field name doesn't match!, field2_name=%s\n",field2_name.c_str());
+
+ // Get the 2nd field's datatype
+ DataType f2_type = ctype_check.getMemberDataType(1);
+
+ // Get the 2nd field's class, this 2nd field should have an array type
+ mclass = f2_type.getClass();
+ verify_val(mclass==H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
+ f2_type.close();
+
+ // Get the 2nd field, array of floats datatype, to check
+ ArrayType f2_atype_check = ctype_check.getMemberArrayType(1);
+
+ // Check the array rank
+ ndims = f2_atype_check.getArrayNDims();
+ verify_val(ndims, ARRAY1_RANK, "f2_atype_check.getArrayNDims", __LINE__, __FILE__);
+
+ // Get the array dimensions
+ HDmemset(rdims1, 0, H5S_MAX_RANK);
+ f2_atype_check.getArrayDims(rdims1);
+
+ // Check the array dimensions
+ for (ii = 0; ii < ndims; ii++)
+ if (rdims1[ii] != tdims1[ii]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n", ii, rdims1[ii], ii, tdims1[ii]);
+ continue;
+ } // end if
+
+ // Close done datatypes
+ f2_atype_check.close();
+ ctype_check.close();
+
+ // Read dataset from disk
+ dataset.read(rdata, atype_check);
+
+ // Compare data read in
+ for (idxi = 0; idxi < SPACE1_DIM1; idxi++) {
+ for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
+ if (wdata[idxi][idxj].i != rdata[idxi][idxj].i) {
+ TestErrPrintf("Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n",idxi,idxj,wdata[idxi][idxj].i,idxi,idxj,rdata[idxi][idxj].i);
+ continue;
+ } // end if
+ } // end for
+ } // end for
+
+ // Close all
+ atype_check.close();
+ dataset.close();
+ file1.close();
PASSED();
} // end of try block
catch (Exception& E)
@@ -285,15 +285,15 @@ static void test_array_compound_array()
/*-------------------------------------------------------------------------
* Function: test_array_assignment
*
- * Purpose: Tests the operator=
+ * Purpose Tests the operator=
*
- * Return: None.
+ * Return None.
*
- * Programmer: Binh-Minh Ribler (using C version)
- * March, 2016
+ * Programmer Binh-Minh Ribler (using C version)
+ * March, 2016
*
* Description:
- * Used user's sample code in HDFFV-9562
+ * Used user's sample code in HDFFV-9562
*
* Modifications:
*
@@ -317,35 +317,35 @@ static void test_array_assignment()
SUBTEST("ArrayType::operator=");
try {
- // Create File
- H5File file1(FILENAME, H5F_ACC_TRUNC);
+ // Create File
+ H5File file1(FILENAME, H5F_ACC_TRUNC);
- // Create dataspace for datasets
- DataSpace space(SPACE1_RANK, sdims1, NULL);
+ // Create dataspace for datasets
+ DataSpace space(SPACE1_RANK, sdims1, NULL);
- /*
- * Create an array datatype of compounds, arrtype. Each compound
- * datatype, comptype, contains an integer and an array of floats,
- * arrfltype.
- */
+ /*
+ * Create an array datatype of compounds, arrtype. Each compound
+ * datatype, comptype, contains an integer and an array of floats,
+ * arrfltype.
+ */
- // Create a compound datatype
- CompType comptype(static_cast<size_t>(24));
+ // Create a compound datatype
+ CompType comptype(static_cast<size_t>(24));
- // Insert integer field
- comptype.insertMember("i", 0, PredType::NATIVE_INT);
+ // Insert integer field
+ comptype.insertMember("i", 0, PredType::NATIVE_INT);
- // Insert float array field
- comptype.insertMember("a", 4, getArr());
+ // Insert float array field
+ comptype.insertMember("a", 4, getArr());
- // Create a dataset
- DataSet dataset = file1.createDataSet("Dataset1", comptype, space);
+ // Create a dataset
+ DataSet dataset = file1.createDataSet("Dataset1", comptype, space);
- // Close all
- dataset.close();
- comptype.close();
- space.close();
- file1.close();
+ // Close all
+ dataset.close();
+ comptype.close();
+ space.close();
+ file1.close();
PASSED();
} // end of try block
@@ -359,12 +359,12 @@ static void test_array_assignment()
/*-------------------------------------------------------------------------
* Function: test_array_info
*
- * Purpose: Tests getting array information using the const methods.
+ * Purpose Tests getting array information using the const methods.
*
- * Return: None.
+ * Return None.
*
- * Programmer: Binh-Minh Ribler
- * April, 2016
+ * Programmer Binh-Minh Ribler
+ * April, 2016
*
* Modifications:
*
@@ -382,7 +382,7 @@ static void test_array_info()
hsize_t sdims1[] = {SPACE1_DIM1};
hsize_t tdims1[] = {ARRAY1_DIM1};
int nmemb; // Number of compound members
- int ii; // counting variables
+ int ii; // counting variables
hsize_t idxi, idxj, idxk; // dimension indicing variables
H5T_class_t mclass; // Datatype class for field
@@ -391,84 +391,84 @@ static void test_array_info()
for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
wdata[idxi][idxj].i = idxi * 10 + idxj;
for(idxk = 0; idxk < ARRAY1_DIM1; idxk++)
- {
+ {
float temp = idxi * 10.0 + idxj * 2.5 + idxk;
wdata[idxi][idxj].f[idxk] = temp;
- }
+ }
} // end for
try {
- // Create File
- H5File file1(FILENAME, H5F_ACC_TRUNC);
+ // Create File
+ H5File file1(FILENAME, H5F_ACC_TRUNC);
- // Create dataspace for datasets
- DataSpace space(SPACE1_RANK, sdims1, NULL);
+ // Create dataspace for datasets
+ DataSpace space(SPACE1_RANK, sdims1, NULL);
- /*
- * Create some array datatypes, then close the file.
- */
+ /*
+ * Create some array datatypes, then close the file.
+ */
- // Create an array of floats datatype
- ArrayType arrfltype(PredType::NATIVE_FLOAT, ARRAY1_RANK, tdims1);
+ // Create an array of floats datatype
+ ArrayType arrfltype(PredType::NATIVE_FLOAT, ARRAY1_RANK, tdims1);
- // Create an array datatype of the compound datatype
- ArrayType arrtype(PredType::NATIVE_UINT, ARRAY1_RANK, tdims1);
+ // Create an array datatype of the compound datatype
+ ArrayType arrtype(PredType::NATIVE_UINT, ARRAY1_RANK, tdims1);
- // Create a dataset
- DataSet dataset = file1.createDataSet("Dataset1", arrtype, space);
+ // Create a dataset
+ DataSet dataset = file1.createDataSet("Dataset1", arrtype, space);
- // Write dataset to disk
- dataset.write(wdata, arrtype);
+ // Write dataset to disk
+ dataset.write(wdata, arrtype);
- // Close array of floats field datatype
- arrfltype.close();
+ // Close array of floats field datatype
+ arrfltype.close();
- // Close all
- dataset.close();
- arrtype.close();
- space.close();
- file1.close();
+ // Close all
+ dataset.close();
+ arrtype.close();
+ space.close();
+ file1.close();
- // Re-open file
- file1.openFile(FILENAME, H5F_ACC_RDONLY);
+ // Re-open file
+ file1.openFile(FILENAME, H5F_ACC_RDONLY);
- // Open the dataset
- dataset = file1.openDataSet("Dataset1");
+ // Open the dataset
+ dataset = file1.openDataSet("Dataset1");
- /*
- * Check the datatype array of compounds
- */
+ /*
+ * Check the datatype array of compounds
+ */
- // Verify that it is an array of compounds
- DataType dstype = dataset.getDataType();
- mclass = dstype.getClass();
- verify_val(mclass==H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
+ // Verify that it is an array of compounds
+ DataType dstype = dataset.getDataType();
+ mclass = dstype.getClass();
+ verify_val(mclass==H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__);
- dstype.close();
+ dstype.close();
- { // Let atype_check go out of scope
- // Get the array datatype, declared as const
- const ArrayType atype_check = dataset.getArrayType();
+ { // Let atype_check go out of scope
+ // Get the array datatype, declared as const
+ const ArrayType atype_check = dataset.getArrayType();
- // Check the array rank with the const method
- int ndims = atype_check.getArrayNDims();
- verify_val(ndims, ARRAY1_RANK, "atype_check.getArrayNDims", __LINE__, __FILE__);
+ // Check the array rank with the const method
+ int ndims = atype_check.getArrayNDims();
+ verify_val(ndims, ARRAY1_RANK, "atype_check.getArrayNDims", __LINE__, __FILE__);
- // Get the array dimensions with the const method
- hsize_t rdims1[H5S_MAX_RANK];
- atype_check.getArrayDims(rdims1);
+ // Get the array dimensions with the const method
+ hsize_t rdims1[H5S_MAX_RANK];
+ atype_check.getArrayDims(rdims1);
- // Check the array dimensions
- for (ii =0; ii <ndims; ii++)
- if (rdims1[ii]!=tdims1[ii]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", ii, rdims1[ii], ii, tdims1[ii]);
+ // Check the array dimensions
+ for (ii =0; ii <ndims; ii++)
+ if (rdims1[ii]!=tdims1[ii]) {
+ TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", ii, rdims1[ii], ii, tdims1[ii]);
continue;
} // end if
- }
+ }
- // Close all
- dataset.close();
- file1.close();
+ // Close all
+ dataset.close();
+ file1.close();
PASSED();
} // end of try block
catch (Exception& E)
@@ -503,14 +503,14 @@ void test_array()
/*-------------------------------------------------------------------------
- * Function: cleanup_array
+ * Function: cleanup_array
*
- * Purpose: Cleanup temporary test files
+ * Purpose Cleanup temporary test files
*
- * Return: none
+ * Return none
*
- * Programmer: Binh-Minh Ribler (using C version)
- * January, 2016
+ * Programmer Binh-Minh Ribler (using C version)
+ * January, 2016
*
* Modifications:
*
diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp
index bc46d0f..0fcaf09 100644
--- a/c++/test/tattr.cpp
+++ b/c++/test/tattr.cpp
@@ -34,14 +34,14 @@ using namespace H5;
#include "h5test.h"
#include "h5cpputil.h" // C++ utilility header file
-const H5std_string FILE_BASIC("tattr_basic.h5");
-const H5std_string FILE_COMPOUND("tattr_compound.h5");
-const H5std_string FILE_SCALAR("tattr_scalar.h5");
-const H5std_string FILE_MULTI("tattr_multi.h5");
-const H5std_string FILE_DTYPE("tattr_dtype.h5");
-const H5std_string ATTR_TMP_NAME("temp_attr_name");
-const H5std_string FATTR_TMP_NAME("temp_fattr_name");
-const size_t ATTR_MAX_DIMS = 7;
+const H5std_string FILE_BASIC("tattr_basic.h5");
+const H5std_string FILE_COMPOUND("tattr_compound.h5");
+const H5std_string FILE_SCALAR("tattr_scalar.h5");
+const H5std_string FILE_MULTI("tattr_multi.h5");
+const H5std_string FILE_DTYPE("tattr_dtype.h5");
+const H5std_string ATTR_TMP_NAME("temp_attr_name");
+const H5std_string FATTR_TMP_NAME("temp_fattr_name");
+const size_t ATTR_MAX_DIMS = 7;
/* 3-D dataset with fixed dimensions */
const int SPACE1_RANK = 3;
@@ -97,7 +97,7 @@ struct attr4_struct {
const H5std_string ATTR5_NAME("Attr5");
const int ATTR5_RANK = 0;
-float attr_data5 = (float)-5.123; // Test data for 5th attribute
+float attr_data5 = (float)-5.123; // Test data for 5th attribute
/* Info for another attribute */
const H5std_string ATTR1A_NAME("Attr1_a");
@@ -121,117 +121,117 @@ static void test_attr_basic_write()
SUBTEST("Basic Attribute Writing Functions");
try {
- // Create file
- H5File fid1 (FILE_BASIC, H5F_ACC_TRUNC);
+ // Create file
+ H5File fid1 (FILE_BASIC, H5F_ACC_TRUNC);
- // Create dataspace for dataset
- DataSpace ds_space (SPACE1_RANK, dims1);
+ // Create dataspace for dataset
+ DataSpace ds_space (SPACE1_RANK, dims1);
- /*
- * Test attribute with dataset
- */
+ /*
+ * Test attribute with dataset
+ */
- // Create a dataset
- DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space);
+ // Create a dataset
+ DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space);
- // Create dataspace for attribute
- DataSpace att_space (ATTR1_RANK, dims2);
+ // Create dataspace for attribute
+ DataSpace att_space (ATTR1_RANK, dims2);
- // Create a file attribute
- Attribute file_attr2 = fid1.createAttribute (FATTR1_NAME, PredType::NATIVE_INT, att_space);
+ // Create a file attribute
+ Attribute file_attr2 = fid1.createAttribute (FATTR1_NAME, PredType::NATIVE_INT, att_space);
- // Create a file attribute
- Attribute file_attr1 = fid1.createAttribute (FATTR2_NAME, PredType::NATIVE_INT, att_space);
+ // Create a file attribute
+ Attribute file_attr1 = fid1.createAttribute (FATTR2_NAME, PredType::NATIVE_INT, att_space);
- // Create an attribute for the dataset
- Attribute ds_attr1 = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space);
+ // Create an attribute for the dataset
+ Attribute ds_attr1 = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space);
- // Try creating an attribute that already exists. This should fail
- // since two attributes cannot have the same name. If an exception
- // is not thrown for this action by createAttribute, then throw an
- // invalid action exception.
- try {
- Attribute invalid_attr = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space);
+ // Try creating an attribute that already exists. This should fail
+ // since two attributes cannot have the same name. If an exception
+ // is not thrown for this action by createAttribute, then throw an
+ // invalid action exception.
+ try {
+ Attribute invalid_attr = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space);
- // continuation here, that means no exception has been thrown
- throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset");
- }
- catch (AttributeIException& E) // catching invalid creating attribute
+ // continuation here, that means no exception has been thrown
+ throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset");
+ }
+ catch (AttributeIException& E) // catching invalid creating attribute
{} // do nothing, exception expected
- // Write attribute information
- ds_attr1.write (PredType::NATIVE_INT, attr_data1);
+ // Write attribute information
+ ds_attr1.write (PredType::NATIVE_INT, attr_data1);
- // Read attribute information immediately, without closing attribute
- ds_attr1.read (PredType::NATIVE_INT, read_data1);
+ // Read attribute information immediately, without closing attribute
+ ds_attr1.read (PredType::NATIVE_INT, read_data1);
- // Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
+ // Verify values read in
+ for(i=0; i<ATTR1_DIM1; i++)
+ if(attr_data1[i]!=read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
- // Create two more attributes for this dataset, but only write to one.
- Attribute ds_attr2 = dataset.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, att_space);
- Attribute ds_attr3 = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_INT, att_space);
+ // Create two more attributes for this dataset, but only write to one.
+ Attribute ds_attr2 = dataset.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, att_space);
+ Attribute ds_attr3 = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_INT, att_space);
- // Write attribute information
- ds_attr2.write (PredType::NATIVE_INT, attr_data1a);
+ // Write attribute information
+ ds_attr2.write (PredType::NATIVE_INT, attr_data1a);
- // Read attribute information immediately, without closing attribute
- ds_attr2.read (PredType::NATIVE_INT, read_data1);
+ // Read attribute information immediately, without closing attribute
+ ds_attr2.read (PredType::NATIVE_INT, read_data1);
- // Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1a[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1a[i],i,read_data1[i]);
+ // Verify values read in
+ for(i=0; i<ATTR1_DIM1; i++)
+ if(attr_data1a[i]!=read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1a[i],i,read_data1[i]);
- // Close both attributes
- ds_attr1.close();
- ds_attr2.close();
- ds_attr3.close();
+ // Close both attributes
+ ds_attr1.close();
+ ds_attr2.close();
+ ds_attr3.close();
- /*
- * Test attribute with group
- */
+ /*
+ * Test attribute with group
+ */
- // Create group in file fid1
- Group group = fid1.createGroup (GROUP1_NAME);
+ // Create group in file fid1
+ Group group = fid1.createGroup (GROUP1_NAME);
- // Create dataspace for attribute
- DataSpace sid3(ATTR2_RANK, dims3);
+ // Create dataspace for attribute
+ DataSpace sid3(ATTR2_RANK, dims3);
- // Create an attribute for the group
- Attribute gr_attr = group.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, sid3);
+ // Create an attribute for the group
+ Attribute gr_attr = group.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, sid3);
- // Check storage size for attribute
- hsize_t attr_size = gr_attr.getStorageSize();
- verify_val((long)attr_size, (long)(ATTR2_DIM1*ATTR2_DIM2*sizeof(int)),
- "Attribute::getStorageSize",__LINE__,__FILE__);
+ // Check storage size for attribute
+ hsize_t attr_size = gr_attr.getStorageSize();
+ verify_val((long)attr_size, (long)(ATTR2_DIM1*ATTR2_DIM2*sizeof(int)),
+ "Attribute::getStorageSize",__LINE__,__FILE__);
- // Try to create the same attribute again (should fail)
- try {
- Attribute invalid_attr = group.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, sid3);
+ // Try to create the same attribute again (should fail)
+ try {
+ Attribute invalid_attr = group.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, sid3);
// continuation here, that means no exception has been thrown
throw InvalidActionException("H5Group::createAttribute",
- "Attempting to create an existing attribute");
- }
+ "Attempting to create an existing attribute");
+ }
catch (AttributeIException& E) // catching invalid creating attribute
{} // do nothing, exception expected
- // Write attribute information
- gr_attr.write (PredType::NATIVE_INT, attr_data2);
+ // Write attribute information
+ gr_attr.write (PredType::NATIVE_INT, attr_data2);
- // Check storage size for attribute
- attr_size = gr_attr.getStorageSize();
- verify_val((long)attr_size, (long)(ATTR2_DIM1*ATTR2_DIM2*sizeof(int)),
- "Attribute::getStorageSize", __LINE__, __FILE__);
+ // Check storage size for attribute
+ attr_size = gr_attr.getStorageSize();
+ verify_val((long)attr_size, (long)(ATTR2_DIM1*ATTR2_DIM2*sizeof(int)),
+ "Attribute::getStorageSize", __LINE__, __FILE__);
- PASSED();
+ PASSED();
} // end try block
catch (Exception& E)
{
- issue_fail_msg("test_attr_basic_write()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_basic_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_attr_basic_write()
@@ -248,14 +248,14 @@ static void test_attr_basic_write()
** B. ssize_t Attribute::getName(H5std_string& attr_name, size_t buf_size)
** 1. With buffer smaller than the actual name
** 2. Same test but with retiring overloaded function
-** ssize_t Attribute::getName(size_t buf_size, H5std_string& attr_name)
+** ssize_t Attribute::getName(size_t buf_size, H5std_string& attr_name)
**
** C. H5std_string Attribute::getName()
**
** D. H5std_string Attribute::getName(size_t len)
**
** E. ssize_t Attribute::getName(H5std_string& attr_name, size_t buf_size)
-** With buffer size equals the name's length, i.e., buf_size=0
+** With buffer size equals the name's length, i.e., buf_size=0
**
****************************************************************/
static void test_attr_getname()
@@ -264,109 +264,109 @@ static void test_attr_getname()
SUBTEST("Testing all overloads of Attribute::getName");
try {
- //
- // Open the file FILE_BASIC and test getName with its attribute
- //
-
- // Open file
- H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
-
- // Check for existence of attribute FATTR1_NAME
- bool attr_exists = fid1.attrExists(FATTR1_NAME);
- if (attr_exists == false)
- throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
-
- // Open attribute
- Attribute fattr1(fid1.openAttribute(FATTR1_NAME));
-
- // A. Get attribute name with
- // ssize_t Attribute::getName(char* attr_name, size_t buf_size)
- // using different buffer sizes and verify against FATTR1_NAME (3 cases)
-
- // 1. With arbitrary buf_size that is larger than the name size
- size_t buf_size = FATTR1_NAME.length() + 10;
- char* fattr1_name = new char[buf_size+1];
- HDmemset(fattr1_name, 0, buf_size+1);
- ssize_t name_size = 0; // actual length of attribute name
- name_size = fattr1.getName(fattr1_name, buf_size+1);
- CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
- verify_val((size_t)name_size, FATTR1_NAME.length(), "Attribute::getName", __LINE__, __FILE__);
- verify_val((const char*)fattr1_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
- delete []fattr1_name;
-
- // 2. With arbitrary buf_size that is smaller than the name's length.
- // Let's try 4 first characters in the name.
- buf_size = 4;
- char short_name[5] = "File"; // to verify the read name
- fattr1_name = new char[buf_size+1];
- HDmemset(fattr1_name, 0, buf_size+1);
- name_size = fattr1.getName(fattr1_name, buf_size+1);
- CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
- verify_val((size_t)name_size, FATTR1_NAME.size(), "Attribute::getName", __LINE__, __FILE__);
- verify_val((const char*)fattr1_name, (const char*)short_name, "Attribute::getName", __LINE__, __FILE__);
- delete []fattr1_name;
-
- // 3. With a buf_size that equals the name's length.
- buf_size = FATTR1_NAME.length();
- fattr1_name = new char[buf_size+1];
- HDmemset(fattr1_name, 0, buf_size+1);
- name_size = fattr1.getName(fattr1_name, buf_size+1);
- CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
- verify_val(fattr1_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
- delete []fattr1_name;
-
- // B. Get attribute name with
- // ssize_t Attribute::getName(H5std_string& attr_name, size_t buf_size)
- // using buffer smaller than the actual name
- buf_size = 4;
- H5std_string fattr1_name2;
- name_size = fattr1.getName(fattr1_name2, buf_size);
- verify_val(fattr1_name2, "File", "Attribute::getName", __LINE__, __FILE__);
-
- // Same test as above, but with deprecated overloaded function
- // ssize_t Attribute::getName(size_t buf_size, H5std_string& attr_name)
- // using buffer smaller than the actual name
- H5std_string fattr1_name2a;
- name_size = fattr1.getName(fattr1_name2a, buf_size);
- verify_val(fattr1_name2a, "File", "Attribute::getName", __LINE__, __FILE__);
-
- // C. Get file attribute's name with
- // H5std_string Attribute::getName()
- H5std_string fattr1_name3 = fattr1.getName();
- verify_val(fattr1_name3, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
-
- //
- // D. Test getName getting part of an attribute's name using
- // H5std_string Attribute::getName(len)
- //
-
- // Open dataset DSET1_NAME
- DataSet dataset = fid1.openDataSet(DSET1_NAME);
-
- // Check for existence of attribute
- attr_exists = dataset.attrExists(ATTR1_NAME);
- if (attr_exists == false)
- throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
-
- // Open attribute
- Attribute attr1(dataset.openAttribute(ATTR1_NAME));
-
- size_t len = 4;
- H5std_string dattr_name1 = attr1.getName(len);
- verify_val(dattr_name1, "Attr", "Attribute::getName", __LINE__, __FILE__);
-
- // E. Get dataset's attribute name with
- // H5std_string Attribute::getName(H5std_string attr_name, buf_size=0)
- H5std_string dattr_name2;
- name_size = attr1.getName(dattr_name2);
- verify_val(dattr_name2, ATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
-
- PASSED();
+ //
+ // Open the file FILE_BASIC and test getName with its attribute
+ //
+
+ // Open file
+ H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
+
+ // Check for existence of attribute FATTR1_NAME
+ bool attr_exists = fid1.attrExists(FATTR1_NAME);
+ if (attr_exists == false)
+ throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
+
+ // Open attribute
+ Attribute fattr1(fid1.openAttribute(FATTR1_NAME));
+
+ // A. Get attribute name with
+ // ssize_t Attribute::getName(char* attr_name, size_t buf_size)
+ // using different buffer sizes and verify against FATTR1_NAME (3 cases)
+
+ // 1. With arbitrary buf_size that is larger than the name size
+ size_t buf_size = FATTR1_NAME.length() + 10;
+ char* fattr1_name = new char[buf_size+1];
+ HDmemset(fattr1_name, 0, buf_size+1);
+ ssize_t name_size = 0; // actual length of attribute name
+ name_size = fattr1.getName(fattr1_name, buf_size+1);
+ CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
+ verify_val((size_t)name_size, FATTR1_NAME.length(), "Attribute::getName", __LINE__, __FILE__);
+ verify_val((const char*)fattr1_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
+ delete []fattr1_name;
+
+ // 2. With arbitrary buf_size that is smaller than the name's length.
+ // Let's try 4 first characters in the name.
+ buf_size = 4;
+ char short_name[5] = "File"; // to verify the read name
+ fattr1_name = new char[buf_size+1];
+ HDmemset(fattr1_name, 0, buf_size+1);
+ name_size = fattr1.getName(fattr1_name, buf_size+1);
+ CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
+ verify_val((size_t)name_size, FATTR1_NAME.size(), "Attribute::getName", __LINE__, __FILE__);
+ verify_val((const char*)fattr1_name, (const char*)short_name, "Attribute::getName", __LINE__, __FILE__);
+ delete []fattr1_name;
+
+ // 3. With a buf_size that equals the name's length.
+ buf_size = FATTR1_NAME.length();
+ fattr1_name = new char[buf_size+1];
+ HDmemset(fattr1_name, 0, buf_size+1);
+ name_size = fattr1.getName(fattr1_name, buf_size+1);
+ CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
+ verify_val(fattr1_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
+ delete []fattr1_name;
+
+ // B. Get attribute name with
+ // ssize_t Attribute::getName(H5std_string& attr_name, size_t buf_size)
+ // using buffer smaller than the actual name
+ buf_size = 4;
+ H5std_string fattr1_name2;
+ name_size = fattr1.getName(fattr1_name2, buf_size);
+ verify_val(fattr1_name2, "File", "Attribute::getName", __LINE__, __FILE__);
+
+ // Same test as above, but with deprecated overloaded function
+ // ssize_t Attribute::getName(size_t buf_size, H5std_string& attr_name)
+ // using buffer smaller than the actual name
+ H5std_string fattr1_name2a;
+ name_size = fattr1.getName(fattr1_name2a, buf_size);
+ verify_val(fattr1_name2a, "File", "Attribute::getName", __LINE__, __FILE__);
+
+ // C. Get file attribute's name with
+ // H5std_string Attribute::getName()
+ H5std_string fattr1_name3 = fattr1.getName();
+ verify_val(fattr1_name3, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
+
+ //
+ // D. Test getName getting part of an attribute's name using
+ // H5std_string Attribute::getName(len)
+ //
+
+ // Open dataset DSET1_NAME
+ DataSet dataset = fid1.openDataSet(DSET1_NAME);
+
+ // Check for existence of attribute
+ attr_exists = dataset.attrExists(ATTR1_NAME);
+ if (attr_exists == false)
+ throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
+
+ // Open attribute
+ Attribute attr1(dataset.openAttribute(ATTR1_NAME));
+
+ size_t len = 4;
+ H5std_string dattr_name1 = attr1.getName(len);
+ verify_val(dattr_name1, "Attr", "Attribute::getName", __LINE__, __FILE__);
+
+ // E. Get dataset's attribute name with
+ // H5std_string Attribute::getName(H5std_string attr_name, buf_size=0)
+ H5std_string dattr_name2;
+ name_size = attr1.getName(dattr_name2);
+ verify_val(dattr_name2, ATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
+
+ PASSED();
} // end try block
catch (Exception& E)
{
- issue_fail_msg("test_attr_getname()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_getname()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_attr_getname()
@@ -384,100 +384,100 @@ static void test_attr_rename()
SUBTEST("Checking for Existence and Renaming Attribute");
try {
- // Open file
- H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
+ // Open file
+ H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
- // Check and rename attribute belonging to a file
+ // Check and rename attribute belonging to a file
- // Check for existence of attribute
- bool attr_exists = fid1.attrExists(FATTR1_NAME);
- if (attr_exists == false)
- throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
+ // Check for existence of attribute
+ bool attr_exists = fid1.attrExists(FATTR1_NAME);
+ if (attr_exists == false)
+ throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
- // Change attribute name
- fid1.renameAttr(FATTR1_NAME, FATTR_TMP_NAME);
+ // Change attribute name
+ fid1.renameAttr(FATTR1_NAME, FATTR_TMP_NAME);
- // Open attribute again
- Attribute fattr1(fid1.openAttribute(FATTR_TMP_NAME));
+ // Open attribute again
+ Attribute fattr1(fid1.openAttribute(FATTR_TMP_NAME));
- // Verify new attribute name
- H5std_string fattr_name = fattr1.getName();
- verify_val(fattr_name, FATTR_TMP_NAME, "Attribute::getName", __LINE__, __FILE__);
+ // Verify new attribute name
+ H5std_string fattr_name = fattr1.getName();
+ verify_val(fattr_name, FATTR_TMP_NAME, "Attribute::getName", __LINE__, __FILE__);
- int num_attrs = fid1.getNumAttrs();
- verify_val(num_attrs, 2, "Attribute::getNumAttrs", __LINE__, __FILE__);
+ int num_attrs = fid1.getNumAttrs();
+ verify_val(num_attrs, 2, "Attribute::getNumAttrs", __LINE__, __FILE__);
- // Change first file attribute back to the original name
- fid1.renameAttr(FATTR_TMP_NAME, FATTR1_NAME);
+ // Change first file attribute back to the original name
+ fid1.renameAttr(FATTR_TMP_NAME, FATTR1_NAME);
- // Open the dataset
- DataSet dataset = fid1.openDataSet(DSET1_NAME);
+ // Open the dataset
+ DataSet dataset = fid1.openDataSet(DSET1_NAME);
- // Check and rename attribute belonging to a dataset
+ // Check and rename attribute belonging to a dataset
- // Check for existence of attribute
- attr_exists = dataset.attrExists(ATTR1_NAME);
- if (attr_exists == false)
- throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
+ // Check for existence of attribute
+ attr_exists = dataset.attrExists(ATTR1_NAME);
+ if (attr_exists == false)
+ throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
- // Change attribute name
- dataset.renameAttr(ATTR1_NAME, ATTR_TMP_NAME);
+ // Change attribute name
+ dataset.renameAttr(ATTR1_NAME, ATTR_TMP_NAME);
- // Open attribute again
- Attribute attr1(dataset.openAttribute(ATTR_TMP_NAME));
+ // Open attribute again
+ Attribute attr1(dataset.openAttribute(ATTR_TMP_NAME));
- // Verify new attribute name
- H5std_string attr_name = attr1.getName();
- verify_val(attr_name, ATTR_TMP_NAME, "Attribute::getName", __LINE__, __FILE__);
+ // Verify new attribute name
+ H5std_string attr_name = attr1.getName();
+ verify_val(attr_name, ATTR_TMP_NAME, "Attribute::getName", __LINE__, __FILE__);
- // Read attribute information immediately, without closing attribute
- attr1.read (PredType::NATIVE_INT, read_data1);
+ // Read attribute information immediately, without closing attribute
+ attr1.read (PredType::NATIVE_INT, read_data1);
- // Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
+ // Verify values read in
+ for(i=0; i<ATTR1_DIM1; i++)
+ if(attr_data1[i]!=read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
- // Close attribute
- attr1.close();
+ // Close attribute
+ attr1.close();
- // Check for existence of second attribute
- attr_exists = dataset.attrExists(ATTR2_NAME);
- if (attr_exists == false)
- throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
+ // Check for existence of second attribute
+ attr_exists = dataset.attrExists(ATTR2_NAME);
+ if (attr_exists == false)
+ throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
- // Open the second attribute
- Attribute attr2(dataset.openAttribute(ATTR2_NAME));
+ // Open the second attribute
+ Attribute attr2(dataset.openAttribute(ATTR2_NAME));
- // Verify second attribute name
- H5std_string attr2_name = attr2.getName();
- verify_val(attr2_name, ATTR2_NAME, "Attribute::getName", __LINE__, __FILE__);
+ // Verify second attribute name
+ H5std_string attr2_name = attr2.getName();
+ verify_val(attr2_name, ATTR2_NAME, "Attribute::getName", __LINE__, __FILE__);
- // Read attribute information immediately, without closing attribute
- attr2.read (PredType::NATIVE_INT, read_data1);
+ // Read attribute information immediately, without closing attribute
+ attr2.read (PredType::NATIVE_INT, read_data1);
- // Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1a[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1a[i],i,read_data1[i]);
+ // Verify values read in
+ for(i=0; i<ATTR1_DIM1; i++)
+ if(attr_data1a[i]!=read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1a[i],i,read_data1[i]);
- // Close attribute
- attr2.close();
+ // Close attribute
+ attr2.close();
- // Change first attribute back to the original name
- dataset.renameAttr(ATTR_TMP_NAME, ATTR1_NAME);
+ // Change first attribute back to the original name
+ dataset.renameAttr(ATTR_TMP_NAME, ATTR1_NAME);
- // Check for existence of attribute after renaming
- attr_exists = dataset.attrExists(ATTR1_NAME);
- if (attr_exists == false)
- throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
+ // Check for existence of attribute after renaming
+ attr_exists = dataset.attrExists(ATTR1_NAME);
+ if (attr_exists == false)
+ throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not");
- PASSED();
+ PASSED();
} // end try block
catch (Exception& E)
{
- issue_fail_msg("test_attr_rename()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_rename()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_attr_rename()
@@ -494,59 +494,59 @@ static void test_attr_basic_read()
SUBTEST("Basic Attribute Reading Functions");
try {
- // Open file
- H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
+ // Open file
+ H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
- // Open the dataset
- DataSet dataset = fid1.openDataSet(DSET1_NAME);
+ // Open the dataset
+ DataSet dataset = fid1.openDataSet(DSET1_NAME);
- // Verify the correct number of attributes
- int num_attrs = dataset.getNumAttrs();
- verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__);
+ // Verify the correct number of attributes
+ int num_attrs = dataset.getNumAttrs();
+ verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__);
- // Open an attribute for the dataset
- Attribute ds_attr=dataset.openAttribute(ATTR1_NAME);
+ // Open an attribute for the dataset
+ Attribute ds_attr=dataset.openAttribute(ATTR1_NAME);
- // Read attribute information
- int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute
- ds_attr.read(PredType::NATIVE_INT, &read_data1);
+ // Read attribute information
+ int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute
+ ds_attr.read(PredType::NATIVE_INT, &read_data1);
- // Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
+ // Verify values read in
+ for(i=0; i<ATTR1_DIM1; i++)
if(attr_data1[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
- /*
- * Test attribute with group
- */
- // Open the group
- Group group = fid1.openGroup(GROUP1_NAME);
+ /*
+ * Test attribute with group
+ */
+ // Open the group
+ Group group = fid1.openGroup(GROUP1_NAME);
- // Verify the correct number of attributes
- num_attrs = group.getNumAttrs();
- verify_val(num_attrs, 1, "H5Group::getNumAttrs", __LINE__, __FILE__);
+ // Verify the correct number of attributes
+ num_attrs = group.getNumAttrs();
+ verify_val(num_attrs, 1, "H5Group::getNumAttrs", __LINE__, __FILE__);
- // Open an attribute for the group
- Attribute gr_attr = group.openAttribute(ATTR2_NAME);
+ // Open an attribute for the group
+ Attribute gr_attr = group.openAttribute(ATTR2_NAME);
- // Buffer for reading 2nd attribute
- int read_data2[ATTR2_DIM1][ATTR2_DIM2]={{0}};
+ // Buffer for reading 2nd attribute
+ int read_data2[ATTR2_DIM1][ATTR2_DIM2]={{0}};
- // Read attribute information
- gr_attr.read(PredType::NATIVE_INT, read_data2);
+ // Read attribute information
+ gr_attr.read(PredType::NATIVE_INT, read_data2);
- // Verify values read in
- for(i=0; i<ATTR2_DIM1; i++)
+ // Verify values read in
+ for(i=0; i<ATTR2_DIM1; i++)
for(j=0; j<ATTR2_DIM2; j++)
- if(attr_data2[i][j]!=read_data2[i][j]) {
- TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",__LINE__, i,j,attr_data2[i][j],i,j,read_data2[i][j]);
- }
- PASSED();
+ if(attr_data2[i][j]!=read_data2[i][j]) {
+ TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",__LINE__, i,j,attr_data2[i][j],i,j,read_data2[i][j]);
+ }
+ PASSED();
} // end try block
catch (Exception& E)
{
- issue_fail_msg("test_attr_basic_read()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_basic_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_attr_basic_read()
@@ -558,55 +558,55 @@ static void test_attr_basic_read()
static void test_attr_compound_write()
{
- // Output message about test being performed
+ // Output message about test being performed
SUBTEST("Multiple Attribute Functions");
try {
- // Create file
- H5File fid1(FILE_COMPOUND.c_str(), H5F_ACC_TRUNC);
+ // Create file
+ H5File fid1(FILE_COMPOUND.c_str(), H5F_ACC_TRUNC);
- // Create dataspace for dataset
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- DataSpace sid1(SPACE1_RANK, dims1);
+ // Create dataspace for dataset
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ DataSpace sid1(SPACE1_RANK, dims1);
- // Create a dataset
- DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR,sid1);
+ // Create a dataset
+ DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR,sid1);
- // Create the attribute datatype.
- CompType comp_type(sizeof(struct attr4_struct));
+ // Create the attribute datatype.
+ CompType comp_type(sizeof(struct attr4_struct));
- attr4_field1_off = HOFFSET(struct attr4_struct, i);
- comp_type.insertMember(ATTR4_FIELDNAME1, attr4_field1_off, PredType::NATIVE_INT);
+ attr4_field1_off = HOFFSET(struct attr4_struct, i);
+ comp_type.insertMember(ATTR4_FIELDNAME1, attr4_field1_off, PredType::NATIVE_INT);
- attr4_field2_off = HOFFSET(struct attr4_struct, d);
- comp_type.insertMember(ATTR4_FIELDNAME2, attr4_field2_off, PredType::NATIVE_DOUBLE);
+ attr4_field2_off = HOFFSET(struct attr4_struct, d);
+ comp_type.insertMember(ATTR4_FIELDNAME2, attr4_field2_off, PredType::NATIVE_DOUBLE);
- attr4_field3_off = HOFFSET(struct attr4_struct, c);
- comp_type.insertMember(ATTR4_FIELDNAME3, attr4_field3_off, PredType::NATIVE_SCHAR);
+ attr4_field3_off = HOFFSET(struct attr4_struct, c);
+ comp_type.insertMember(ATTR4_FIELDNAME3, attr4_field3_off, PredType::NATIVE_SCHAR);
- // Create dataspace for 1st attribute
- hsize_t dims2[] = {ATTR4_DIM1,ATTR4_DIM2};
- DataSpace sid2(ATTR4_RANK, dims2);
+ // Create dataspace for 1st attribute
+ hsize_t dims2[] = {ATTR4_DIM1,ATTR4_DIM2};
+ DataSpace sid2(ATTR4_RANK, dims2);
- // Create complex attribute for the dataset
- Attribute attr = dataset.createAttribute(ATTR4_NAME, comp_type, sid2);
+ // Create complex attribute for the dataset
+ Attribute attr = dataset.createAttribute(ATTR4_NAME, comp_type, sid2);
- // Try to create the same attribute again (should fail)
- try {
- Attribute invalid_attr = dataset.createAttribute (ATTR4_NAME, comp_type, sid2);
- }
+ // Try to create the same attribute again (should fail)
+ try {
+ Attribute invalid_attr = dataset.createAttribute (ATTR4_NAME, comp_type, sid2);
+ }
catch (AttributeIException& E) // catching invalid creating attribute
{} // do nothing, exception expected
- // Write complex attribute data
- attr.write(comp_type, attr_data4);
+ // Write complex attribute data
+ attr.write(comp_type, attr_data4);
- PASSED();
+ PASSED();
} // end try block
catch (Exception& E)
{
- issue_fail_msg("test_attr_compound_write()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_compound_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_attr_compound_write()
@@ -617,7 +617,7 @@ static void test_attr_compound_write()
****************************************************************/
static void test_attr_compound_read()
{
- hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions
+ hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions
size_t size; // Attribute datatype size as stored in file
size_t offset; // Attribute datatype field offset
struct attr4_struct read_data4[ATTR4_DIM1][ATTR4_DIM2]; // Buffer for reading 4th attribute
@@ -626,139 +626,139 @@ static void test_attr_compound_read()
SUBTEST("Basic Attribute Functions");
try {
- // Open file
- H5File fid1(FILE_COMPOUND, H5F_ACC_RDWR);
+ // Open file
+ H5File fid1(FILE_COMPOUND, H5F_ACC_RDWR);
- // Open the dataset
- DataSet dataset = fid1.openDataSet(DSET1_NAME);
+ // Open the dataset
+ DataSet dataset = fid1.openDataSet(DSET1_NAME);
- // Verify the correct number of attributes
- int num_attrs = dataset.getNumAttrs();
- verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__);
+ // Verify the correct number of attributes
+ int num_attrs = dataset.getNumAttrs();
+ verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__);
- // Open 1st attribute for the dataset
- Attribute attr = dataset.openAttribute((unsigned)0);
+ // Open 1st attribute for the dataset
+ Attribute attr = dataset.openAttribute((unsigned)0);
- /* Verify Dataspace */
+ /* Verify Dataspace */
- // Get the dataspace of the attribute
- DataSpace space = attr.getSpace();
+ // Get the dataspace of the attribute
+ DataSpace space = attr.getSpace();
- // Get the rank of the dataspace and verify it
- int rank = space.getSimpleExtentNdims();
- verify_val(rank, ATTR4_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+ // Get the rank of the dataspace and verify it
+ int rank = space.getSimpleExtentNdims();
+ verify_val(rank, ATTR4_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
- // Get the dims of the dataspace and verify them
- int ndims = space.getSimpleExtentDims(dims);
- verify_val(ndims, ATTR4_RANK, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ // Get the dims of the dataspace and verify them
+ int ndims = space.getSimpleExtentDims(dims);
+ verify_val(ndims, ATTR4_RANK, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
verify_val((long)dims[0], (long)ATTR4_DIM1, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__);
verify_val((long)dims[1], (long)ATTR4_DIM2, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__);
- // Get the class of the datatype that is used by attr
- H5T_class_t type_class = attr.getTypeClass();
+ // Get the class of the datatype that is used by attr
+ H5T_class_t type_class = attr.getTypeClass();
- // Verify that the type is of compound datatype
- verify_val(type_class, H5T_COMPOUND, "Attribute::getTypeClass", __LINE__, __FILE__);
+ // Verify that the type is of compound datatype
+ verify_val(type_class, H5T_COMPOUND, "Attribute::getTypeClass", __LINE__, __FILE__);
- // Get the compound datatype
- CompType datatype = attr.getCompType();
+ // Get the compound datatype
+ CompType datatype = attr.getCompType();
- // Verify the number of fields in the datatype, which must be 3
- int fields = datatype.getNmembers();
- verify_val(fields, 3, "CompType::getNmembers", __LINE__, __FILE__);
+ // Verify the number of fields in the datatype, which must be 3
+ int fields = datatype.getNmembers();
+ verify_val(fields, 3, "CompType::getNmembers", __LINE__, __FILE__);
- // Verify that the fields have the same names as when the type
- // was created
- int j;
- for(j=0; j<fields; j++)
- {
- H5std_string fieldname = datatype.getMemberName(j);
- if(!((fieldname == ATTR4_FIELDNAME1) ||
- (fieldname == ATTR4_FIELDNAME2) ||
- (fieldname == ATTR4_FIELDNAME3)))
+ // Verify that the fields have the same names as when the type
+ // was created
+ int j;
+ for(j=0; j<fields; j++)
+ {
+ H5std_string fieldname = datatype.getMemberName(j);
+ if(!((fieldname == ATTR4_FIELDNAME1) ||
+ (fieldname == ATTR4_FIELDNAME2) ||
+ (fieldname == ATTR4_FIELDNAME3)))
TestErrPrintf("%d:invalid field name for field #%d: %s\n",__LINE__,j,fieldname.c_str());
- } /* end for */
-
- offset = datatype.getMemberOffset(0);
- verify_val(offset, attr4_field1_off, "DataType::getMemberOffset", __LINE__, __FILE__);
-
- offset = datatype.getMemberOffset(1);
- verify_val(offset, attr4_field2_off, "DataType::getMemberOffset", __LINE__, __FILE__);
-
- offset = datatype.getMemberOffset(2);
- verify_val(offset, attr4_field3_off, "DataType::getMemberOffset", __LINE__, __FILE__);
-
- /* Verify each field's type, class & size */
-
- // Get and verify the type class of the first member
- type_class = datatype.getMemberClass(0);
- verify_val(type_class, H5T_INTEGER, "DataType::getMemberClass", __LINE__, __FILE__);
- // Get and verify the order of this member's type
- IntType i_type = datatype.getMemberIntType(0);
- H5T_order_t order = i_type.getOrder();
- verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
-
- // Get and verify the size of this member's type
- size = i_type.getSize();
- verify_val(size, PredType::NATIVE_INT.getSize(), "DataType::getSize", __LINE__, __FILE__);
-
- // Get and verify class, order, and size of the second member's type
- type_class = datatype.getMemberClass(1);
- verify_val(type_class, H5T_FLOAT, "DataType::getMemberClass", __LINE__, __FILE__);
- FloatType f_type = datatype.getMemberFloatType(1);
- order = f_type.getOrder();
- verify_val(order, PredType::NATIVE_DOUBLE.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
- size = f_type.getSize();
- verify_val(size, PredType::NATIVE_DOUBLE.getSize(), "DataType::getSize", __LINE__, __FILE__);
-
- // Get and verify class, order, and size of the third member's type
- type_class = datatype.getMemberClass(2);
- verify_val(type_class, H5T_INTEGER, "DataType::getMemberClass", __LINE__, __FILE__);
- // Note: H5T_INTEGER is correct here!
-
- StrType s_type = datatype.getMemberStrType(2);
- order = s_type.getOrder();
- verify_val(order, PredType::NATIVE_SCHAR.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
- size = s_type.getSize();
- verify_val(size, PredType::NATIVE_SCHAR.getSize(), "DataType::getSize", __LINE__, __FILE__);
-
- // Read attribute information
- attr.read(datatype, read_data4);
-
- // Verify values read in
- hsize_t ii, jj;
- for(ii=0; ii<ATTR4_DIM1; ii++)
- for(jj=0; jj<ATTR4_DIM2; jj++)
- if(HDmemcmp(&attr_data4[ii][jj],&read_data4[ii][jj],sizeof(struct attr4_struct))) {
- TestErrPrintf("%d:attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n",__LINE__,ii,jj,attr_data4[ii][jj].i,ii,jj,read_data4[ii][jj].i);
- TestErrPrintf("%d:attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n",__LINE__,ii,jj,attr_data4[ii][jj].d,ii,jj,read_data4[ii][jj].d);
- TestErrPrintf("%d:attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n",__LINE__,ii,jj,attr_data4[ii][jj].c,ii,jj,read_data4[ii][jj].c);
+ } /* end for */
+
+ offset = datatype.getMemberOffset(0);
+ verify_val(offset, attr4_field1_off, "DataType::getMemberOffset", __LINE__, __FILE__);
+
+ offset = datatype.getMemberOffset(1);
+ verify_val(offset, attr4_field2_off, "DataType::getMemberOffset", __LINE__, __FILE__);
+
+ offset = datatype.getMemberOffset(2);
+ verify_val(offset, attr4_field3_off, "DataType::getMemberOffset", __LINE__, __FILE__);
+
+ /* Verify each field's type, class & size */
+
+ // Get and verify the type class of the first member
+ type_class = datatype.getMemberClass(0);
+ verify_val(type_class, H5T_INTEGER, "DataType::getMemberClass", __LINE__, __FILE__);
+ // Get and verify the order of this member's type
+ IntType i_type = datatype.getMemberIntType(0);
+ H5T_order_t order = i_type.getOrder();
+ verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
+
+ // Get and verify the size of this member's type
+ size = i_type.getSize();
+ verify_val(size, PredType::NATIVE_INT.getSize(), "DataType::getSize", __LINE__, __FILE__);
+
+ // Get and verify class, order, and size of the second member's type
+ type_class = datatype.getMemberClass(1);
+ verify_val(type_class, H5T_FLOAT, "DataType::getMemberClass", __LINE__, __FILE__);
+ FloatType f_type = datatype.getMemberFloatType(1);
+ order = f_type.getOrder();
+ verify_val(order, PredType::NATIVE_DOUBLE.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
+ size = f_type.getSize();
+ verify_val(size, PredType::NATIVE_DOUBLE.getSize(), "DataType::getSize", __LINE__, __FILE__);
+
+ // Get and verify class, order, and size of the third member's type
+ type_class = datatype.getMemberClass(2);
+ verify_val(type_class, H5T_INTEGER, "DataType::getMemberClass", __LINE__, __FILE__);
+ // Note: H5T_INTEGER is correct here!
+
+ StrType s_type = datatype.getMemberStrType(2);
+ order = s_type.getOrder();
+ verify_val(order, PredType::NATIVE_SCHAR.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
+ size = s_type.getSize();
+ verify_val(size, PredType::NATIVE_SCHAR.getSize(), "DataType::getSize", __LINE__, __FILE__);
+
+ // Read attribute information
+ attr.read(datatype, read_data4);
+
+ // Verify values read in
+ hsize_t ii, jj;
+ for(ii=0; ii<ATTR4_DIM1; ii++)
+ for(jj=0; jj<ATTR4_DIM2; jj++)
+ if(HDmemcmp(&attr_data4[ii][jj],&read_data4[ii][jj],sizeof(struct attr4_struct))) {
+ TestErrPrintf("%d:attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n",__LINE__,ii,jj,attr_data4[ii][jj].i,ii,jj,read_data4[ii][jj].i);
+ TestErrPrintf("%d:attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n",__LINE__,ii,jj,attr_data4[ii][jj].d,ii,jj,read_data4[ii][jj].d);
+ TestErrPrintf("%d:attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n",__LINE__,ii,jj,attr_data4[ii][jj].c,ii,jj,read_data4[ii][jj].c);
} /* end if */
- // Verify name
- H5std_string attr_name = attr.getName();
- verify_val(attr_name, ATTR4_NAME, "Attribute::getName", __LINE__, __FILE__);
+ // Verify name
+ H5std_string attr_name = attr.getName();
+ verify_val(attr_name, ATTR4_NAME, "Attribute::getName", __LINE__, __FILE__);
} // end try block
catch (Exception& E)
{
- issue_fail_msg("test_attr_compound_read()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_compound_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
try
{
- // Now, try truncating the file to make sure reference counting is good.
- // If any references to ids in the previous block are left unterminated,
- // the truncating will fail, because the file will not be closed in
- // the file.close() above.
- H5File file1(FILE_COMPOUND, H5F_ACC_TRUNC);
+ // Now, try truncating the file to make sure reference counting is good.
+ // If any references to ids in the previous block are left unterminated,
+ // the truncating will fail, because the file will not be closed in
+ // the file.close() above.
+ H5File file1(FILE_COMPOUND, H5F_ACC_TRUNC);
- PASSED();
+ PASSED();
} // end try block
catch (FileIException& E)
{
- issue_fail_msg("test_attr_compound_read()", __LINE__, __FILE__, "Unable to truncate file, possibly because some objects are left opened");
+ issue_fail_msg("test_attr_compound_read()", __LINE__, __FILE__, "Unable to truncate file, possibly because some objects are left opened");
}
} // test_attr_compound_read()
@@ -773,47 +773,47 @@ static void test_attr_scalar_write()
SUBTEST("Basic Scalar Attribute Writing Functions");
try {
- // Create file
- H5File fid1(FILE_SCALAR, H5F_ACC_TRUNC);
+ // Create file
+ H5File fid1(FILE_SCALAR, H5F_ACC_TRUNC);
- // Create dataspace for dataset
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- DataSpace sid1(SPACE1_RANK, dims1);
+ // Create dataspace for dataset
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ DataSpace sid1(SPACE1_RANK, dims1);
- // Create a dataset
- DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR,sid1);
+ // Create a dataset
+ DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR,sid1);
- // Close dataset's dataspace
- sid1.close();
+ // Close dataset's dataspace
+ sid1.close();
- // Create dataspace for attribute
- DataSpace att_space(ATTR5_RANK, NULL);
+ // Create dataspace for attribute
+ DataSpace att_space(ATTR5_RANK, NULL);
- // Create an attribute for the dataset
- Attribute ds_attr = dataset.createAttribute (ATTR5_NAME, PredType::NATIVE_FLOAT, att_space);
+ // Create an attribute for the dataset
+ Attribute ds_attr = dataset.createAttribute (ATTR5_NAME, PredType::NATIVE_FLOAT, att_space);
- // Try creating an attribute that already exists. This should fail
- // since two attributes cannot have the same name. If an exception
- // is not thrown for this action by createAttribute, then throw an
- // invalid action exception.
- try {
- Attribute invalid_attr = dataset.createAttribute (ATTR5_NAME, PredType::NATIVE_FLOAT, att_space);
+ // Try creating an attribute that already exists. This should fail
+ // since two attributes cannot have the same name. If an exception
+ // is not thrown for this action by createAttribute, then throw an
+ // invalid action exception.
+ try {
+ Attribute invalid_attr = dataset.createAttribute (ATTR5_NAME, PredType::NATIVE_FLOAT, att_space);
- // continuation here, that means no exception has been thrown
- throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset");
- }
- catch (AttributeIException& E) // catching invalid creating attribute
+ // continuation here, that means no exception has been thrown
+ throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset");
+ }
+ catch (AttributeIException& E) // catching invalid creating attribute
{} // do nothing, exception expected
- // Write attribute information
- ds_attr.write (PredType::NATIVE_FLOAT, &attr_data5);
+ // Write attribute information
+ ds_attr.write (PredType::NATIVE_FLOAT, &attr_data5);
- PASSED();
+ PASSED();
} // end try block
catch (Exception& E)
{
- issue_fail_msg("test_attr_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_attr_scalar_write()
@@ -831,38 +831,38 @@ static void test_attr_scalar_read()
SUBTEST("Basic Scalar Attribute Reading Functions");
try {
- // Open file
- H5File fid1(FILE_SCALAR, H5F_ACC_RDWR);
+ // Open file
+ H5File fid1(FILE_SCALAR, H5F_ACC_RDWR);
- // Open the dataset
- DataSet dataset = fid1.openDataSet(DSET1_NAME);
+ // Open the dataset
+ DataSet dataset = fid1.openDataSet(DSET1_NAME);
- // Verify the correct number of attributes
- int num_attrs = dataset.getNumAttrs();
- verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__);
+ // Verify the correct number of attributes
+ int num_attrs = dataset.getNumAttrs();
+ verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__);
- // Open an attribute for the dataset
- Attribute ds_attr=dataset.openAttribute(ATTR5_NAME);
+ // Open an attribute for the dataset
+ Attribute ds_attr=dataset.openAttribute(ATTR5_NAME);
- // Read attribute information
- float read_data2=0.0; // Buffer for reading 1st attribute
- ds_attr.read(PredType::NATIVE_FLOAT,&read_data2);
- if (HDfabs(read_data2 - attr_data5) > FP_EPSILON)
- verify_val(read_data2, attr_data5, FP_EPSILON, "Attribute::read", __LINE__, __FILE__);
+ // Read attribute information
+ float read_data2=0.0; // Buffer for reading 1st attribute
+ ds_attr.read(PredType::NATIVE_FLOAT,&read_data2);
+ if (HDfabs(read_data2 - attr_data5) > FP_EPSILON)
+ verify_val(read_data2, attr_data5, FP_EPSILON, "Attribute::read", __LINE__, __FILE__);
- // Get the dataspace of the attribute
- DataSpace att_space = ds_attr.getSpace();
+ // Get the dataspace of the attribute
+ DataSpace att_space = ds_attr.getSpace();
- // Make certain the dataspace is scalar
- H5S_class_t space_type = att_space.getSimpleExtentType();
- verify_val(space_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__);
+ // Make certain the dataspace is scalar
+ H5S_class_t space_type = att_space.getSimpleExtentType();
+ verify_val(space_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__);
- PASSED();
+ PASSED();
} // end try block
catch (Exception& E)
{
- issue_fail_msg("test_attr_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_attr_scalar_read()
@@ -877,65 +877,65 @@ static void test_attr_mult_write()
SUBTEST("Multiple Attribute Writing Functions");
try {
- // Create file
- H5File fid1 (FILE_MULTI, H5F_ACC_TRUNC);
+ // Create file
+ H5File fid1 (FILE_MULTI, H5F_ACC_TRUNC);
- // Create dataspace for dataset
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- DataSpace ds_space (SPACE1_RANK, dims1);
+ // Create dataspace for dataset
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ DataSpace ds_space (SPACE1_RANK, dims1);
- // Create a dataset
- DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space);
+ // Create a dataset
+ DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space);
- // Create dataspace for 1st attribute
- hsize_t dims2[] = {ATTR1_DIM1};
- DataSpace att_space (ATTR1_RANK, dims2);
+ // Create dataspace for 1st attribute
+ hsize_t dims2[] = {ATTR1_DIM1};
+ DataSpace att_space (ATTR1_RANK, dims2);
- // Create 1st attribute for the dataset
- Attribute ds_attr = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space);
+ // Create 1st attribute for the dataset
+ Attribute ds_attr = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space);
- // Write attribute information
- ds_attr.write (PredType::NATIVE_INT, attr_data1);
+ // Write attribute information
+ ds_attr.write (PredType::NATIVE_INT, attr_data1);
- // Create dataspace for 2nd attribute
- hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2};
- DataSpace att2_space (ATTR2_RANK, dims3);
+ // Create dataspace for 2nd attribute
+ hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2};
+ DataSpace att2_space (ATTR2_RANK, dims3);
- // Create 2nd attribute for the dataset
- Attribute ds_attr2 = dataset.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, att2_space);
+ // Create 2nd attribute for the dataset
+ Attribute ds_attr2 = dataset.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, att2_space);
- // Write 2nd attribute information
- ds_attr2.write (PredType::NATIVE_INT, attr_data2);
+ // Write 2nd attribute information
+ ds_attr2.write (PredType::NATIVE_INT, attr_data2);
- // Create dataspace for 3rd attribute
- hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3};
- DataSpace att3_space (ATTR3_RANK, dims4);
+ // Create dataspace for 3rd attribute
+ hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3};
+ DataSpace att3_space (ATTR3_RANK, dims4);
- // Create 3rd attribute for the dataset
- Attribute ds_attr3 = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space);
+ // Create 3rd attribute for the dataset
+ Attribute ds_attr3 = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space);
- // Try creating an attribute that already exists. This should fail
- // since two attributes cannot have the same name. If an exception
- // is not thrown for this action by createAttribute, then throw an
- // invalid action exception.
- try {
- Attribute invalid_attr = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space);
+ // Try creating an attribute that already exists. This should fail
+ // since two attributes cannot have the same name. If an exception
+ // is not thrown for this action by createAttribute, then throw an
+ // invalid action exception.
+ try {
+ Attribute invalid_attr = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space);
- // continuation here, that means no exception has been thrown
- throw InvalidActionException("DataSet::createAttribute", "Attempting to create a duplicate attribute");
- }
- catch (AttributeIException& E) // catching invalid creating attribute
+ // continuation here, that means no exception has been thrown
+ throw InvalidActionException("DataSet::createAttribute", "Attempting to create a duplicate attribute");
+ }
+ catch (AttributeIException& E) // catching invalid creating attribute
{} // do nothing, exception expected
- // Write 3rd attribute information
- ds_attr3.write (PredType::NATIVE_DOUBLE, attr_data3);
+ // Write 3rd attribute information
+ ds_attr3.write (PredType::NATIVE_DOUBLE, attr_data3);
- PASSED();
+ PASSED();
} // end try block
catch (Exception& E)
{
- issue_fail_msg("test_attr_mult_write()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_mult_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_attr_mult_write()
@@ -951,39 +951,39 @@ static void test_attr_mult_read()
double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{0}}}; // Buffer for reading 3rd attribute
hsize_t i,j,k;
- // Output message about test being performed
+ // Output message about test being performed
SUBTEST("Multiple Attribute Reading Functions");
try {
- // Open file
- H5File fid1(FILE_MULTI, H5F_ACC_RDWR);
+ // Open file
+ H5File fid1(FILE_MULTI, H5F_ACC_RDWR);
- // Open the dataset
- DataSet dataset = fid1.openDataSet(DSET1_NAME);
+ // Open the dataset
+ DataSet dataset = fid1.openDataSet(DSET1_NAME);
- // Verify the correct number of attributes
- int num_attrs = dataset.getNumAttrs();
- verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__);
+ // Verify the correct number of attributes
+ int num_attrs = dataset.getNumAttrs();
+ verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__);
- // Open 1st attribute for the dataset
- Attribute attr = dataset.openAttribute((unsigned)0);
+ // Open 1st attribute for the dataset
+ Attribute attr = dataset.openAttribute((unsigned)0);
- /* Verify Dataspace */
+ /* Verify Dataspace */
- // Get the dataspace of the attribute
- DataSpace space = attr.getSpace();
+ // Get the dataspace of the attribute
+ DataSpace space = attr.getSpace();
- // Get the rank of the dataspace and verify it
- int rank = space.getSimpleExtentNdims();
- verify_val(rank, ATTR1_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+ // Get the rank of the dataspace and verify it
+ int rank = space.getSimpleExtentNdims();
+ verify_val(rank, ATTR1_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
- // Get the dims of the dataspace and verify them
- hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions
- int ndims = space.getSimpleExtentDims(dims);
- if ((long)dims[0] != (long)ATTR1_DIM1)
- TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %d\n",__LINE__,(int)dims[0],ATTR1_DIM1);
+ // Get the dims of the dataspace and verify them
+ hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions
+ int ndims = space.getSimpleExtentDims(dims);
+ if ((long)dims[0] != (long)ATTR1_DIM1)
+ TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %d\n",__LINE__,(int)dims[0],ATTR1_DIM1);
- /* Verify Datatype */
+ /* Verify Datatype */
// Get the class of the datatype that is used by attr
H5T_class_t type_class = attr.getTypeClass();
@@ -991,51 +991,51 @@ static void test_attr_mult_read()
// Verify that the type is of integer datatype
verify_val(type_class, H5T_INTEGER, "Attribute::getTypeClass", __LINE__, __FILE__);
- // Get the integer datatype
+ // Get the integer datatype
IntType i_type1 = attr.getIntType();
- // Get and verify the order of this type
- H5T_order_t order = i_type1.getOrder();
- verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
+ // Get and verify the order of this type
+ H5T_order_t order = i_type1.getOrder();
+ verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
- // Get and verify the size of this type
- size_t size = i_type1.getSize();
- verify_val(size, PredType::NATIVE_INT.getSize(), "DataType::getSize", __LINE__, __FILE__);
+ // Get and verify the size of this type
+ size_t size = i_type1.getSize();
+ verify_val(size, PredType::NATIVE_INT.getSize(), "DataType::getSize", __LINE__, __FILE__);
- // Read attribute information
- attr.read(PredType::NATIVE_INT, read_data1);
+ // Read attribute information
+ attr.read(PredType::NATIVE_INT, read_data1);
- // Verify values read in
- for(i=0; i<ATTR1_DIM1; i++)
- if(attr_data1[i]!=read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
+ // Verify values read in
+ for(i=0; i<ATTR1_DIM1; i++)
+ if(attr_data1[i]!=read_data1[i])
+ TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]);
- // Verify Name
- H5std_string attr_name = attr.getName();
- verify_val(attr_name, ATTR1_NAME, "DataType::getName", __LINE__, __FILE__);
+ // Verify Name
+ H5std_string attr_name = attr.getName();
+ verify_val(attr_name, ATTR1_NAME, "DataType::getName", __LINE__, __FILE__);
- attr.close();
- space.close();
+ attr.close();
+ space.close();
- // Open 2nd attribute for the dataset
- attr = dataset.openAttribute((unsigned)1);
+ // Open 2nd attribute for the dataset
+ attr = dataset.openAttribute((unsigned)1);
- /* Verify Dataspace */
+ /* Verify Dataspace */
- // Get the dataspace of the attribute
- space = attr.getSpace();
+ // Get the dataspace of the attribute
+ space = attr.getSpace();
- // Get the rank of the dataspace and verify it
- rank = space.getSimpleExtentNdims();
- verify_val(rank, ATTR2_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+ // Get the rank of the dataspace and verify it
+ rank = space.getSimpleExtentNdims();
+ verify_val(rank, ATTR2_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
- // Get the dims of the dataspace and verify them
- ndims = space.getSimpleExtentDims(dims);
+ // Get the dims of the dataspace and verify them
+ ndims = space.getSimpleExtentDims(dims);
verify_val((long)dims[0], (long)ATTR2_DIM1, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__);
verify_val((long)dims[1], (long)ATTR2_DIM2, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__);
- /* Verify Datatype */
+ /* Verify Datatype */
// Get the class of the datatype that is used by attr
type_class = attr.getTypeClass();
@@ -1043,52 +1043,52 @@ static void test_attr_mult_read()
// Verify that the type is of integer datatype
verify_val(type_class, H5T_INTEGER, "Attribute::getTypeClass", __LINE__, __FILE__);
- // Get the integer datatype
+ // Get the integer datatype
IntType i_type2 = attr.getIntType();
- // Get and verify the order of this type
- order = i_type2.getOrder();
- verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
+ // Get and verify the order of this type
+ order = i_type2.getOrder();
+ verify_val(order, PredType::NATIVE_INT.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
- // Get and verify the size of this type
- size = i_type2.getSize();
- verify_val(size, PredType::NATIVE_INT.getSize(), "DataType::getSize", __LINE__, __FILE__);
+ // Get and verify the size of this type
+ size = i_type2.getSize();
+ verify_val(size, PredType::NATIVE_INT.getSize(), "DataType::getSize", __LINE__, __FILE__);
- // Read attribute information
- attr.read(PredType::NATIVE_INT, read_data2);
- //attr.read(i_type, read_data2);
+ // Read attribute information
+ attr.read(PredType::NATIVE_INT, read_data2);
+ //attr.read(i_type, read_data2);
- // Verify values read in
- for(i=0; i<ATTR2_DIM1; i++)
- for(j=0; j<ATTR2_DIM2; j++)
+ // Verify values read in
+ for(i=0; i<ATTR2_DIM1; i++)
+ for(j=0; j<ATTR2_DIM2; j++)
if(attr_data2[i][j]!=read_data2[i][j])
TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",__LINE__,i,j,attr_data2[i][j],i,j,read_data2[i][j]);
- // Verify Name
- attr_name = attr.getName();
- verify_val(attr_name, ATTR2_NAME, "DataType::getName", __LINE__, __FILE__);
- attr.close();
- space.close();
+ // Verify Name
+ attr_name = attr.getName();
+ verify_val(attr_name, ATTR2_NAME, "DataType::getName", __LINE__, __FILE__);
+ attr.close();
+ space.close();
- // Open 3rd attribute for the dataset
- attr = dataset.openAttribute((unsigned)2);
+ // Open 3rd attribute for the dataset
+ attr = dataset.openAttribute((unsigned)2);
- /* Verify Dataspace */
+ /* Verify Dataspace */
- // Get the dataspace of the attribute
- space = attr.getSpace();
+ // Get the dataspace of the attribute
+ space = attr.getSpace();
- // Get the rank of the dataspace and verify it
- rank = space.getSimpleExtentNdims();
- verify_val(rank, ATTR3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+ // Get the rank of the dataspace and verify it
+ rank = space.getSimpleExtentNdims();
+ verify_val(rank, ATTR3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
- // Get the dims of the dataspace and verify them
- ndims = space.getSimpleExtentDims(dims);
- verify_val((long)dims[0],(long)ATTR3_DIM1,"attribute dimensions",__FILE__,__LINE__);
- verify_val((long)dims[1],(long)ATTR3_DIM2,"attribute dimensions",__FILE__,__LINE__);
- verify_val((long)dims[2],(long)ATTR3_DIM3,"attribute dimensions",__FILE__,__LINE__);
+ // Get the dims of the dataspace and verify them
+ ndims = space.getSimpleExtentDims(dims);
+ verify_val((long)dims[0],(long)ATTR3_DIM1,"attribute dimensions",__FILE__,__LINE__);
+ verify_val((long)dims[1],(long)ATTR3_DIM2,"attribute dimensions",__FILE__,__LINE__);
+ verify_val((long)dims[2],(long)ATTR3_DIM3,"attribute dimensions",__FILE__,__LINE__);
- /* Verify Datatype */
+ /* Verify Datatype */
// Get the class of the datatype that is used by attr
type_class = attr.getTypeClass();
@@ -1096,44 +1096,44 @@ static void test_attr_mult_read()
// Verify that the type is of compound datatype
verify_val(type_class, H5T_FLOAT, "Attribute::getTypeClass", __LINE__, __FILE__);
- // Get the double datatype
+ // Get the double datatype
FloatType f_type = attr.getFloatType();
- // Get and verify the order of this type
- order = f_type.getOrder();
- verify_val(order, PredType::NATIVE_DOUBLE.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
+ // Get and verify the order of this type
+ order = f_type.getOrder();
+ verify_val(order, PredType::NATIVE_DOUBLE.getOrder(), "DataType::getOrder", __LINE__, __FILE__);
- // Get and verify the size of this type
- size = f_type.getSize();
- verify_val(size, PredType::NATIVE_DOUBLE.getSize(), "DataType::getSize", __LINE__, __FILE__);
+ // Get and verify the size of this type
+ size = f_type.getSize();
+ verify_val(size, PredType::NATIVE_DOUBLE.getSize(), "DataType::getSize", __LINE__, __FILE__);
- // Read attribute information
- attr.read(PredType::NATIVE_DOUBLE, read_data3);
+ // Read attribute information
+ attr.read(PredType::NATIVE_DOUBLE, read_data3);
- // Verify values read in
- for(i=0; i<ATTR3_DIM1; i++)
- for(j=0; j<ATTR3_DIM2; j++)
- for(k=0; k<ATTR3_DIM3; k++)
- if(attr_data3[i][j][k]!=read_data3[i][j][k])
- TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, read_data3[%d][%d][%d]=%f\n",__LINE__,i,j,k,attr_data3[i][j][k],i,j,k,read_data3[i][j][k]);
+ // Verify values read in
+ for(i=0; i<ATTR3_DIM1; i++)
+ for(j=0; j<ATTR3_DIM2; j++)
+ for(k=0; k<ATTR3_DIM3; k++)
+ if(attr_data3[i][j][k]!=read_data3[i][j][k])
+ TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, read_data3[%d][%d][%d]=%f\n",__LINE__,i,j,k,attr_data3[i][j][k],i,j,k,read_data3[i][j][k]);
- // Verify Name
- attr_name = attr.getName();
- verify_val(attr_name, ATTR3_NAME, "DataType::getName", __LINE__, __FILE__);
+ // Verify Name
+ attr_name = attr.getName();
+ verify_val(attr_name, ATTR3_NAME, "DataType::getName", __LINE__, __FILE__);
- PASSED();
+ PASSED();
} // end try block
catch (Exception& E)
{
- issue_fail_msg("test_attr_mult_read()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_mult_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_attr_mult_read()
/****************************************************************
**
** test_attr_delete(): Test deleting attribute from different
-** hdf5 objects.
+** hdf5 objects.
**
****************************************************************/
static void test_attr_delete()
@@ -1144,113 +1144,113 @@ static void test_attr_delete()
SUBTEST("Removing Attribute Function");
try {
- // Open file.
- H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
-
- // Get the number of file attributes
- int num_attrs = fid1.getNumAttrs();
- verify_val(num_attrs, 2, "H5File::getNumAttrs", __LINE__, __FILE__);
-
- // Delete the second file attribute
- fid1.removeAttr(FATTR2_NAME);
-
- // Get the number of file attributes
- num_attrs = fid1.getNumAttrs();
- verify_val(num_attrs, 1, "H5File::getNumAttrs", __LINE__, __FILE__);
-
- // Verify the name of the only file attribute left
- Attribute fattr = fid1.openAttribute((unsigned)0);
- attr_name = fattr.getName();
- verify_val(attr_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
- fattr.close();
-
- // Test deleting non-existing attribute
-
- // Open the dataset
- DataSet dataset = fid1.openDataSet(DSET1_NAME);
-
- // Verify the correct number of attributes
- num_attrs = dataset.getNumAttrs();
- verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__);
-
- // Try to delete bogus attribute, should fail
- try {
- dataset.removeAttr("Bogus");
-
- // continuation here, that means no exception has been thrown
- throw InvalidActionException("DataSet::removeAttr", "Attempting to remove non-existing attribute");
- }
- catch (AttributeIException& E) // catching invalid removing attribute
+ // Open file.
+ H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
+
+ // Get the number of file attributes
+ int num_attrs = fid1.getNumAttrs();
+ verify_val(num_attrs, 2, "H5File::getNumAttrs", __LINE__, __FILE__);
+
+ // Delete the second file attribute
+ fid1.removeAttr(FATTR2_NAME);
+
+ // Get the number of file attributes
+ num_attrs = fid1.getNumAttrs();
+ verify_val(num_attrs, 1, "H5File::getNumAttrs", __LINE__, __FILE__);
+
+ // Verify the name of the only file attribute left
+ Attribute fattr = fid1.openAttribute((unsigned)0);
+ attr_name = fattr.getName();
+ verify_val(attr_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
+ fattr.close();
+
+ // Test deleting non-existing attribute
+
+ // Open the dataset
+ DataSet dataset = fid1.openDataSet(DSET1_NAME);
+
+ // Verify the correct number of attributes
+ num_attrs = dataset.getNumAttrs();
+ verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__);
+
+ // Try to delete bogus attribute, should fail
+ try {
+ dataset.removeAttr("Bogus");
+
+ // continuation here, that means no exception has been thrown
+ throw InvalidActionException("DataSet::removeAttr", "Attempting to remove non-existing attribute");
+ }
+ catch (AttributeIException& E) // catching invalid removing attribute
{} // do nothing, exception expected
- // Test deleting dataset's attributes
+ // Test deleting dataset's attributes
- // Verify the correct number of attributes
- num_attrs = dataset.getNumAttrs();
- verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__);
+ // Verify the correct number of attributes
+ num_attrs = dataset.getNumAttrs();
+ verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__);
- // Delete middle (2nd) attribute
- dataset.removeAttr(ATTR2_NAME);
+ // Delete middle (2nd) attribute
+ dataset.removeAttr(ATTR2_NAME);
- // Verify the correct number of attributes
- num_attrs = dataset.getNumAttrs();
- verify_val(num_attrs, 2, "DataSet::getNumAttrs", __LINE__, __FILE__);
+ // Verify the correct number of attributes
+ num_attrs = dataset.getNumAttrs();
+ verify_val(num_attrs, 2, "DataSet::getNumAttrs", __LINE__, __FILE__);
- // Open 1st attribute for the dataset
- Attribute attr = dataset.openAttribute((unsigned)0);
+ // Open 1st attribute for the dataset
+ Attribute attr = dataset.openAttribute((unsigned)0);
- // Verify Name
- attr_name = attr.getName();
- verify_val(attr_name, ATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
+ // Verify Name
+ attr_name = attr.getName();
+ verify_val(attr_name, ATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
- // Close attribute
- attr.close();
+ // Close attribute
+ attr.close();
- // Open last (formally 3rd) attribute for the dataset
- attr = dataset.openAttribute((unsigned)1);
+ // Open last (formally 3rd) attribute for the dataset
+ attr = dataset.openAttribute((unsigned)1);
- // Verify Name
- attr_name = attr.getName();
- verify_val(attr_name, ATTR3_NAME, "Attribute::getName", __LINE__, __FILE__);
+ // Verify Name
+ attr_name = attr.getName();
+ verify_val(attr_name, ATTR3_NAME, "Attribute::getName", __LINE__, __FILE__);
- attr.close();
+ attr.close();
- // Delete first attribute
- dataset.removeAttr(ATTR1_NAME);
+ // Delete first attribute
+ dataset.removeAttr(ATTR1_NAME);
- // Verify the correct number of attributes
- num_attrs = dataset.getNumAttrs();
- verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__);
+ // Verify the correct number of attributes
+ num_attrs = dataset.getNumAttrs();
+ verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__);
- // Open the only attribute for the dataset (formally 3rd)
- attr = dataset.openAttribute((unsigned)0);
+ // Open the only attribute for the dataset (formally 3rd)
+ attr = dataset.openAttribute((unsigned)0);
- // Verify Name
- attr_name = attr.getName();
- verify_val(attr_name, ATTR3_NAME, "Attribute::getName", __LINE__, __FILE__);
- // Close attribute
- attr.close();
+ // Verify Name
+ attr_name = attr.getName();
+ verify_val(attr_name, ATTR3_NAME, "Attribute::getName", __LINE__, __FILE__);
+ // Close attribute
+ attr.close();
- // Delete first attribute
- dataset.removeAttr(ATTR3_NAME);
+ // Delete first attribute
+ dataset.removeAttr(ATTR3_NAME);
- // Verify the correct number of attributes
- num_attrs = dataset.getNumAttrs();
- verify_val(num_attrs, 0, "DataSet::getNumAttrs", __LINE__, __FILE__);
+ // Verify the correct number of attributes
+ num_attrs = dataset.getNumAttrs();
+ verify_val(num_attrs, 0, "DataSet::getNumAttrs", __LINE__, __FILE__);
- PASSED();
+ PASSED();
} // end try block
catch (Exception& E)
{
- issue_fail_msg("test_attr_delete()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_delete()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_attr_delete()
/****************************************************************
**
** test_attr_dtype_shared(): Test code for using shared datatypes
-** in attributes.
+** in attributes.
**
****************************************************************/
static void test_attr_dtype_shared()
@@ -1266,142 +1266,142 @@ static void test_attr_dtype_shared()
SUBTEST("Shared Datatypes with Attributes");
try {
- // Create a file
- H5File fid1(FILE_DTYPE, H5F_ACC_TRUNC);
+ // Create a file
+ H5File fid1(FILE_DTYPE, H5F_ACC_TRUNC);
- // Close file
- fid1.close();
+ // Close file
+ fid1.close();
- // Get size of file
- h5_stat_size_t empty_filesize; // Size of empty file
- empty_filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT);
- if (empty_filesize < 0)
+ // Get size of file
+ h5_stat_size_t empty_filesize; // Size of empty file
+ empty_filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT);
+ if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
- // Open the file again
- fid1.openFile(FILE_DTYPE, H5F_ACC_RDWR);
+ // Open the file again
+ fid1.openFile(FILE_DTYPE, H5F_ACC_RDWR);
- // Enclosing to work around the issue of unused variables and/or
- // objects created by copy constructors stay around until end of
- // scope, causing incorrect number of ref counts.
- { // First enclosed block
+ // Enclosing to work around the issue of unused variables and/or
+ // objects created by copy constructors stay around until end of
+ // scope, causing incorrect number of ref counts.
+ { // First enclosed block
- // Create a datatype to commit and use
- IntType dtype(PredType::NATIVE_INT);
+ // Create a datatype to commit and use
+ IntType dtype(PredType::NATIVE_INT);
- // Commit datatype to file
- dtype.commit(fid1, TYPE1_NAME);
+ // Commit datatype to file
+ dtype.commit(fid1, TYPE1_NAME);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 1, "DataType::getObjinfo", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 1, "DataType::getObjinfo", __LINE__, __FILE__);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Create dataspace for dataset
- DataSpace dspace;
+ // Create dataspace for dataset
+ DataSpace dspace;
- DataSet dset = fid1.createDataSet(DSET1_NAME, dtype, dspace);
+ DataSet dset = fid1.createDataSet(DSET1_NAME, dtype, dspace);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 2, "H5File::getObjinfo", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 2, "H5File::getObjinfo", __LINE__, __FILE__);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Create attribute on dataset
- Attribute attr = dset.createAttribute(ATTR1_NAME,dtype,dspace);
+ // Create attribute on dataset
+ Attribute attr = dset.createAttribute(ATTR1_NAME,dtype,dspace);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 3, "DataSet::getObjinfo", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 3, "DataSet::getObjinfo", __LINE__, __FILE__);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Close attribute
attr.close();
- // Delete attribute
- dset.removeAttr(ATTR1_NAME);
+ // Delete attribute
+ dset.removeAttr(ATTR1_NAME);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 2, "DataSet::getObjinfo after DataSet::removeAttr", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 2, "DataSet::getObjinfo after DataSet::removeAttr", __LINE__, __FILE__);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Create attribute on dataset
attr = dset.createAttribute(ATTR1_NAME,dtype,dspace);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 3, "DataSet::createAttribute", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 3, "DataSet::createAttribute", __LINE__, __FILE__);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Write data into the attribute
- attr.write(PredType::NATIVE_INT,&data);
+ // Write data into the attribute
+ attr.write(PredType::NATIVE_INT,&data);
- // Close attribute, dataset, dataspace, datatype, and file
- attr.close();
- dset.close();
- dspace.close();
- dtype.close();
- } // end of first enclosing
+ // Close attribute, dataset, dataspace, datatype, and file
+ attr.close();
+ dset.close();
+ dspace.close();
+ dtype.close();
+ } // end of first enclosing
- fid1.close();
+ fid1.close();
- // Open the file again
- fid1.openFile(FILE_DTYPE, H5F_ACC_RDWR);
+ // Open the file again
+ fid1.openFile(FILE_DTYPE, H5F_ACC_RDWR);
- { // Second enclosed block...
+ { // Second enclosed block...
- // Open dataset
- DataSet *dset2 = new DataSet (fid1.openDataSet(DSET1_NAME));
+ // Open dataset
+ DataSet *dset2 = new DataSet (fid1.openDataSet(DSET1_NAME));
- // Open attribute
- Attribute *attr2 = new Attribute (dset2->openAttribute(ATTR1_NAME));
+ // Open attribute
+ Attribute *attr2 = new Attribute (dset2->openAttribute(ATTR1_NAME));
- // Read data from the attribute
- attr2->read(PredType::NATIVE_INT, &rdata);
- verify_val(data, rdata, "Attribute::read", __LINE__, __FILE__);
+ // Read data from the attribute
+ attr2->read(PredType::NATIVE_INT, &rdata);
+ verify_val(data, rdata, "Attribute::read", __LINE__, __FILE__);
- // Close attribute and dataset
- delete attr2;
- delete dset2;
+ // Close attribute and dataset
+ delete attr2;
+ delete dset2;
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 3, "DataSet::openAttribute", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 3, "DataSet::openAttribute", __LINE__, __FILE__);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- } // end of second enclosing
+ } // end of second enclosing
- // Unlink the dataset
- fid1.unlink(DSET1_NAME);
+ // Unlink the dataset
+ fid1.unlink(DSET1_NAME);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- // Check reference count on named datatype
- fid1.getObjinfo(TYPE1_NAME, statbuf);
- verify_val((int)statbuf.nlink, 1, "H5File::unlink", __LINE__, __FILE__);
+ // Check reference count on named datatype
+ fid1.getObjinfo(TYPE1_NAME, statbuf);
+ verify_val((int)statbuf.nlink, 1, "H5File::unlink", __LINE__, __FILE__);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- // Unlink the named datatype
- fid1.unlink(TYPE1_NAME);
+ // Unlink the named datatype
+ fid1.unlink(TYPE1_NAME);
- // Close file
- fid1.close();
+ // Close file
+ fid1.close();
- // Check size of file
- filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT);
- verify_val((long)filesize, (long)empty_filesize, "Checking file size", __LINE__, __FILE__);
+ // Check size of file
+ filesize = h5_get_file_size(FILE_DTYPE.c_str(), H5P_DEFAULT);
+ verify_val((long)filesize, (long)empty_filesize, "Checking file size", __LINE__, __FILE__);
- PASSED();
+ PASSED();
} // end try block
catch (Exception& E)
{
- issue_fail_msg("test_attr_dtype_shared()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_dtype_shared()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_attr_dtype_shared()
@@ -1424,116 +1424,116 @@ static void test_string_attr()
SUBTEST("I/O on FL and VL String Attributes");
try {
- // Create file
- H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
-
- //
- // Fixed-lenth string attributes
- //
- // Create a fixed-length string datatype to refer to.
- StrType fls_type(0, ATTR_LEN);
-
- // Open the root group.
- Group root = fid1.openGroup("/");
-
- // Create dataspace for the attribute.
- DataSpace att_space (H5S_SCALAR);
-
- /* Test Attribute::write(...,const void *buf) with Fixed len string */
-
- // Create an attribute for the root group.
- Attribute gr_flattr1 = root.createAttribute(ATTR1_FL_STR_NAME, fls_type, att_space);
-
- // Write data to the attribute.
- gr_flattr1.write(fls_type, ATTRSTR_DATA.c_str());
-
- /* Test Attribute::write(...,const H5std_string& strg) with FL string */
-
- // Create an attribute for the root group.
- Attribute gr_flattr2 = root.createAttribute(ATTR2_FL_STR_NAME, fls_type, att_space);
-
- // Write data to the attribute.
- gr_flattr2.write(fls_type, ATTRSTR_DATA);
-
- /* Test Attribute::read(...,void *buf) with FL string */
-
- // Read and verify the attribute string as a string of chars.
- char flstring_att_check[ATTR_LEN];
- gr_flattr1.read(fls_type, flstring_att_check);
- if(HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), flstring_att_check);
-
- // Read and verify the attribute string as a string of chars; buffer
- // is dynamically allocated.
- size_t attr_size = gr_flattr1.getInMemDataSize();
- char *fl_dyn_string_att_check;
- fl_dyn_string_att_check = new char[attr_size+1];
- gr_flattr1.read(fls_type, fl_dyn_string_att_check);
- if(HDstrcmp(fl_dyn_string_att_check, ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), fl_dyn_string_att_check);
- delete []fl_dyn_string_att_check;
-
- /* Test Attribute::read(...,H5std_string& strg) with FL string */
-
- // Read and verify the attribute string as an std::string.
- H5std_string read_flstr1;
- gr_flattr1.read(fls_type, read_flstr1);
- if (read_flstr1 != ATTRSTR_DATA)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr1=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_flstr1.c_str());
-
- // Read and verify the attribute string as a string of chars.
- HDstrcpy(flstring_att_check, "");
- gr_flattr2.read(fls_type, flstring_att_check);
- if(HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), flstring_att_check);
-
- /* Test Attribute::read(...,H5std_string& strg) with FL string */
-
- // Read and verify the attribute string as an std::string.
- H5std_string read_flstr2;
- gr_flattr2.read(fls_type, read_flstr2);
- if (read_flstr2 != ATTRSTR_DATA)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr2=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_flstr2.c_str());
-
- //
- // Variable-lenth string attributes
- //
- // Create a variable length string datatype to refer to.
- StrType vls_type(0, H5T_VARIABLE);
-
- // Create an attribute for the root group.
- Attribute gr_vlattr = root.createAttribute(ATTR_VL_STR_NAME, vls_type, att_space);
-
- // Write data to the attribute.
- gr_vlattr.write(vls_type, ATTRSTR_DATA);
-
- /* Test Attribute::read(...,void *buf) with Variable len string */
- // Read and verify the attribute string as a string of chars.
- char *string_att_check;
- gr_vlattr.read(vls_type, &string_att_check);
- if(HDstrcmp(string_att_check, ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), string_att_check);
- HDfree(string_att_check);
-
- /* Test Attribute::read(...,H5std_string& strg) with VL string */
- // Read and verify the attribute string as an std::string.
- H5std_string read_str;
- gr_vlattr.read(vls_type, read_str);
- if (read_str != ATTRSTR_DATA)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_str=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_str.c_str());
- PASSED();
+ // Create file
+ H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
+
+ //
+ // Fixed-lenth string attributes
+ //
+ // Create a fixed-length string datatype to refer to.
+ StrType fls_type(0, ATTR_LEN);
+
+ // Open the root group.
+ Group root = fid1.openGroup("/");
+
+ // Create dataspace for the attribute.
+ DataSpace att_space (H5S_SCALAR);
+
+ /* Test Attribute::write(...,const void *buf) with Fixed len string */
+
+ // Create an attribute for the root group.
+ Attribute gr_flattr1 = root.createAttribute(ATTR1_FL_STR_NAME, fls_type, att_space);
+
+ // Write data to the attribute.
+ gr_flattr1.write(fls_type, ATTRSTR_DATA.c_str());
+
+ /* Test Attribute::write(...,const H5std_string& strg) with FL string */
+
+ // Create an attribute for the root group.
+ Attribute gr_flattr2 = root.createAttribute(ATTR2_FL_STR_NAME, fls_type, att_space);
+
+ // Write data to the attribute.
+ gr_flattr2.write(fls_type, ATTRSTR_DATA);
+
+ /* Test Attribute::read(...,void *buf) with FL string */
+
+ // Read and verify the attribute string as a string of chars.
+ char flstring_att_check[ATTR_LEN];
+ gr_flattr1.read(fls_type, flstring_att_check);
+ if(HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str())!=0)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), flstring_att_check);
+
+ // Read and verify the attribute string as a string of chars; buffer
+ // is dynamically allocated.
+ size_t attr_size = gr_flattr1.getInMemDataSize();
+ char *fl_dyn_string_att_check;
+ fl_dyn_string_att_check = new char[attr_size+1];
+ gr_flattr1.read(fls_type, fl_dyn_string_att_check);
+ if(HDstrcmp(fl_dyn_string_att_check, ATTRSTR_DATA.c_str())!=0)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), fl_dyn_string_att_check);
+ delete []fl_dyn_string_att_check;
+
+ /* Test Attribute::read(...,H5std_string& strg) with FL string */
+
+ // Read and verify the attribute string as an std::string.
+ H5std_string read_flstr1;
+ gr_flattr1.read(fls_type, read_flstr1);
+ if (read_flstr1 != ATTRSTR_DATA)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr1=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_flstr1.c_str());
+
+ // Read and verify the attribute string as a string of chars.
+ HDstrcpy(flstring_att_check, "");
+ gr_flattr2.read(fls_type, flstring_att_check);
+ if(HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str())!=0)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), flstring_att_check);
+
+ /* Test Attribute::read(...,H5std_string& strg) with FL string */
+
+ // Read and verify the attribute string as an std::string.
+ H5std_string read_flstr2;
+ gr_flattr2.read(fls_type, read_flstr2);
+ if (read_flstr2 != ATTRSTR_DATA)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_flstr2=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_flstr2.c_str());
+
+ //
+ // Variable-lenth string attributes
+ //
+ // Create a variable length string datatype to refer to.
+ StrType vls_type(0, H5T_VARIABLE);
+
+ // Create an attribute for the root group.
+ Attribute gr_vlattr = root.createAttribute(ATTR_VL_STR_NAME, vls_type, att_space);
+
+ // Write data to the attribute.
+ gr_vlattr.write(vls_type, ATTRSTR_DATA);
+
+ /* Test Attribute::read(...,void *buf) with Variable len string */
+ // Read and verify the attribute string as a string of chars.
+ char *string_att_check;
+ gr_vlattr.read(vls_type, &string_att_check);
+ if(HDstrcmp(string_att_check, ATTRSTR_DATA.c_str())!=0)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), string_att_check);
+ HDfree(string_att_check);
+
+ /* Test Attribute::read(...,H5std_string& strg) with VL string */
+ // Read and verify the attribute string as an std::string.
+ H5std_string read_str;
+ gr_vlattr.read(vls_type, read_str);
+ if (read_str != ATTRSTR_DATA)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_str=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_str.c_str());
+ PASSED();
} // end try block
catch (Exception& E)
{
- issue_fail_msg("test_string_attr()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_string_attr()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_string_attr()
/****************************************************************
**
** test_attr_exists(): Test checking for attribute existence.
-** (additional attrExists tests are in test_attr_rename())
+** (additional attrExists tests are in test_attr_rename())
**
****************************************************************/
static void test_attr_exists()
@@ -1542,40 +1542,40 @@ static void test_attr_exists()
SUBTEST("Check Attribute Existence");
try {
- // Open file.
- H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
+ // Open file.
+ H5File fid1(FILE_BASIC, H5F_ACC_RDWR);
- // Open the root group.
- Group root = fid1.openGroup("/");
+ // Open the root group.
+ Group root = fid1.openGroup("/");
- // Check for existence of attribute
- bool attr_exists = fid1.attrExists(ATTR1_FL_STR_NAME);
- if (attr_exists == false)
- throw InvalidActionException("H5File::attrExists", "fid1, ATTR1_FL_STR_NAMEAttribute should exist but does not");
+ // Check for existence of attribute
+ bool attr_exists = fid1.attrExists(ATTR1_FL_STR_NAME);
+ if (attr_exists == false)
+ throw InvalidActionException("H5File::attrExists", "fid1, ATTR1_FL_STR_NAMEAttribute should exist but does not");
- // Check for existence of attribute
- attr_exists = fid1.attrExists(FATTR1_NAME);
- if (attr_exists == false)
- throw InvalidActionException("H5File::attrExists", "fid1,FATTR2_NAMEAttribute should exist but does not");
+ // Check for existence of attribute
+ attr_exists = fid1.attrExists(FATTR1_NAME);
+ if (attr_exists == false)
+ throw InvalidActionException("H5File::attrExists", "fid1,FATTR2_NAMEAttribute should exist but does not");
- // Open a group.
- Group group = fid1.openGroup(GROUP1_NAME);
+ // Open a group.
+ Group group = fid1.openGroup(GROUP1_NAME);
- // Check for existence of attribute
- attr_exists = group.attrExists(ATTR2_NAME);
- if (attr_exists == false)
- throw InvalidActionException("H5File::attrExists", "group, ATTR2_NAMEAttribute should exist but does not");
+ // Check for existence of attribute
+ attr_exists = group.attrExists(ATTR2_NAME);
+ if (attr_exists == false)
+ throw InvalidActionException("H5File::attrExists", "group, ATTR2_NAMEAttribute should exist but does not");
- PASSED();
+ PASSED();
} // end try block
catch (InvalidActionException& E)
{
- issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg());
}
catch (Exception& E)
{
- issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_attr_exists()
@@ -1591,100 +1591,100 @@ const unsigned MAX_COMPACT_DEF = 8;
const unsigned MIN_DENSE_DEF = 6;
static void test_attr_dense_create(FileCreatPropList& fcpl,
- FileAccPropList& fapl)
+ FileAccPropList& fapl)
{
// Output message about test being performed
SUBTEST("Dense Attribute Storage Creation");
try {
- // Create file
- H5File fid1 (FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl);
+ // Create file
+ H5File fid1 (FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl);
- // Close file
- fid1.close();
+ // Close file
+ fid1.close();
- // Get size of file
- h5_stat_size_t empty_filesize; // Size of empty file
- empty_filesize = h5_get_file_size(FILE_CRTPROPS.c_str(), fapl.getId());
- if (empty_filesize < 0)
+ // Get size of file
+ h5_stat_size_t empty_filesize; // Size of empty file
+ empty_filesize = h5_get_file_size(FILE_CRTPROPS.c_str(), fapl.getId());
+ if (empty_filesize < 0)
TestErrPrintf("Line %d: file size wrong!\n", __LINE__);
- // Re-open file
- fid1.openFile(FILE_CRTPROPS, H5F_ACC_RDWR, fapl);
+ // Re-open file
+ fid1.openFile(FILE_CRTPROPS, H5F_ACC_RDWR, fapl);
- // Create dataspace for dataset
- DataSpace ds_space(H5S_SCALAR);
+ // Create dataspace for dataset
+ DataSpace ds_space(H5S_SCALAR);
- // Create dataset creation property list.
- DSetCreatPropList dcpl;
+ // Create dataset creation property list.
+ DSetCreatPropList dcpl;
- // Create a dataset
- DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space, dcpl);
+ // Create a dataset
+ DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space, dcpl);
- unsigned max_compact = 0, min_dense = 0;
+ unsigned max_compact = 0, min_dense = 0;
- // Retrieve limits for compact/dense attribute storage
- dcpl.getAttrPhaseChange(max_compact, min_dense);
- verify_val(max_compact, MAX_COMPACT_DEF, "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
- verify_val(min_dense, MIN_DENSE_DEF, "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
+ // Retrieve limits for compact/dense attribute storage
+ dcpl.getAttrPhaseChange(max_compact, min_dense);
+ verify_val(max_compact, MAX_COMPACT_DEF, "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
+ verify_val(min_dense, MIN_DENSE_DEF, "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
- // Set new compact/dense attribute storage limits to some random numbers
- dcpl.setAttrPhaseChange(7, 5);
+ // Set new compact/dense attribute storage limits to some random numbers
+ dcpl.setAttrPhaseChange(7, 5);
- // Retrieve limits for compact/dense attribute storage and verify them
- dcpl.getAttrPhaseChange(max_compact, min_dense);
- verify_val(max_compact, static_cast<unsigned>(7), "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
- verify_val(min_dense, static_cast<unsigned>(5), "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
+ // Retrieve limits for compact/dense attribute storage and verify them
+ dcpl.getAttrPhaseChange(max_compact, min_dense);
+ verify_val(max_compact, static_cast<unsigned>(7), "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
+ verify_val(min_dense, static_cast<unsigned>(5), "DSetCreatPropList::getAttrPhaseChange",__LINE__,__FILE__);
- // Close property list
- dcpl.close();
+ // Close property list
+ dcpl.close();
- // H5O_is_attr_dense_test - un-usable
+ // H5O_is_attr_dense_test - un-usable
- // Add attributes, until just before converting to dense storage
- char attr_name[NAME_BUF_SIZE];
- unsigned attr_num;
- for (attr_num = 0; attr_num < max_compact; attr_num++)
- {
- // Create attribute
- sprintf(attr_name, "attr %02u", attr_num);
- Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space);
+ // Add attributes, until just before converting to dense storage
+ char attr_name[NAME_BUF_SIZE];
+ unsigned attr_num;
+ for (attr_num = 0; attr_num < max_compact; attr_num++)
+ {
+ // Create attribute
+ sprintf(attr_name, "attr %02u", attr_num);
+ Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space);
- // Write data to the attribute
- attr.write(PredType::NATIVE_UINT, &attr_num);
- } // end for
+ // Write data to the attribute
+ attr.write(PredType::NATIVE_UINT, &attr_num);
+ } // end for
- // H5O_is_attr_dense_test - un-usable
+ // H5O_is_attr_dense_test - un-usable
- { // Add one more attribute, to push into "dense" storage
+ { // Add one more attribute, to push into "dense" storage
- // Create another attribute
- sprintf(attr_name, "attr %02u", attr_num);
- Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space);
+ // Create another attribute
+ sprintf(attr_name, "attr %02u", attr_num);
+ Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space);
- // Write data to the attribute
- attr.write(PredType::NATIVE_UINT, &attr_num);
- }
+ // Write data to the attribute
+ attr.write(PredType::NATIVE_UINT, &attr_num);
+ }
- // Attempt to add attribute again, which should fail
- try
- {
- // Create another attribute
- sprintf(attr_name, "attr %02u", attr_num);
- Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space);
+ // Attempt to add attribute again, which should fail
+ try
+ {
+ // Create another attribute
+ sprintf(attr_name, "attr %02u", attr_num);
+ Attribute attr = dataset.createAttribute(attr_name, PredType::NATIVE_UINT, ds_space);
- // continuation here, that means no exception has been thrown
- throw InvalidActionException("DataSet::createAttribute", "Maximum number of attributes has been reached");
- }
- catch (AttributeIException& E) // catching invalid action
+ // continuation here, that means no exception has been thrown
+ throw InvalidActionException("DataSet::createAttribute", "Maximum number of attributes has been reached");
+ }
+ catch (AttributeIException& E) // catching invalid action
{} // do nothing, exception expected
- PASSED();
+ PASSED();
} // end try block
catch (Exception& E)
{
- issue_fail_msg("test_attr_dense_create()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_dense_create()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_attr_dense_create()
@@ -1695,81 +1695,81 @@ static void test_attr_dense_create(FileCreatPropList& fcpl,
**
****************************************************************/
static void test_attr_corder_create_basic(FileCreatPropList& fcpl,
- FileAccPropList& fapl)
+ FileAccPropList& fapl)
{
// Output message about test being performed
SUBTEST("Basic Code for Attributes with Creation Order Info");
try {
- // Create file
- H5File fid1 (FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl);
-
- // Create dataset creation property list.
- DSetCreatPropList dcpl;
-
- // Get creation order indexing on object
- unsigned crt_order_flags = 0;
- crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (unsigned)0, "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
-
- // Setting invalid combination of a attribute order creation order
- // indexing on should fail
- try {
- dcpl.setAttrCrtOrder(H5P_CRT_ORDER_INDEXED);
-
- // continuation here, that means no exception has been thrown
- throw InvalidActionException("DSetCreatPropList::getAttrCrtOrder", "Indexing cannot be set alone, order tracking is required");
- }
- catch (PropListIException& E) // catching invalid action
+ // Create file
+ H5File fid1 (FILE_CRTPROPS, H5F_ACC_TRUNC, fcpl, fapl);
+
+ // Create dataset creation property list.
+ DSetCreatPropList dcpl;
+
+ // Get creation order indexing on object
+ unsigned crt_order_flags = 0;
+ crt_order_flags = dcpl.getAttrCrtOrder();
+ verify_val(crt_order_flags, (unsigned)0, "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
+
+ // Setting invalid combination of a attribute order creation order
+ // indexing on should fail
+ try {
+ dcpl.setAttrCrtOrder(H5P_CRT_ORDER_INDEXED);
+
+ // continuation here, that means no exception has been thrown
+ throw InvalidActionException("DSetCreatPropList::getAttrCrtOrder", "Indexing cannot be set alone, order tracking is required");
+ }
+ catch (PropListIException& E) // catching invalid action
{} // do nothing, exception expected
- // Set attribute creation order tracking & indexing for object then
- // verify them
- dcpl.setAttrCrtOrder(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);
- crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
+ // Set attribute creation order tracking & indexing for object then
+ // verify them
+ dcpl.setAttrCrtOrder(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED);
+ crt_order_flags = dcpl.getAttrCrtOrder();
+ verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
- // Create dataspace for dataset
- DataSpace ds_space(H5S_SCALAR);
+ // Create dataspace for dataset
+ DataSpace ds_space(H5S_SCALAR);
- // Create a dataset
- DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space, dcpl);
+ // Create a dataset
+ DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space, dcpl);
- // Close dataspace
- ds_space.close();
+ // Close dataspace
+ ds_space.close();
- // Check on dataset's attribute storage status.
- // NOTE: Wrappers not available yet (H5O_is_attr_empty_test
- // and H5O_is_attr_dense_test)
+ // Check on dataset's attribute storage status.
+ // NOTE: Wrappers not available yet (H5O_is_attr_empty_test
+ // and H5O_is_attr_dense_test)
- // Close dataset
- dataset.close();
+ // Close dataset
+ dataset.close();
- // Close property list
- dcpl.close();
+ // Close property list
+ dcpl.close();
- // Close file
- fid1.close();
+ // Close file
+ fid1.close();
- // Re-open file
- fid1.openFile(FILE_CRTPROPS, H5F_ACC_RDWR, fapl);
+ // Re-open file
+ fid1.openFile(FILE_CRTPROPS, H5F_ACC_RDWR, fapl);
- // Open dataset created previously
- dataset = fid1.openDataSet(DSET1_NAME);
+ // Open dataset created previously
+ dataset = fid1.openDataSet(DSET1_NAME);
- // Retrieve dataset creation property list for the dataset
- dcpl = dataset.getCreatePlist();
+ // Retrieve dataset creation property list for the dataset
+ dcpl = dataset.getCreatePlist();
- // Query the attribute creation properties
- crt_order_flags = dcpl.getAttrCrtOrder();
- verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
+ // Query the attribute creation properties
+ crt_order_flags = dcpl.getAttrCrtOrder();
+ verify_val(crt_order_flags, (unsigned)(H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED), "DSetCreatPropList::getAttrCrtOrder",__LINE__,__FILE__);
- PASSED();
+ PASSED();
} // end try block
catch (Exception& E)
{
- issue_fail_msg("test_attr_corder_create_basic()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr_corder_create_basic()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_attr_corder_create_basic()
@@ -1814,42 +1814,42 @@ void test_attr()
// Set the file access proplist for the type of format
if (new_format)
{
- MESSAGE(7, ("testing with new file format\n"));
- curr_fapl = fapl_new;
+ MESSAGE(7, ("testing with new file format\n"));
+ curr_fapl = fapl_new;
}
else
{
- MESSAGE(7, ("testing with old file format\n"));
- curr_fapl = fapl;
+ MESSAGE(7, ("testing with old file format\n"));
+ curr_fapl = fapl;
}
- test_attr_basic_write(); // Test basic H5A writing code
- test_attr_getname(); // Test overloads of Attribute::getName
- test_attr_rename(); // Test renaming attribute
- test_attr_basic_read(); // Test basic H5A reading code
+ test_attr_basic_write(); // Test basic H5A writing code
+ test_attr_getname(); // Test overloads of Attribute::getName
+ test_attr_rename(); // Test renaming attribute
+ test_attr_basic_read(); // Test basic H5A reading code
- test_attr_compound_write(); // Test complex datatype H5A writing code
- test_attr_compound_read(); // Test complex datatype H5A reading code
+ test_attr_compound_write(); // Test complex datatype H5A writing code
+ test_attr_compound_read(); // Test complex datatype H5A reading code
- test_attr_scalar_write(); // Test scalar dataspace H5A writing code
- test_attr_scalar_read(); // Test scalar dataspace H5A reading code
+ test_attr_scalar_write(); // Test scalar dataspace H5A writing code
+ test_attr_scalar_read(); // Test scalar dataspace H5A reading code
- test_attr_mult_write(); // Test writing multiple attributes
- test_attr_mult_read(); // Test reading multiple attributes
- test_attr_delete(); // Test deleting attributes
+ test_attr_mult_write(); // Test writing multiple attributes
+ test_attr_mult_read(); // Test reading multiple attributes
+ test_attr_delete(); // Test deleting attributes
- test_attr_dtype_shared(); // Test using shared datatypes in attributes
+ test_attr_dtype_shared(); // Test using shared datatypes in attributes
- test_string_attr(); // Test read/write string attribute
- test_attr_exists(); // Test H5Location::attrExists
+ test_string_attr(); // Test read/write string attribute
+ test_attr_exists(); // Test H5Location::attrExists
// Test with new format
if (new_format)
{
- // Test dense attribute storage creation
+ // Test dense attribute storage creation
test_attr_dense_create(fcpl, curr_fapl);
- // Test create objects with attribute creation info
+ // Test create objects with attribute creation info
test_attr_corder_create_basic(fcpl, curr_fapl);
}
} // end for
@@ -1857,18 +1857,18 @@ void test_attr()
catch (Exception& E)
{
- issue_fail_msg("test_attr()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_attr()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_attr()
/*-------------------------------------------------------------------------
- * Function: cleanup_attr
+ * Function cleanup_attr
*
- * Purpose: Cleanup temporary test files
+ * Purpose Cleanup temporary test files
*
- * Return: none
+ * Return none
*
- * Programmer: Albert Cheng
+ * Programmer Albert Cheng
* July 2, 1998
*
* Modifications:
diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp
index f49ebb2..ee634c2 100644
--- a/c++/test/tcompound.cpp
+++ b/c++/test/tcompound.cpp
@@ -34,7 +34,7 @@ using namespace H5;
#include "h5cpputil.h" // C++ utilility header file
/* Number of elements in each test */
-#define NTESTELEM 100000
+#define NTESTELEM 100000
typedef struct complex_t {
double re;
@@ -45,11 +45,11 @@ typedef struct complex_t {
/*-------------------------------------------------------------------------
* Function: test_compound_1
*
- * Purpose: Tests various things about compound data types.
+ * Purpose Tests various things about compound data types.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (using C version)
+ * Programmer Binh-Minh Ribler (using C version)
* January, 2007
*
* Modifications:
@@ -61,13 +61,13 @@ static void test_compound_1()
// Output message about test being performed
SUBTEST("Compound Data Types");
try {
- // Create an empty compound datatype
- CompType complex_type(sizeof(complex_t));
+ // Create an empty compound datatype
+ CompType complex_type(sizeof(complex_t));
- // Add a couple of fields
- complex_type.insertMember("real", HOFFSET(complex_t, re), PredType::NATIVE_DOUBLE);
- complex_type.insertMember("imaginary", HOFFSET(complex_t, im), PredType::NATIVE_DOUBLE);
- PASSED();
+ // Add a couple of fields
+ complex_type.insertMember("real", HOFFSET(complex_t, re), PredType::NATIVE_DOUBLE);
+ complex_type.insertMember("imaginary", HOFFSET(complex_t, im), PredType::NATIVE_DOUBLE);
+ PASSED();
} // end of try block
catch (Exception& E)
@@ -78,15 +78,15 @@ static void test_compound_1()
/*-------------------------------------------------------------------------
- * Function: test_compound_2
+ * Function: test_compound_2
*
- * Purpose: Tests a compound type conversion where the source and
- * destination are the same except for the order of the
- * elements.
+ * Purpose Tests a compound type conversion where the source and
+ * destination are the same except for the order of the
+ * elements.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
+ * Programmer Binh-Minh Ribler (use C version)
* January, 2007
*
* Modifications:
@@ -96,100 +96,100 @@ static void test_compound_1()
static void test_compound_2()
{
typedef struct {
- int a, b, c[4], d, e;
+ int a, b, c[4], d, e;
} src_typ_t;
typedef struct {
- int e, d, c[4], b, a;
+ int e, d, c[4], b, a;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- const int nelmts = NTESTELEM;
+ src_typ_t *s_ptr;
+ dst_typ_t *d_ptr;
+ const int nelmts = NTESTELEM;
const hsize_t four = 4;
- int i;
+ int i;
unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
ArrayType *array_dt = NULL;
// Output message about test being performed
SUBTEST("Compound Element Reordering");
try {
- // Sizes should be the same, but be careful just in case
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- s_ptr->c[0] = i*8+2;
- s_ptr->c[1] = i*8+3;
- s_ptr->c[2] = i*8+4;
- s_ptr->c[3] = i*8+5;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
- }
- memcpy(buf, orig, nelmts*sizeof(src_typ_t));
-
- // Build hdf5 datatypes
- array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
-
- // Create an empty compound datatype
- CompType st(sizeof(src_typ_t));
- st.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT);
- st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_INT);
- st.insertMember("c", HOFFSET(src_typ_t, c), *array_dt);
- st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT);
- st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT);
- array_dt->close();
+ // Sizes should be the same, but be careful just in case
+ buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
+ for (i=0; i<nelmts; i++) {
+ s_ptr = ((src_typ_t*)orig) + i;
+ s_ptr->a = i*8+0;
+ s_ptr->b = i*8+1;
+ s_ptr->c[0] = i*8+2;
+ s_ptr->c[1] = i*8+3;
+ s_ptr->c[2] = i*8+4;
+ s_ptr->c[3] = i*8+5;
+ s_ptr->d = i*8+6;
+ s_ptr->e = i*8+7;
+ }
+ memcpy(buf, orig, nelmts*sizeof(src_typ_t));
+
+ // Build hdf5 datatypes
+ array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
+
+ // Create an empty compound datatype
+ CompType st(sizeof(src_typ_t));
+ st.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT);
+ st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_INT);
+ st.insertMember("c", HOFFSET(src_typ_t, c), *array_dt);
+ st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT);
+ st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT);
+ array_dt->close();
delete array_dt;
- array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
-
- // Create an empty compound datatype
- CompType dt(sizeof(dst_typ_t));
- dt.insertMember("a", HOFFSET(dst_typ_t, a), PredType::NATIVE_INT);
- dt.insertMember("b", HOFFSET(dst_typ_t, b), PredType::NATIVE_INT);
- dt.insertMember("c", HOFFSET(dst_typ_t, c), *array_dt);
- dt.insertMember("d", HOFFSET(dst_typ_t, d), PredType::NATIVE_INT);
- dt.insertMember("e", HOFFSET(dst_typ_t, e), PredType::NATIVE_INT);
- array_dt->close();
-
- // Perform the conversion
- st.convert(dt, (size_t)nelmts, buf, bkg);
-
- // Compare results
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- d_ptr = ((dst_typ_t*)buf) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->b != d_ptr->b ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->d != d_ptr->d ||
- s_ptr->e != d_ptr->e) {
- H5_FAILED();
- cerr << " i=" << i << endl;
- cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b
- << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
- << s_ptr->c[2] << "," << s_ptr->c[3] << ", d="
- << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
- cerr << " dst={a=" << s_ptr->a << ", b=" << s_ptr->b
- << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
- << s_ptr->c[2] << "," << s_ptr->c[3] << ", d="
- << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
- }
- }
- // Release resources
- HDfree(buf);
- HDfree(bkg);
- HDfree(orig);
- s_ptr = NULL;
- d_ptr = NULL;
- st.close();
- dt.close();
- PASSED();
+ array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
+
+ // Create an empty compound datatype
+ CompType dt(sizeof(dst_typ_t));
+ dt.insertMember("a", HOFFSET(dst_typ_t, a), PredType::NATIVE_INT);
+ dt.insertMember("b", HOFFSET(dst_typ_t, b), PredType::NATIVE_INT);
+ dt.insertMember("c", HOFFSET(dst_typ_t, c), *array_dt);
+ dt.insertMember("d", HOFFSET(dst_typ_t, d), PredType::NATIVE_INT);
+ dt.insertMember("e", HOFFSET(dst_typ_t, e), PredType::NATIVE_INT);
+ array_dt->close();
+
+ // Perform the conversion
+ st.convert(dt, (size_t)nelmts, buf, bkg);
+
+ // Compare results
+ for (i=0; i<nelmts; i++) {
+ s_ptr = ((src_typ_t*)orig) + i;
+ d_ptr = ((dst_typ_t*)buf) + i;
+ if (s_ptr->a != d_ptr->a ||
+ s_ptr->b != d_ptr->b ||
+ s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] ||
+ s_ptr->c[2] != d_ptr->c[2] ||
+ s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->d != d_ptr->d ||
+ s_ptr->e != d_ptr->e) {
+ H5_FAILED();
+ cerr << " i=" << i << endl;
+ cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b
+ << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
+ << s_ptr->c[2] << "," << s_ptr->c[3] << ", d="
+ << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
+ cerr << " dst={a=" << s_ptr->a << ", b=" << s_ptr->b
+ << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
+ << s_ptr->c[2] << "," << s_ptr->c[3] << ", d="
+ << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
+ }
+ }
+ // Release resources
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+ s_ptr = NULL;
+ d_ptr = NULL;
+ st.close();
+ dt.close();
+ PASSED();
} // end of try block
catch (Exception& E)
@@ -203,15 +203,15 @@ static void test_compound_2()
/*-------------------------------------------------------------------------
- * Function: test_compound_3
+ * Function: test_compound_3
*
- * Purpose: Tests compound conversions where the source and destination
- * are the same except the destination is missing a couple
- * members which appear in the source.
+ * Purpose Tests compound conversions where the source and destination
+ * are the same except the destination is missing a couple
+ * members which appear in the source.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
+ * Programmer Binh-Minh Ribler (use C version)
* January, 2007
*
* Modifications:
@@ -221,16 +221,16 @@ static void test_compound_2()
static void test_compound_3()
{
typedef struct {
- int a, b, c[4], d, e;
+ int a, b, c[4], d, e;
} src_typ_t;
typedef struct {
- int a, c[4], e;
+ int a, c[4], e;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- int i;
- const int nelmts = NTESTELEM;
+ src_typ_t *s_ptr;
+ dst_typ_t *d_ptr;
+ int i;
+ const int nelmts = NTESTELEM;
const hsize_t four = 4;
unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
ArrayType* array_dt = NULL;
@@ -238,85 +238,85 @@ static void test_compound_3()
// Output message about test being performed
SUBTEST("Compound Datatype Subset Conversions");
try {
- /* Initialize */
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- s_ptr->c[0] = i*8+2;
- s_ptr->c[1] = i*8+3;
- s_ptr->c[2] = i*8+4;
- s_ptr->c[3] = i*8+5;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
- }
- memcpy(buf, orig, nelmts*sizeof(src_typ_t));
-
- /* Build hdf5 datatypes */
- array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
-
- // Create an empty compound datatype
- CompType st(sizeof(src_typ_t));
- st.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT);
- st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_INT);
- st.insertMember("c", HOFFSET(src_typ_t, c), *array_dt);
- st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT);
- st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT);
- array_dt->close();
+ /* Initialize */
+ buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
+ for (i=0; i<nelmts; i++) {
+ s_ptr = ((src_typ_t*)orig) + i;
+ s_ptr->a = i*8+0;
+ s_ptr->b = i*8+1;
+ s_ptr->c[0] = i*8+2;
+ s_ptr->c[1] = i*8+3;
+ s_ptr->c[2] = i*8+4;
+ s_ptr->c[3] = i*8+5;
+ s_ptr->d = i*8+6;
+ s_ptr->e = i*8+7;
+ }
+ memcpy(buf, orig, nelmts*sizeof(src_typ_t));
+
+ /* Build hdf5 datatypes */
+ array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
+
+ // Create an empty compound datatype
+ CompType st(sizeof(src_typ_t));
+ st.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT);
+ st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_INT);
+ st.insertMember("c", HOFFSET(src_typ_t, c), *array_dt);
+ st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT);
+ st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT);
+ array_dt->close();
delete array_dt;
- array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
-
- // Create an empty compound datatype
- CompType dt(sizeof(dst_typ_t));
- dt.insertMember("a", HOFFSET(dst_typ_t, a), PredType::NATIVE_INT);
- dt.insertMember("c", HOFFSET(dst_typ_t, c), *array_dt);
- dt.insertMember("e", HOFFSET(dst_typ_t, e), PredType::NATIVE_INT);
- array_dt->close();
-
- /* Perform the conversion */
- st.convert(dt, (size_t)nelmts, buf, bkg);
-
- /* Compare results */
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- d_ptr = ((dst_typ_t*)buf) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->e != d_ptr->e) {
- H5_FAILED();
- cerr << " i=" << i << endl;
- cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b
- << ", c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
- << s_ptr->c[2] << "," << s_ptr->c[3] << "], d="
- << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
- cerr << " dst={a=" << d_ptr->a
- << ", c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << ","
- << d_ptr->c[2] << "," << d_ptr->c[3] << "], e="
- << d_ptr->e << "}" << endl;
- } // if
- } // for
-
- /* Release resources */
- HDfree(buf);
- HDfree(bkg);
- HDfree(orig);
- s_ptr = NULL;
- d_ptr = NULL;
- st.close();
- dt.close();
- PASSED();
+ array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
+
+ // Create an empty compound datatype
+ CompType dt(sizeof(dst_typ_t));
+ dt.insertMember("a", HOFFSET(dst_typ_t, a), PredType::NATIVE_INT);
+ dt.insertMember("c", HOFFSET(dst_typ_t, c), *array_dt);
+ dt.insertMember("e", HOFFSET(dst_typ_t, e), PredType::NATIVE_INT);
+ array_dt->close();
+
+ /* Perform the conversion */
+ st.convert(dt, (size_t)nelmts, buf, bkg);
+
+ /* Compare results */
+ for (i=0; i<nelmts; i++) {
+ s_ptr = ((src_typ_t*)orig) + i;
+ d_ptr = ((dst_typ_t*)buf) + i;
+ if (s_ptr->a != d_ptr->a ||
+ s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] ||
+ s_ptr->c[2] != d_ptr->c[2] ||
+ s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->e != d_ptr->e) {
+ H5_FAILED();
+ cerr << " i=" << i << endl;
+ cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b
+ << ", c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
+ << s_ptr->c[2] << "," << s_ptr->c[3] << "], d="
+ << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
+ cerr << " dst={a=" << d_ptr->a
+ << ", c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << ","
+ << d_ptr->c[2] << "," << d_ptr->c[3] << "], e="
+ << d_ptr->e << "}" << endl;
+ } // if
+ } // for
+
+ /* Release resources */
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+ s_ptr = NULL;
+ d_ptr = NULL;
+ st.close();
+ dt.close();
+ PASSED();
} // end of try block
catch (Exception& E)
{
- issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
}
if(array_dt)
@@ -325,16 +325,16 @@ static void test_compound_3()
/*-------------------------------------------------------------------------
- * Function: test_compound_4
+ * Function: test_compound_4
*
- * Purpose: Tests compound conversions when the destination has the same
- * fields as the source but one or more of the fields are
- * smaller.
+ * Purpose Tests compound conversions when the destination has the same
+ * fields as the source but one or more of the fields are
+ * smaller.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (use C version)
+ * January, 2007
*
* Modifications:
*
@@ -344,20 +344,20 @@ static void test_compound_4()
{
typedef struct {
- int a, b, c[4], d, e;
+ int a, b, c[4], d, e;
} src_typ_t;
typedef struct {
- short b;
- int a, c[4];
- short d;
- int e;
+ short b;
+ int a, c[4];
+ short d;
+ int e;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- int i;
- const int nelmts = NTESTELEM;
+ src_typ_t *s_ptr;
+ dst_typ_t *d_ptr;
+ int i;
+ const int nelmts = NTESTELEM;
const hsize_t four = 4;
unsigned char *buf = NULL, *orig = NULL, *bkg = NULL;
ArrayType* array_dt = NULL;
@@ -365,85 +365,85 @@ static void test_compound_4()
// Output message about test being performed
SUBTEST("Compound Element Shrinking & Reordering");
try {
- /* Sizes should be the same, but be careful just in case */
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- s_ptr->a = i*8+0;
- s_ptr->b = (i*8+1) & 0x7fff;
- s_ptr->c[0] = i*8+2;
- s_ptr->c[1] = i*8+3;
- s_ptr->c[2] = i*8+4;
- s_ptr->c[3] = i*8+5;
- s_ptr->d = (i*8+6) & 0x7fff;
- s_ptr->e = i*8+7;
- }
- memcpy(buf, orig, nelmts*sizeof(src_typ_t));
-
- /* Build hdf5 datatypes */
- array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
-
- // Create an empty compound datatype
- CompType st(sizeof(src_typ_t));
- st.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT);
- st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_INT);
- st.insertMember("c", HOFFSET(src_typ_t, c), *array_dt);
- st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT);
- st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT);
- array_dt->close();
+ /* Sizes should be the same, but be careful just in case */
+ buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
+ for (i=0; i<nelmts; i++) {
+ s_ptr = ((src_typ_t*)orig) + i;
+ s_ptr->a = i*8+0;
+ s_ptr->b = (i*8+1) & 0x7fff;
+ s_ptr->c[0] = i*8+2;
+ s_ptr->c[1] = i*8+3;
+ s_ptr->c[2] = i*8+4;
+ s_ptr->c[3] = i*8+5;
+ s_ptr->d = (i*8+6) & 0x7fff;
+ s_ptr->e = i*8+7;
+ }
+ memcpy(buf, orig, nelmts*sizeof(src_typ_t));
+
+ /* Build hdf5 datatypes */
+ array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
+
+ // Create an empty compound datatype
+ CompType st(sizeof(src_typ_t));
+ st.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT);
+ st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_INT);
+ st.insertMember("c", HOFFSET(src_typ_t, c), *array_dt);
+ st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_INT);
+ st.insertMember("e", HOFFSET(src_typ_t, e), PredType::NATIVE_INT);
+ array_dt->close();
delete array_dt;
- array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
-
- // Create an empty compound datatype
- CompType dt(sizeof(dst_typ_t));
- dt.insertMember("a", HOFFSET(dst_typ_t, a), PredType::NATIVE_INT);
- dt.insertMember("b", HOFFSET(dst_typ_t, b), PredType::NATIVE_SHORT);
- dt.insertMember("c", HOFFSET(dst_typ_t, c), *array_dt);
- dt.insertMember("d", HOFFSET(dst_typ_t, d), PredType::NATIVE_SHORT);
- dt.insertMember("e", HOFFSET(dst_typ_t, e), PredType::NATIVE_INT);
- array_dt->close();
-
- /* Perform the conversion */
- st.convert(dt, (size_t)nelmts, buf, bkg);
-
- /* Compare results */
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- d_ptr = ((dst_typ_t*)buf) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->b != d_ptr->b ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->d != d_ptr->d ||
- s_ptr->e != d_ptr->e)
- {
- H5_FAILED();
- cerr << " i=" << i << endl;
- cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b
- << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
- << s_ptr->c[2] << "," << s_ptr->c[3] << ", d="
- << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
- cerr << " dst={a=" << d_ptr->a << ", b=" << d_ptr->b
- << "c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << ","
- << d_ptr->c[2] << "," << d_ptr->c[3] << ", d="
- << d_ptr->d << ", e=" << d_ptr->e << "}" << endl;
- } // if
- } // for
-
- /* Release resources */
- HDfree(buf);
- HDfree(bkg);
- HDfree(orig);
- s_ptr = NULL;
- d_ptr = NULL;
- st.close();
- dt.close();
- PASSED();
+ array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
+
+ // Create an empty compound datatype
+ CompType dt(sizeof(dst_typ_t));
+ dt.insertMember("a", HOFFSET(dst_typ_t, a), PredType::NATIVE_INT);
+ dt.insertMember("b", HOFFSET(dst_typ_t, b), PredType::NATIVE_SHORT);
+ dt.insertMember("c", HOFFSET(dst_typ_t, c), *array_dt);
+ dt.insertMember("d", HOFFSET(dst_typ_t, d), PredType::NATIVE_SHORT);
+ dt.insertMember("e", HOFFSET(dst_typ_t, e), PredType::NATIVE_INT);
+ array_dt->close();
+
+ /* Perform the conversion */
+ st.convert(dt, (size_t)nelmts, buf, bkg);
+
+ /* Compare results */
+ for (i=0; i<nelmts; i++) {
+ s_ptr = ((src_typ_t*)orig) + i;
+ d_ptr = ((dst_typ_t*)buf) + i;
+ if (s_ptr->a != d_ptr->a ||
+ s_ptr->b != d_ptr->b ||
+ s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] ||
+ s_ptr->c[2] != d_ptr->c[2] ||
+ s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->d != d_ptr->d ||
+ s_ptr->e != d_ptr->e)
+ {
+ H5_FAILED();
+ cerr << " i=" << i << endl;
+ cerr << " src={a=" << s_ptr->a << ", b=" << s_ptr->b
+ << "c=[" << s_ptr->c[0] << "," << s_ptr->c[1] << ","
+ << s_ptr->c[2] << "," << s_ptr->c[3] << ", d="
+ << s_ptr->d << ", e=" << s_ptr->e << "}" << endl;
+ cerr << " dst={a=" << d_ptr->a << ", b=" << d_ptr->b
+ << "c=[" << d_ptr->c[0] << "," << d_ptr->c[1] << ","
+ << d_ptr->c[2] << "," << d_ptr->c[3] << ", d="
+ << d_ptr->d << ", e=" << d_ptr->e << "}" << endl;
+ } // if
+ } // for
+
+ /* Release resources */
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+ s_ptr = NULL;
+ d_ptr = NULL;
+ st.close();
+ dt.close();
+ PASSED();
} // end of try block
catch (Exception& E)
@@ -457,17 +457,17 @@ static void test_compound_4()
/*-------------------------------------------------------------------------
- * Function: test_compound_5
+ * Function: test_compound_5
*
- * Purpose: Many versions of HDF5 have a bug in the optimized compound
+ * Purpose Many versions of HDF5 have a bug in the optimized compound
* datatype conversion function, H5T_conv_struct_opt(), which
* is triggered when the top-level type contains a struct
* which must undergo a conversion.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (use C version)
+ * January, 2007
*
* Modifications:
*
@@ -499,55 +499,55 @@ static void test_compound_5()
SUBTEST("Optimized Struct Converter");
try {
- /* Build datatypes */
- array_dt = new ArrayType(PredType::NATIVE_SHORT, 1, dims);
- CompType short_array(4*sizeof(short));
- short_array.insertMember("_", 0, *array_dt);
- array_dt->close();
+ /* Build datatypes */
+ array_dt = new ArrayType(PredType::NATIVE_SHORT, 1, dims);
+ CompType short_array(4*sizeof(short));
+ short_array.insertMember("_", 0, *array_dt);
+ array_dt->close();
delete array_dt;
- CompType int_array(4*sizeof(int));
- array_dt = new ArrayType(PredType::NATIVE_INT, 1, dims);
- int_array.insertMember("_", 0, *array_dt);
- array_dt->close();
-
- StrType strg(PredType::C_S1, 16);
- CompType src_type(sizeof(src_typ_t));
- src_type.insertMember("name", HOFFSET(src_typ_t, name), strg);
- src_type.insertMember("tdim", HOFFSET(src_typ_t, tdim), PredType::NATIVE_SHORT);
- src_type.insertMember("coll_ids", HOFFSET(src_typ_t, coll_ids), short_array);
-
- CompType dst_type(sizeof(dst_typ_t));
- dst_type.insertMember("name", HOFFSET(dst_typ_t, name), strg);
- dst_type.insertMember("tdim", HOFFSET(dst_typ_t, tdim), PredType::NATIVE_SHORT);
- dst_type.insertMember("coll_ids", HOFFSET(dst_typ_t, coll_ids), int_array);
-
- /* Convert data */
- memcpy(buf, src, sizeof(src));
- src_type.convert(dst_type, (size_t)2, buf, bkg);
- dst = (dst_typ_t*)buf;
-
- /* Cleanup */
- src_type.close();
- dst_type.close();
- strg.close();
- short_array.close();
- int_array.close();
-
- /* Check results */
- if (memcmp(src[1].name, dst[1].name, sizeof(src[1].name)) ||
- src[1].tdim!=dst[1].tdim ||
- src[1].coll_ids[0]!=dst[1].coll_ids[0] ||
- src[1].coll_ids[1]!=dst[1].coll_ids[1] ||
- src[1].coll_ids[2]!=dst[1].coll_ids[2] ||
- src[1].coll_ids[3]!=dst[1].coll_ids[3])
- { H5_FAILED(); }
-
- /* Free memory buffers */
- HDfree(buf);
- HDfree(bkg);
- dst = NULL;
- PASSED();
+ CompType int_array(4*sizeof(int));
+ array_dt = new ArrayType(PredType::NATIVE_INT, 1, dims);
+ int_array.insertMember("_", 0, *array_dt);
+ array_dt->close();
+
+ StrType strg(PredType::C_S1, 16);
+ CompType src_type(sizeof(src_typ_t));
+ src_type.insertMember("name", HOFFSET(src_typ_t, name), strg);
+ src_type.insertMember("tdim", HOFFSET(src_typ_t, tdim), PredType::NATIVE_SHORT);
+ src_type.insertMember("coll_ids", HOFFSET(src_typ_t, coll_ids), short_array);
+
+ CompType dst_type(sizeof(dst_typ_t));
+ dst_type.insertMember("name", HOFFSET(dst_typ_t, name), strg);
+ dst_type.insertMember("tdim", HOFFSET(dst_typ_t, tdim), PredType::NATIVE_SHORT);
+ dst_type.insertMember("coll_ids", HOFFSET(dst_typ_t, coll_ids), int_array);
+
+ /* Convert data */
+ memcpy(buf, src, sizeof(src));
+ src_type.convert(dst_type, (size_t)2, buf, bkg);
+ dst = (dst_typ_t*)buf;
+
+ /* Cleanup */
+ src_type.close();
+ dst_type.close();
+ strg.close();
+ short_array.close();
+ int_array.close();
+
+ /* Check results */
+ if (memcmp(src[1].name, dst[1].name, sizeof(src[1].name)) ||
+ src[1].tdim!=dst[1].tdim ||
+ src[1].coll_ids[0]!=dst[1].coll_ids[0] ||
+ src[1].coll_ids[1]!=dst[1].coll_ids[1] ||
+ src[1].coll_ids[2]!=dst[1].coll_ids[2] ||
+ src[1].coll_ids[3]!=dst[1].coll_ids[3])
+ { H5_FAILED(); }
+
+ /* Free memory buffers */
+ HDfree(buf);
+ HDfree(bkg);
+ dst = NULL;
+ PASSED();
} // end of try block
catch (Exception& E)
@@ -561,16 +561,16 @@ static void test_compound_5()
/*-------------------------------------------------------------------------
- * Function: test_compound_6
+ * Function: test_compound_6
*
- * Purpose: Tests compound conversions when the destination has the same
- * fields as the source but one or more of the fields are
- * larger.
+ * Purpose Tests compound conversions when the destination has the same
+ * fields as the source but one or more of the fields are
+ * larger.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (use C version)
+ * January, 2007
*
* Modifications:
*
@@ -579,72 +579,72 @@ static void test_compound_5()
static void test_compound_6()
{
typedef struct {
- short b;
- short d;
+ short b;
+ short d;
} src_typ_t;
typedef struct {
- long b;
- long d;
+ long b;
+ long d;
} dst_typ_t;
- src_typ_t *s_ptr;
- dst_typ_t *d_ptr;
- int i;
- const int nelmts = NTESTELEM;
+ src_typ_t *s_ptr;
+ dst_typ_t *d_ptr;
+ int i;
+ const int nelmts = NTESTELEM;
unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
// Output message about test being performed
SUBTEST("Compound Element Growing");
try {
- /* Sizes should be the same, but be careful just in case */
- buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
- bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
- orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- s_ptr->b = (i*8+1) & 0x7fff;
- s_ptr->d = (i*8+6) & 0x7fff;
- }
- memcpy(buf, orig, nelmts*sizeof(src_typ_t));
-
- /* Build hdf5 datatypes */
- CompType st(sizeof(src_typ_t));
- st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_SHORT);
- st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_SHORT);
-
- CompType dt(sizeof(dst_typ_t));
- dt.insertMember("b", HOFFSET(dst_typ_t, b), PredType::NATIVE_LONG);
- dt.insertMember("d", HOFFSET(dst_typ_t, d), PredType::NATIVE_LONG);
-
- /* Perform the conversion */
- st.convert(dt, (size_t)nelmts, buf, bkg);
-
- /* Compare results */
- for (i=0; i<nelmts; i++) {
- s_ptr = ((src_typ_t*)orig) + i;
- d_ptr = ((dst_typ_t*)buf) + i;
- if (s_ptr->b != d_ptr->b ||
- s_ptr->d != d_ptr->d)
- {
- H5_FAILED();
- cerr << " i=" << i << endl;
- cerr << " src={b=" << s_ptr->b << ", d=" << s_ptr->d
- << "}" << endl;
- cerr << " dst={b=" << d_ptr->b << ", d=" << d_ptr->d
- << "}" << endl;
- } // if
- } // for
-
- /* Release resources */
- HDfree(buf);
- HDfree(bkg);
- HDfree(orig);
- s_ptr = NULL;
- d_ptr = NULL;
- st.close();
- dt.close();
- PASSED();
+ /* Sizes should be the same, but be careful just in case */
+ buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t)));
+ bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t));
+ orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t));
+ for (i=0; i<nelmts; i++) {
+ s_ptr = ((src_typ_t*)orig) + i;
+ s_ptr->b = (i*8+1) & 0x7fff;
+ s_ptr->d = (i*8+6) & 0x7fff;
+ }
+ memcpy(buf, orig, nelmts*sizeof(src_typ_t));
+
+ /* Build hdf5 datatypes */
+ CompType st(sizeof(src_typ_t));
+ st.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_SHORT);
+ st.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_SHORT);
+
+ CompType dt(sizeof(dst_typ_t));
+ dt.insertMember("b", HOFFSET(dst_typ_t, b), PredType::NATIVE_LONG);
+ dt.insertMember("d", HOFFSET(dst_typ_t, d), PredType::NATIVE_LONG);
+
+ /* Perform the conversion */
+ st.convert(dt, (size_t)nelmts, buf, bkg);
+
+ /* Compare results */
+ for (i=0; i<nelmts; i++) {
+ s_ptr = ((src_typ_t*)orig) + i;
+ d_ptr = ((dst_typ_t*)buf) + i;
+ if (s_ptr->b != d_ptr->b ||
+ s_ptr->d != d_ptr->d)
+ {
+ H5_FAILED();
+ cerr << " i=" << i << endl;
+ cerr << " src={b=" << s_ptr->b << ", d=" << s_ptr->d
+ << "}" << endl;
+ cerr << " dst={b=" << d_ptr->b << ", d=" << d_ptr->d
+ << "}" << endl;
+ } // if
+ } // for
+
+ /* Release resources */
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+ s_ptr = NULL;
+ d_ptr = NULL;
+ st.close();
+ dt.close();
+ PASSED();
} // end of try block
catch (Exception& E)
@@ -654,15 +654,15 @@ static void test_compound_6()
} // test_compound_6()
/*-------------------------------------------------------------------------
- * Function: test_compound_7
+ * Function: test_compound_7
*
- * Purpose: Tests inserting fields into compound datatypes when the field
- * overlaps the end of the compound datatype.
+ * Purpose Tests inserting fields into compound datatypes when the field
+ * overlaps the end of the compound datatype.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (use C version)
+ * January, 2007
*
* Modifications:
*
@@ -671,47 +671,47 @@ static void test_compound_6()
static void test_compound_7()
{
typedef struct {
- int a;
- float b;
- long c;
+ int a;
+ float b;
+ long c;
} s1_typ_t;
typedef struct {
- int a;
- float b;
- long c;
- double d;
+ int a;
+ float b;
+ long c;
+ double d;
} s2_typ_t;
// Output message about test being performed
SUBTEST("Compound Element Insertion");
try {
- CompType tid1(sizeof(s1_typ_t));
+ CompType tid1(sizeof(s1_typ_t));
- tid1.insertMember("a", HOFFSET(s1_typ_t,a),PredType::NATIVE_INT);
- tid1.insertMember("b", HOFFSET(s1_typ_t,b),PredType::NATIVE_FLOAT);
- tid1.insertMember("c", HOFFSET(s1_typ_t,c),PredType::NATIVE_LONG);
+ tid1.insertMember("a", HOFFSET(s1_typ_t,a),PredType::NATIVE_INT);
+ tid1.insertMember("b", HOFFSET(s1_typ_t,b),PredType::NATIVE_FLOAT);
+ tid1.insertMember("c", HOFFSET(s1_typ_t,c),PredType::NATIVE_LONG);
- size_t type_size = tid1.getSize();
- verify_val(type_size, sizeof(s1_typ_t), "DataType::getSize", __LINE__, __FILE__);
+ size_t type_size = tid1.getSize();
+ verify_val(type_size, sizeof(s1_typ_t), "DataType::getSize", __LINE__, __FILE__);
- CompType tid2;
- tid2.copy(tid1);
+ CompType tid2;
+ tid2.copy(tid1);
- type_size = tid2.getSize();
- verify_val_noteq(type_size, sizeof(s2_typ_t), "DataType::getSize", __LINE__, __FILE__);
+ type_size = tid2.getSize();
+ verify_val_noteq(type_size, sizeof(s2_typ_t), "DataType::getSize", __LINE__, __FILE__);
- /* Should not be able to insert field past end of compound datatype */
- try {
- tid2.insertMember("d", HOFFSET(s2_typ_t, d), PredType::NATIVE_DOUBLE);
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("CompType::insertMember", "Attempted to insert field past end of compound data type.");
- } catch (DataTypeIException& err) {}
+ /* Should not be able to insert field past end of compound datatype */
+ try {
+ tid2.insertMember("d", HOFFSET(s2_typ_t, d), PredType::NATIVE_DOUBLE);
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("CompType::insertMember", "Attempted to insert field past end of compound data type.");
+ } catch (DataTypeIException& err) {}
- /* Release resources */
- tid1.close();
- tid2.close();
- PASSED();
+ /* Release resources */
+ tid1.close();
+ tid2.close();
+ PASSED();
} // end of try block
catch (Exception& E)
@@ -721,13 +721,13 @@ static void test_compound_7()
} // test_compound_7()
/*-------------------------------------------------------------------------
- * Function: test_compound_set_size
+ * Function: test_compound_set_size
*
- * Purpose: Tests member function setSize() on compound datatype
+ * Purpose Tests member function setSize() on compound datatype
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use partial C version test_ooo_order)
+ * Programmer Binh-Minh Ribler (use partial C version test_ooo_order)
* March, 2014
*
* Modifications:
@@ -738,7 +738,7 @@ const H5std_string COMPFILE("tcompound_types.h5");
static void test_compound_set_size()
{
typedef struct {
- int a, b, c[4], d, e;
+ int a, b, c[4], d, e;
} src_typ_t;
// Output message about test being performed
@@ -755,53 +755,53 @@ static void test_compound_set_size()
dtype.insertMember("c", HOFFSET(src_typ_t, c), PredType::NATIVE_LONG);
dtype.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_DOUBLE);
- // Verify that the compound is not packed
- // bool packed = dtype.packed(); // not until C library provides API
- // verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__);
+ // Verify that the compound is not packed
+ // bool packed = dtype.packed(); // not until C library provides API
+ // verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__);
- dtype.commit(file, "dtype");
+ dtype.commit(file, "dtype");
- // Close the type and file
- dtype.close();
- file.close();
+ // Close the type and file
+ dtype.close();
+ file.close();
- // Open the file for read/write
- file.openFile(COMPFILE, H5F_ACC_RDWR);
+ // Open the file for read/write
+ file.openFile(COMPFILE, H5F_ACC_RDWR);
- // Open the data type "dtype"
- CompType dtype_tmp = file.openCompType("dtype");
+ // Open the data type "dtype"
+ CompType dtype_tmp = file.openCompType("dtype");
- // Make a copy of the data type
- dtype.copy(dtype_tmp);
+ // Make a copy of the data type
+ dtype.copy(dtype_tmp);
- // Verify that the compound is not packed
- // packed = dtype_tmp.packed(); // not until C library provides API
- // verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__);
+ // Verify that the compound is not packed
+ // packed = dtype_tmp.packed(); // not until C library provides API
+ // verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__);
- // Expand the type, and verify that it became unpacked
- dtype.setSize((size_t)33);
- // packed = dtype.packed(); // not until C library provides API
- // verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__);
+ // Expand the type, and verify that it became unpacked
+ dtype.setSize((size_t)33);
+ // packed = dtype.packed(); // not until C library provides API
+ // verify_val(packed, FALSE, "DataType::packed", __LINE__, __FILE__);
- // Verify setSize() actually set size
- size_t new_size = dtype.getSize();
- verify_val(new_size, (size_t)33, "DataType::getSize", __LINE__, __FILE__);
+ // Verify setSize() actually set size
+ size_t new_size = dtype.getSize();
+ verify_val(new_size, (size_t)33, "DataType::getSize", __LINE__, __FILE__);
- // Shrink the type, and verify that it became packed
- dtype.setSize((size_t)32);
- // packed = dtype.packed(); // not until C library provides API
- // verify_val(packed, TRUE, "DataType::packed", __LINE__, __FILE__);
+ // Shrink the type, and verify that it became packed
+ dtype.setSize((size_t)32);
+ // packed = dtype.packed(); // not until C library provides API
+ // verify_val(packed, TRUE, "DataType::packed", __LINE__, __FILE__);
- // Verify setSize() actually set size again
- new_size = dtype.getSize();
- verify_val(new_size, (size_t)32, "DataType::getSize", __LINE__, __FILE__);
+ // Verify setSize() actually set size again
+ new_size = dtype.getSize();
+ verify_val(new_size, (size_t)32, "DataType::getSize", __LINE__, __FILE__);
- /* Close types and file */
- dtype_tmp.close();
- dtype.close();
- file.close();
+ /* Close types and file */
+ dtype_tmp.close();
+ dtype.close();
+ file.close();
- PASSED();
+ PASSED();
} // end of try block
catch (Exception& E)
@@ -811,14 +811,14 @@ static void test_compound_set_size()
} // test_compound_set_size()
/*-------------------------------------------------------------------------
- * Function: test_compound
+ * Function: test_compound
*
- * Purpose: Main compound datatype testing routine
+ * Purpose Main compound datatype testing routine
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler
- * January 2007
+ * Programmer Binh-Minh Ribler
+ * January 2007
*
* Modifications:
*
@@ -830,23 +830,23 @@ void test_compound()
// Output message about test being performed
MESSAGE(5, ("Testing Compound Data Type operations\n"));
- test_compound_1(); // various things about compound data types
- test_compound_2(); // compound element reordering
- test_compound_3(); // compound datatype subset conversions
- test_compound_4(); // compound element shrinking & reordering
- test_compound_5(); // optimized struct converter
- test_compound_6(); // compound element growing
- test_compound_7(); // compound element insertion
- test_compound_set_size(); // set size on compound data types
+ test_compound_1(); // various things about compound data types
+ test_compound_2(); // compound element reordering
+ test_compound_3(); // compound datatype subset conversions
+ test_compound_4(); // compound element shrinking & reordering
+ test_compound_5(); // optimized struct converter
+ test_compound_6(); // compound element growing
+ test_compound_7(); // compound element insertion
+ test_compound_set_size(); // set size on compound data types
} // test_compound()
/*-------------------------------------------------------------------------
- * Function: cleanup_compound
+ * Function: cleanup_compound
*
- * Purpose: Cleanup temporary test files - nothing at this time.
+ * Purpose Cleanup temporary test files - nothing at this time.
*
- * Return: none
+ * Return none
*
* Modifications:
*
diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp
index d733ffe..f39694b 100644
--- a/c++/test/tdspl.cpp
+++ b/c++/test/tdspl.cpp
@@ -16,7 +16,7 @@
/*****************************************************************************
FILE
tdspl.cpp - HDF5 C++ testing the dataset memory and transfer property
- list functionality
+ list functionality
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
@@ -45,70 +45,70 @@ static void test_transfplist()
SUBTEST("DSetMemXferPropList::set/getDataTransform()");
try {
- // Create various data set prop lists and set data transform expression.
- DSetMemXferPropList dxpl_c_to_f(c_to_f);
-
- DSetMemXferPropList dxpl_simple;
- dxpl_simple.setDataTransform(simple);
-
- DSetMemXferPropList dxpl_utrans_inv;
- dxpl_utrans_inv.setDataTransform(utrans_inv);
-
- //
- // Make a copy of one of those prop lists then read the data transform
- // expression and verify that it's the same as the original.
- //
-
- // Copy the prop list.
- DSetMemXferPropList dxpl_c_to_f_copy;
- dxpl_c_to_f_copy.copy(dxpl_c_to_f);
-
- // Find out the length of the transform expression, allocate the buffer
- // for it, then read and verify the expression from the copied plist
- ssize_t tran_len = dxpl_c_to_f_copy.getDataTransform(NULL);
- char *c_to_f_read = (char *)HDmalloc(tran_len+1);
- HDmemset(c_to_f_read, 0, tran_len+1);
- dxpl_c_to_f_copy.getDataTransform(c_to_f_read, tran_len+1);
- verify_val((const char*)c_to_f_read, (const char*)c_to_f,
- "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
- HDfree(c_to_f_read);
-
- //
- // Read the expression of each of the prop lists and verify the read
- // expression
- //
-
- // Get and verify the expression with:
- // ssize_t getDataTransform(char* exp, const size_t buf_size [default=0])
- tran_len = dxpl_c_to_f.getDataTransform(NULL);
- c_to_f_read = (char *)HDmalloc(tran_len+1);
- HDmemset(c_to_f_read, 0, tran_len+1);
- dxpl_c_to_f.getDataTransform(c_to_f_read, tran_len+1);
- verify_val((const char*)c_to_f_read, (const char*)c_to_f,
- "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
- HDfree(c_to_f_read);
-
- // Get and verify the expression with:
- // H5std_string DSetMemXferPropList::getDataTransform()
- H5std_string simple_read = dxpl_simple.getDataTransform();
- verify_val((const char*)simple_read.c_str(), (const char*)simple,
- "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
-
- // Get and verify the expression with:
- // ssize_t getDataTransform(char* exp, const size_t buf_size)
- tran_len = dxpl_utrans_inv.getDataTransform(NULL, 0);
- char *utrans_inv_read = (char *)HDmalloc(tran_len+1);
- HDmemset(utrans_inv_read, 0, tran_len+1);
- dxpl_utrans_inv.getDataTransform(utrans_inv_read, tran_len+1);
- verify_val((const char*)utrans_inv_read, (const char*)utrans_inv,
- "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
- HDfree(utrans_inv_read);
-
- PASSED();
+ // Create various data set prop lists and set data transform expression.
+ DSetMemXferPropList dxpl_c_to_f(c_to_f);
+
+ DSetMemXferPropList dxpl_simple;
+ dxpl_simple.setDataTransform(simple);
+
+ DSetMemXferPropList dxpl_utrans_inv;
+ dxpl_utrans_inv.setDataTransform(utrans_inv);
+
+ //
+ // Make a copy of one of those prop lists then read the data transform
+ // expression and verify that it's the same as the original.
+ //
+
+ // Copy the prop list.
+ DSetMemXferPropList dxpl_c_to_f_copy;
+ dxpl_c_to_f_copy.copy(dxpl_c_to_f);
+
+ // Find out the length of the transform expression, allocate the buffer
+ // for it, then read and verify the expression from the copied plist
+ ssize_t tran_len = dxpl_c_to_f_copy.getDataTransform(NULL);
+ char *c_to_f_read = (char *)HDmalloc(tran_len+1);
+ HDmemset(c_to_f_read, 0, tran_len+1);
+ dxpl_c_to_f_copy.getDataTransform(c_to_f_read, tran_len+1);
+ verify_val((const char*)c_to_f_read, (const char*)c_to_f,
+ "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
+ HDfree(c_to_f_read);
+
+ //
+ // Read the expression of each of the prop lists and verify the read
+ // expression
+ //
+
+ // Get and verify the expression with:
+ // ssize_t getDataTransform(char* exp, const size_t buf_size [default=0])
+ tran_len = dxpl_c_to_f.getDataTransform(NULL);
+ c_to_f_read = (char *)HDmalloc(tran_len+1);
+ HDmemset(c_to_f_read, 0, tran_len+1);
+ dxpl_c_to_f.getDataTransform(c_to_f_read, tran_len+1);
+ verify_val((const char*)c_to_f_read, (const char*)c_to_f,
+ "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
+ HDfree(c_to_f_read);
+
+ // Get and verify the expression with:
+ // H5std_string DSetMemXferPropList::getDataTransform()
+ H5std_string simple_read = dxpl_simple.getDataTransform();
+ verify_val((const char*)simple_read.c_str(), (const char*)simple,
+ "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
+
+ // Get and verify the expression with:
+ // ssize_t getDataTransform(char* exp, const size_t buf_size)
+ tran_len = dxpl_utrans_inv.getDataTransform(NULL, 0);
+ char *utrans_inv_read = (char *)HDmalloc(tran_len+1);
+ HDmemset(utrans_inv_read, 0, tran_len+1);
+ dxpl_utrans_inv.getDataTransform(utrans_inv_read, tran_len+1);
+ verify_val((const char*)utrans_inv_read, (const char*)utrans_inv,
+ "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
+ HDfree(utrans_inv_read);
+
+ PASSED();
}
catch (Exception& E)
{
- issue_fail_msg("test_transfplist", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_transfplist", __LINE__, __FILE__, E.getCDetailMsg());
}
}
diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp
index 28ede6b..779c931 100644
--- a/c++/test/testhdf5.cpp
+++ b/c++/test/testhdf5.cpp
@@ -28,16 +28,16 @@
base functionality testing.
EXTERNAL ROUTINES/VARIABLES:
- TestInit(...) -- Initialize testing framework
- TestInfo(...) -- Print test info
- AddTest(...) -- Setup a test function and add it to the list of tests
- TestParseCmdLine(...) -- Parse command line arguments
- PerformTests() -- Perform requested testing
- GetTestSummary() -- Retrieve Summary request value
- TestSummary() -- Display test summary
- GetTestCleanup() -- Retrieve Cleanup request value
- TestCleanup() -- Clean up files from testing
- GetTestNumErrs() -- Retrieve the number of testing errors
+ TestInit(...) -- Initialize testing framework
+ TestInfo(...) -- Print test info
+ AddTest(...) -- Setup a test function and add it to the list of tests
+ TestParseCmdLine(...) -- Parse command line arguments
+ PerformTests() -- Perform requested testing
+ GetTestSummary() -- Retrieve Summary request value
+ TestSummary() -- Display test summary
+ GetTestCleanup() -- Retrieve Cleanup request value
+ TestCleanup() -- Clean up files from testing
+ GetTestNumErrs() -- Retrieve the number of testing errors
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
@@ -60,47 +60,47 @@ main(int argc, char *argv[])
{
try
{
- // Turn of the auto-printing when failure occurs so that we can
- // handle the errors appropriately since sometime failures are
- // caused deliberately and expected.
- Exception::dontPrint();
- /* Initialize testing framework */
- TestInit(argv[0], NULL, NULL);
-
- // testing file creation and opening in tfile.cpp
- AddTest("tfile", test_file, cleanup_file, "File I/O Operations", NULL);
- // testing dataset functionalities in dset.cpp
- AddTest("dsets", test_dset, cleanup_dsets, "Dataset I/O Operations", NULL);
- // testing dataspace functionalities in th5s.cpp
- AddTest("th5s", test_h5s, cleanup_h5s, "Dataspaces", NULL);
- // testing attribute functionalities in tattr.cpp
- AddTest("tattr", test_attr, cleanup_attr, "Attributes", NULL);
- // testing object functionalities in tobject.cpp
- AddTest("tobject", test_object, cleanup_object, "Objects", NULL);
- // testing reference functionalities in trefer.cpp
- AddTest("trefer", test_reference, cleanup_reference, "References", NULL);
- // testing variable-length strings in tvlstr.cpp
- AddTest("tvlstr", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL);
- AddTest("ttypes", test_types, cleanup_types, "Generic Data Types", NULL);
- AddTest("tarray", test_array, cleanup_array, "Array Datatypes", NULL);
- AddTest("tcompound", test_compound, cleanup_compound, "Compound Data Types", NULL);
- AddTest("tdspl", test_dsproplist, cleanup_dsproplist, "Dataset Property List", NULL);
- AddTest("tfilter", test_filters, cleanup_filters, "Various Filters", NULL);
- AddTest("tlinks", test_links, cleanup_links, "Various Links", NULL);
+ // Turn of the auto-printing when failure occurs so that we can
+ // handle the errors appropriately since sometime failures are
+ // caused deliberately and expected.
+ Exception::dontPrint();
+ /* Initialize testing framework */
+ TestInit(argv[0], NULL, NULL);
+
+ // testing file creation and opening in tfile.cpp
+ AddTest("tfile", test_file, cleanup_file, "File I/O Operations", NULL);
+ // testing dataset functionalities in dset.cpp
+ AddTest("dsets", test_dset, cleanup_dsets, "Dataset I/O Operations", NULL);
+ // testing dataspace functionalities in th5s.cpp
+ AddTest("th5s", test_h5s, cleanup_h5s, "Dataspaces", NULL);
+ // testing attribute functionalities in tattr.cpp
+ AddTest("tattr", test_attr, cleanup_attr, "Attributes", NULL);
+ // testing object functionalities in tobject.cpp
+ AddTest("tobject", test_object, cleanup_object, "Objects", NULL);
+ // testing reference functionalities in trefer.cpp
+ AddTest("trefer", test_reference, cleanup_reference, "References", NULL);
+ // testing variable-length strings in tvlstr.cpp
+ AddTest("tvlstr", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL);
+ AddTest("ttypes", test_types, cleanup_types, "Generic Data Types", NULL);
+ AddTest("tarray", test_array, cleanup_array, "Array Datatypes", NULL);
+ AddTest("tcompound", test_compound, cleanup_compound, "Compound Data Types", NULL);
+ AddTest("tdspl", test_dsproplist, cleanup_dsproplist, "Dataset Property List", NULL);
+ AddTest("tfilter", test_filters, cleanup_filters, "Various Filters", NULL);
+ AddTest("tlinks", test_links, cleanup_links, "Various Links", NULL);
/* Comment out tests that are not done yet. - BMR, Feb 2001
- AddTest("select", test_select, cleanup_select, "Selections", NULL);
- AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL);
- AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL);
+ AddTest("select", test_select, cleanup_select, "Selections", NULL);
+ AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL);
+ AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL);
*/
- AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL);
+ AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL);
/*
- AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL);
- AddTest("id", test_ids, NULL, "User-Created Identifiers", NULL);
+ AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL);
+ AddTest("id", test_ids, NULL, "User-Created Identifiers", NULL);
Comment out tests that are not done yet */
/* Tentative - BMR 2007/1/12
- AddTest("enum", test_enum, cleanup_enum, "Enum Data Types", NULL);
+ AddTest("enum", test_enum, cleanup_enum, "Enum Data Types", NULL);
*/
}
catch (Exception& E)
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index 934d6e6..261beab 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -66,20 +66,20 @@ const H5std_string FILE4("tfile4.h5");
/*-------------------------------------------------------------------------
* Function: test_file_create
*
- * Purpose: Test file and template creations
+ * Purpose Test file and template creations
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
+ * Programmer Binh-Minh Ribler (use C version)
* January, 2001
*
* Modifications:
- * January, 2005: C tests' macro VERIFY casts values to 'long' for all
- * cases. Since there are no operator<< for 'long long'
- * or int64 in VS C++ ostream, I casted the hsize_t values
- * passed to verify_val to 'long' as well. If problems
- * arises later, this will have to be specificly handled
- * with a special routine.
+ * January, 2005: C tests' macro VERIFY casts values to 'long' for all
+ * cases. Since there are no operator<< for 'long long'
+ * or int64 in VS C++ ostream, I casted the hsize_t values
+ * passed to verify_val to 'long' as well. If problems
+ * arises later, this will have to be specificly handled
+ * with a special routine.
*
*-------------------------------------------------------------------------
*/
@@ -98,81 +98,81 @@ static void test_file_create()
// Setting this to NULL for cleaning up in failure situations
H5File* file1 = NULL;
try {
- // Create file FILE1
- file1 = new H5File (FILE1, H5F_ACC_EXCL);
-
- // Try to create the same file with H5F_ACC_TRUNC. This should fail
- // because file1 is the same file and is currently open.
- try {
- H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E
-
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("H5File constructor", "Attempted to create an existing file.");
- }
- catch (FileIException& E) // catch truncating existing file
- {} // do nothing, FAIL expected
-
- // Close file1
- delete file1;
- file1 = NULL;
-
- // Try again with H5F_ACC_EXCL. This should fail because the file
- // already exists from the previous steps.
- try {
- H5File file2(FILE1, H5F_ACC_EXCL); // should throw E
-
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("H5File constructor", "File already exists.");
- }
- catch (FileIException& E) // catching creating existing file
- {} // do nothing, FAIL expected
-
- // Test create with H5F_ACC_TRUNC. This will truncate the existing file.
- file1 = new H5File (FILE1, H5F_ACC_TRUNC);
-
- // Try to create first file again. This should fail because file1
- // is the same file and is currently open.
- try {
- H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E
-
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("H5File constructor", "H5F_ACC_TRUNC attempt on an opened file.");
- }
- catch (FileIException& E) // catching truncating opened file
- {} // do nothing, FAIL expected
-
- // Try with H5F_ACC_EXCL. This should fail too because the file already
- // exists.
- try {
- H5File file3 (FILE1, H5F_ACC_EXCL); // should throw E
-
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("H5File constructor", "H5F_ACC_EXCL attempt on an existing file.");
- }
- catch (FileIException& E) // catching H5F_ACC_EXCL on existing file
- {} // do nothing, FAIL expected
-
- // Get the file-creation template
- FileCreatPropList tmpl1 = file1->getCreatePlist();
-
- hsize_t ublock = tmpl1.getUserblock();
- verify_val((long)ublock, (long)F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
-
- size_t parm1, parm2; // file-creation parameters
- tmpl1.getSizes( parm1, parm2);
- verify_val(parm1, F1_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- verify_val(parm2, F1_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
+ // Create file FILE1
+ file1 = new H5File (FILE1, H5F_ACC_EXCL);
+
+ // Try to create the same file with H5F_ACC_TRUNC. This should fail
+ // because file1 is the same file and is currently open.
+ try {
+ H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E
+
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("H5File constructor", "Attempted to create an existing file.");
+ }
+ catch (FileIException& E) // catch truncating existing file
+ {} // do nothing, FAIL expected
+
+ // Close file1
+ delete file1;
+ file1 = NULL;
+
+ // Try again with H5F_ACC_EXCL. This should fail because the file
+ // already exists from the previous steps.
+ try {
+ H5File file2(FILE1, H5F_ACC_EXCL); // should throw E
+
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("H5File constructor", "File already exists.");
+ }
+ catch (FileIException& E) // catching creating existing file
+ {} // do nothing, FAIL expected
+
+ // Test create with H5F_ACC_TRUNC. This will truncate the existing file.
+ file1 = new H5File (FILE1, H5F_ACC_TRUNC);
+
+ // Try to create first file again. This should fail because file1
+ // is the same file and is currently open.
+ try {
+ H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E
+
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("H5File constructor", "H5F_ACC_TRUNC attempt on an opened file.");
+ }
+ catch (FileIException& E) // catching truncating opened file
+ {} // do nothing, FAIL expected
+
+ // Try with H5F_ACC_EXCL. This should fail too because the file already
+ // exists.
+ try {
+ H5File file3 (FILE1, H5F_ACC_EXCL); // should throw E
+
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("H5File constructor", "H5F_ACC_EXCL attempt on an existing file.");
+ }
+ catch (FileIException& E) // catching H5F_ACC_EXCL on existing file
+ {} // do nothing, FAIL expected
+
+ // Get the file-creation template
+ FileCreatPropList tmpl1 = file1->getCreatePlist();
+
+ hsize_t ublock = tmpl1.getUserblock();
+ verify_val((long)ublock, (long)F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
+
+ size_t parm1, parm2; // file-creation parameters
+ tmpl1.getSizes( parm1, parm2);
+ verify_val(parm1, F1_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
+ verify_val(parm2, F1_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
unsigned iparm1,iparm2; // file-creation parameters
tmpl1.getSymk( iparm1, iparm2);
verify_val(iparm1, F1_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
verify_val(iparm2, F1_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
- // tmpl1 is automatically closed; if error occurs, it'll be
- // caught in the catch block
+ // tmpl1 is automatically closed; if error occurs, it'll be
+ // caught in the catch block
- // Close first file
- delete file1;
+ // Close first file
+ delete file1;
}
catch (InvalidActionException& E)
{
@@ -184,7 +184,7 @@ static void test_file_create()
// catch all other exceptions
catch (Exception& E)
{
- issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg());
if (file1 != NULL) // clean up
delete file1;
}
@@ -193,79 +193,79 @@ static void test_file_create()
FileCreatPropList* tmpl1 = NULL;
try
{
- // Create a new file with a non-standard file-creation template
- tmpl1 = new FileCreatPropList;
+ // Create a new file with a non-standard file-creation template
+ tmpl1 = new FileCreatPropList;
- // Set the new file-creation parameters
- tmpl1->setUserblock (F2_USERBLOCK_SIZE);
- tmpl1->setSizes( F2_OFFSET_SIZE, F2_LENGTH_SIZE );
- tmpl1->setSymk( F2_SYM_INTERN_K, F2_SYM_LEAF_K );
+ // Set the new file-creation parameters
+ tmpl1->setUserblock (F2_USERBLOCK_SIZE);
+ tmpl1->setSizes( F2_OFFSET_SIZE, F2_LENGTH_SIZE );
+ tmpl1->setSymk( F2_SYM_INTERN_K, F2_SYM_LEAF_K );
- // Try to create second file, with non-standard file-creation template
- // params.
- H5File file2( FILE2, H5F_ACC_TRUNC, *tmpl1 );
+ // Try to create second file, with non-standard file-creation template
+ // params.
+ H5File file2( FILE2, H5F_ACC_TRUNC, *tmpl1 );
- // Release file-creation template
- delete tmpl1;
- tmpl1 = NULL;
+ // Release file-creation template
+ delete tmpl1;
+ tmpl1 = NULL;
- // Get the file-creation template
- tmpl1 = new FileCreatPropList (file2.getCreatePlist());
+ // Get the file-creation template
+ tmpl1 = new FileCreatPropList (file2.getCreatePlist());
- // Get the file-creation parameters
- hsize_t ublock = tmpl1->getUserblock();
- verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
+ // Get the file-creation parameters
+ hsize_t ublock = tmpl1->getUserblock();
+ verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
- size_t parm1, parm2; // file-creation parameters
- tmpl1->getSizes( parm1, parm2);
- verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
+ size_t parm1, parm2; // file-creation parameters
+ tmpl1->getSizes( parm1, parm2);
+ verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
+ verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- unsigned iparm1,iparm2; // file-creation parameters
+ unsigned iparm1,iparm2; // file-creation parameters
tmpl1->getSymk( iparm1, iparm2);
verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
- // Clone the file-creation template
- FileCreatPropList tmpl2;
- tmpl2.copy (*tmpl1);
+ // Clone the file-creation template
+ FileCreatPropList tmpl2;
+ tmpl2.copy (*tmpl1);
- // Release file-creation template
- delete tmpl1;
- tmpl1 = NULL;
+ // Release file-creation template
+ delete tmpl1;
+ tmpl1 = NULL;
- // Set the new file-creation parameter
- tmpl2.setUserblock( F3_USERBLOCK_SIZE );
+ // Set the new file-creation parameter
+ tmpl2.setUserblock( F3_USERBLOCK_SIZE );
- // Try to create second file, with non-standard file-creation template
- // params
- H5File file3( FILE3, H5F_ACC_TRUNC, tmpl2 );
+ // Try to create second file, with non-standard file-creation template
+ // params
+ H5File file3( FILE3, H5F_ACC_TRUNC, tmpl2 );
- // Get the file-creation template
- tmpl1 = new FileCreatPropList (file3.getCreatePlist());
+ // Get the file-creation template
+ tmpl1 = new FileCreatPropList (file3.getCreatePlist());
- // Get the file-creation parameters
- ublock = tmpl1->getUserblock();
- verify_val((long)ublock, (long)F3_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
+ // Get the file-creation parameters
+ ublock = tmpl1->getUserblock();
+ verify_val((long)ublock, (long)F3_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
- tmpl1->getSizes( parm1, parm2);
- verify_val(parm1, F3_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- verify_val(parm2, F3_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
+ tmpl1->getSizes( parm1, parm2);
+ verify_val(parm1, F3_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
+ verify_val(parm2, F3_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- tmpl1->getSymk( iparm1, iparm2);
- verify_val(iparm1, F3_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
- verify_val(iparm2, F3_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
+ tmpl1->getSymk( iparm1, iparm2);
+ verify_val(iparm1, F3_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
+ verify_val(iparm2, F3_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
- // Release file-creation template
- delete tmpl1;
- PASSED();
+ // Release file-creation template
+ delete tmpl1;
+ PASSED();
}
// catch all exceptions
catch (Exception& E)
{
- issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg());
- if (tmpl1 != NULL) // clean up
- delete tmpl1;
+ issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg());
+ if (tmpl1 != NULL) // clean up
+ delete tmpl1;
}
} // test_file_create()
@@ -273,20 +273,20 @@ static void test_file_create()
/*-------------------------------------------------------------------------
* Function: test_file_open
*
- * Purpose: Test file accesses
+ * Purpose Test file accesses
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
+ * Programmer Binh-Minh Ribler (use C version)
* January, 2001
*
* Modifications:
- * January, 2005: C tests' macro VERIFY casts values to 'long' for all
- * cases. Since there are no operator<< for 'long long'
- * or int64 in VS C++ ostream, I casted the hsize_t values
- * passed to verify_val to 'long' as well. If problems
- * arises later, this will have to be specificly handled
- * with a special routine.
+ * January, 2005: C tests' macro VERIFY casts values to 'long' for all
+ * cases. Since there are no operator<< for 'long long'
+ * or int64 in VS C++ ostream, I casted the hsize_t values
+ * passed to verify_val to 'long' as well. If problems
+ * arises later, this will have to be specificly handled
+ * with a special routine.
*
*-------------------------------------------------------------------------
*/
@@ -297,53 +297,53 @@ static void test_file_open()
try {
- // Open first file
- H5File file1 (FILE2, H5F_ACC_RDWR );
+ // Open first file
+ H5File file1 (FILE2, H5F_ACC_RDWR );
- // Get the file-creation template
- FileCreatPropList tmpl1 = file1.getCreatePlist();
+ // Get the file-creation template
+ FileCreatPropList tmpl1 = file1.getCreatePlist();
- // Get the file-creation parameters
- hsize_t ublock = tmpl1.getUserblock();
- verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
+ // Get the file-creation parameters
+ hsize_t ublock = tmpl1.getUserblock();
+ verify_val((long)ublock, (long)F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
- size_t parm1, parm2; // file-creation parameters
- tmpl1.getSizes( parm1, parm2);
- verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
+ size_t parm1, parm2; // file-creation parameters
+ tmpl1.getSizes( parm1, parm2);
+ verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
+ verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
unsigned iparm1,iparm2; // file-creation parameters
tmpl1.getSymk( iparm1, iparm2);
verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
- // Test H5File constructor with existing file id
- H5File file2(file1.getId());
- file1.close();
+ // Test H5File constructor with existing file id
+ H5File file2(file1.getId());
+ file1.close();
- // Try truncating the file, and it should fail because the file is
- // still opened with file2.
- try {
- H5File file3 (FILE2, H5F_ACC_TRUNC); // should throw E
+ // Try truncating the file, and it should fail because the file is
+ // still opened with file2.
+ try {
+ H5File file3 (FILE2, H5F_ACC_TRUNC); // should throw E
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("H5File constructor", "Attempt truncating an opened file.");
- }
- catch (FileIException& E) // catching H5F_ACC_TRUNC on opened file
- {} // do nothing, FAIL expected
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("H5File constructor", "Attempt truncating an opened file.");
+ }
+ catch (FileIException& E) // catching H5F_ACC_TRUNC on opened file
+ {} // do nothing, FAIL expected
- // Now, really close the file.
- file2.close();
+ // Now, really close the file.
+ file2.close();
- // Truncating should succeed now.
- H5File file3(FILE2, H5F_ACC_TRUNC);
+ // Truncating should succeed now.
+ H5File file3(FILE2, H5F_ACC_TRUNC);
- // Opening another file to file3 object, FILE2 should be closed, so
- // the next attempt to truncate FILE2 should succeed.
- file3.openFile(FILE1, H5F_ACC_RDONLY);
- H5File file4(FILE2, H5F_ACC_TRUNC);
+ // Opening another file to file3 object, FILE2 should be closed, so
+ // the next attempt to truncate FILE2 should succeed.
+ file3.openFile(FILE1, H5F_ACC_RDONLY);
+ H5File file4(FILE2, H5F_ACC_TRUNC);
- PASSED();
+ PASSED();
} // end of try block
catch (Exception& E)
@@ -356,11 +356,11 @@ static void test_file_open()
/*-------------------------------------------------------------------------
* Function: test_file_size
*
- * Purpose: Test file size.
+ * Purpose Test file size.
*
- * Return: None
+ * Return None
*
- * Programmer: Raymond Lu
+ * Programmer Raymond Lu
* June, 2004
*
* Modifications:
@@ -372,7 +372,7 @@ static void test_file_size()
// Output message about test being performed
SUBTEST("File Size");
- hid_t fapl_id;
+ hid_t fapl_id;
fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
try {
@@ -380,13 +380,13 @@ static void test_file_size()
// list object to pass in H5File::H5File
FileAccPropList fapl(fapl_id);
- // Set to sec2 driver. Do we want to test other file drivers?
+ // Set to sec2 driver. Do we want to test other file drivers?
// They're not tested in C++.
// File drivers seem not implemented.
- // fapl.setSec2();
+ // fapl.setSec2();
// Create a file
- H5File file4( FILE4, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ H5File file4( FILE4, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
// Get file size
hsize_t file_size = file4.getFileSize();
@@ -395,14 +395,14 @@ static void test_file_size()
if (file_size < 1*KB || file_size > 4*KB)
issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFileSize() returned unreasonable value");
- // Get the amount of free space in the file
- hssize_t free_space = file4.getFreeSpace();
+ // Get the amount of free space in the file
+ hssize_t free_space = file4.getFreeSpace();
- // Check if it's reasonable. It's 0 now.
- if (free_space < 0 || free_space > 4*KB)
- issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFreeSpace returned unreasonable value");
+ // Check if it's reasonable. It's 0 now.
+ if (free_space < 0 || free_space > 4*KB)
+ issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFreeSpace returned unreasonable value");
- PASSED();
+ PASSED();
} // end of try block
catch (Exception& E)
@@ -421,25 +421,25 @@ static void test_file_size()
/*-------------------------------------------------------------------------
* Function: test_file_name
*
- * Purpose: Test getting file's name.
+ * Purpose Test getting file's name.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler
+ * Programmer Binh-Minh Ribler
* July, 2004
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
-const int RANK = 2;
-const int NX = 4;
-const int NY = 5;
-const H5std_string GROUPNAME ("group");
-const H5std_string DSETNAME ("dataset");
-const H5std_string DATTRNAME ("dataset attribute");
-const H5std_string FATTRNAME ("file attribute");
-const H5std_string DTYPENAME ("compound");
+const int RANK = 2;
+const int NX = 4;
+const int NY = 5;
+const H5std_string GROUPNAME ("group");
+const H5std_string DSETNAME ("dataset");
+const H5std_string DATTRNAME ("dataset attribute");
+const H5std_string FATTRNAME ("file attribute");
+const H5std_string DTYPENAME ("compound");
// Compound datatype
typedef struct s1_t {
@@ -455,51 +455,51 @@ static void test_file_name()
H5std_string file_name;
try {
// Create a file using default properties.
- H5File file4(FILE4, H5F_ACC_TRUNC);
+ H5File file4(FILE4, H5F_ACC_TRUNC);
// Get file name from the file instance.
file_name = file4.getFileName();
- verify_val(file_name, FILE4, "H5File::getFileName", __LINE__, __FILE__);
+ verify_val(file_name, FILE4, "H5File::getFileName", __LINE__, __FILE__);
- // Create a group in the root group.
- Group group(file4.createGroup(GROUPNAME, 0));
+ // Create a group in the root group.
+ Group group(file4.createGroup(GROUPNAME, 0));
- // Get and verify file name via a group.
- file_name = group.getFileName();
- verify_val(file_name, FILE4, "Group::getFileName", __LINE__, __FILE__);
+ // Get and verify file name via a group.
+ file_name = group.getFileName();
+ verify_val(file_name, FILE4, "Group::getFileName", __LINE__, __FILE__);
- // Create the data space.
- hsize_t dims[RANK] = {NX, NY};
- DataSpace space(RANK, dims);
+ // Create the data space.
+ hsize_t dims[RANK] = {NX, NY};
+ DataSpace space(RANK, dims);
- // Create a new dataset.
- DataSet dataset(file4.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
+ // Create a new dataset.
+ DataSet dataset(file4.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
- // Get and verify file name via a dataset.
- file_name = dataset.getFileName();
- verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__);
+ // Get and verify file name via a dataset.
+ file_name = dataset.getFileName();
+ verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__);
- // Create an attribute for the dataset.
- Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space));
+ // Create an attribute for the dataset.
+ Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space));
- // Get and verify file name via an attribute.
- file_name = attr.getFileName();
- verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__);
+ // Get and verify file name via an attribute.
+ file_name = attr.getFileName();
+ verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__);
- // Create a compound datatype.
- CompType comp_type (sizeof(s1_t));
+ // Create a compound datatype.
+ CompType comp_type (sizeof(s1_t));
- // Insert fields.
- comp_type.insertMember("a", HOFFSET(s1_t, a), PredType::NATIVE_INT);
- comp_type.insertMember("b", HOFFSET(s1_t, b), PredType::NATIVE_FLOAT);
+ // Insert fields.
+ comp_type.insertMember("a", HOFFSET(s1_t, a), PredType::NATIVE_INT);
+ comp_type.insertMember("b", HOFFSET(s1_t, b), PredType::NATIVE_FLOAT);
- // Save it on file.
- comp_type.commit(file4, DTYPENAME);
+ // Save it on file.
+ comp_type.commit(file4, DTYPENAME);
- // Get and verify file name via a committed datatype.
- comp_type.getFileName();
- verify_val(file_name, FILE4, "CompType::getFileName", __LINE__, __FILE__);
- PASSED();
+ // Get and verify file name via a committed datatype.
+ comp_type.getFileName();
+ verify_val(file_name, FILE4, "CompType::getFileName", __LINE__, __FILE__);
+ PASSED();
} // end of try block
catch (Exception& E)
@@ -509,11 +509,11 @@ static void test_file_name()
} // test_file_name()
-const int RANK1 = 1;
-const int ATTR1_DIM1 = 3;
-const H5std_string FILE5("tfattrs.h5");
-const H5std_string FATTR1_NAME ("file attribute 1");
-const H5std_string FATTR2_NAME ("file attribute 2");
+const int RANK1 = 1;
+const int ATTR1_DIM1 = 3;
+const H5std_string FILE5("tfattrs.h5");
+const H5std_string FATTR1_NAME ("file attribute 1");
+const H5std_string FATTR2_NAME ("file attribute 2");
int fattr_data[ATTR1_DIM1]={512,-234,98123}; // Test data for file attribute
int dattr_data[ATTR1_DIM1]={256,-123,1000}; // Test data for dataset attribute
@@ -528,89 +528,89 @@ static void test_file_attribute()
H5std_string file_name;
try {
// Create a file using default properties.
- H5File file5(FILE5, H5F_ACC_TRUNC);
+ H5File file5(FILE5, H5F_ACC_TRUNC);
- // Create the data space
- hsize_t dims[RANK1] = {ATTR1_DIM1};
- DataSpace space(RANK1, dims);
+ // Create the data space
+ hsize_t dims[RANK1] = {ATTR1_DIM1};
+ DataSpace space(RANK1, dims);
- // Create two attributes for the file
- Attribute fattr1(file5.createAttribute(FATTR1_NAME, PredType::NATIVE_FLOAT, space));
- Attribute fattr2(file5.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, space));
+ // Create two attributes for the file
+ Attribute fattr1(file5.createAttribute(FATTR1_NAME, PredType::NATIVE_FLOAT, space));
+ Attribute fattr2(file5.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, space));
- fattr2.write(PredType::NATIVE_INT, fattr_data);
+ fattr2.write(PredType::NATIVE_INT, fattr_data);
- try {
- // Try to create the same attribute again (should fail)
- Attribute fattr_dup(file5.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, space));
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("H5File createAttribute", "Attempted to create an existing attribute.");
- }
- catch (AttributeIException& E) // catch creating existing attribute
- {} // do nothing, FAIL expected
+ try {
+ // Try to create the same attribute again (should fail)
+ Attribute fattr_dup(file5.createAttribute(FATTR2_NAME, PredType::NATIVE_INT, space));
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("H5File createAttribute", "Attempted to create an existing attribute.");
+ }
+ catch (AttributeIException& E) // catch creating existing attribute
+ {} // do nothing, FAIL expected
- // Create a new dataset
- DataSet dataset(file5.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
+ // Create a new dataset
+ DataSet dataset(file5.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
- // Create an attribute for the dataset
- Attribute dattr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space));
+ // Create an attribute for the dataset
+ Attribute dattr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space));
- // Write data to the second file attribute
- dattr.write(PredType::NATIVE_INT, dattr_data);
+ // Write data to the second file attribute
+ dattr.write(PredType::NATIVE_INT, dattr_data);
- // Test flushing out the data from the attribute object
+ // Test flushing out the data from the attribute object
dattr.flush(H5F_SCOPE_GLOBAL);
- // Get and verify the number of all objects in the file
- // Current: 1 file, 2 file attr, 1 ds, and 1 ds attr.
- ssize_t num_objs = file5.getObjCount(H5F_OBJ_ALL);
- verify_val(num_objs, 5, "H5File::getObjCount", __LINE__, __FILE__);
-
- num_objs = file5.getObjCount(H5F_OBJ_GROUP);
- verify_val(num_objs, 0, "H5File::getObjCount(H5F_OBJ_GROUP)", __LINE__, __FILE__);
- num_objs = file5.getObjCount(H5F_OBJ_DATASET);
- verify_val(num_objs, 1, "H5File::getObjCount(H5F_OBJ_DATASET)", __LINE__, __FILE__);
- num_objs = file5.getObjCount(H5F_OBJ_ATTR);
- verify_val(num_objs, 3, "H5File::getObjCount(H5F_OBJ_ATTR)", __LINE__, __FILE__);
- num_objs = file5.getObjCount(H5F_OBJ_DATATYPE);
- verify_val(num_objs, 0, "H5File::getObjCount(H5F_OBJ_DATATYPE)", __LINE__, __FILE__);
- num_objs = file5.getObjCount(H5F_OBJ_FILE);
- verify_val(num_objs, 1, "H5File::getObjCount(H5F_OBJ_FILE)", __LINE__, __FILE__);
-
- // Get the file name using the attributes
- H5std_string fname = fattr1.getFileName();
- verify_val(fname, FILE5, "H5File::getFileName()", __LINE__, __FILE__);
-
- fname.clear();
- fname = dattr.getFileName();
- verify_val(fname, FILE5, "H5File::getFileName()", __LINE__, __FILE__);
-
- // Get the class of a file attribute's datatype
- H5T_class_t atclass = fattr1.getTypeClass();
- verify_val(atclass, H5T_FLOAT, "Attribute::getTypeClass()", __LINE__, __FILE__);
-
- // Get and verify the number of attributes attached to a file
- int n_attrs = file5.getNumAttrs();
- verify_val(n_attrs, 2, "H5File::getNumAttrs()", __LINE__, __FILE__);
-
- // Get and verify the number of attributes attached to a dataset
- n_attrs = 0;
- n_attrs = dataset.getNumAttrs();
- verify_val(n_attrs, 1, "DataSet::getNumAttrs()", __LINE__, __FILE__);
-
- // Read back attribute's data
- HDmemset(rdata, 0, sizeof(rdata));
+ // Get and verify the number of all objects in the file
+ // Current: 1 file, 2 file attr, 1 ds, and 1 ds attr.
+ ssize_t num_objs = file5.getObjCount(H5F_OBJ_ALL);
+ verify_val(num_objs, 5, "H5File::getObjCount", __LINE__, __FILE__);
+
+ num_objs = file5.getObjCount(H5F_OBJ_GROUP);
+ verify_val(num_objs, 0, "H5File::getObjCount(H5F_OBJ_GROUP)", __LINE__, __FILE__);
+ num_objs = file5.getObjCount(H5F_OBJ_DATASET);
+ verify_val(num_objs, 1, "H5File::getObjCount(H5F_OBJ_DATASET)", __LINE__, __FILE__);
+ num_objs = file5.getObjCount(H5F_OBJ_ATTR);
+ verify_val(num_objs, 3, "H5File::getObjCount(H5F_OBJ_ATTR)", __LINE__, __FILE__);
+ num_objs = file5.getObjCount(H5F_OBJ_DATATYPE);
+ verify_val(num_objs, 0, "H5File::getObjCount(H5F_OBJ_DATATYPE)", __LINE__, __FILE__);
+ num_objs = file5.getObjCount(H5F_OBJ_FILE);
+ verify_val(num_objs, 1, "H5File::getObjCount(H5F_OBJ_FILE)", __LINE__, __FILE__);
+
+ // Get the file name using the attributes
+ H5std_string fname = fattr1.getFileName();
+ verify_val(fname, FILE5, "H5File::getFileName()", __LINE__, __FILE__);
+
+ fname.clear();
+ fname = dattr.getFileName();
+ verify_val(fname, FILE5, "H5File::getFileName()", __LINE__, __FILE__);
+
+ // Get the class of a file attribute's datatype
+ H5T_class_t atclass = fattr1.getTypeClass();
+ verify_val(atclass, H5T_FLOAT, "Attribute::getTypeClass()", __LINE__, __FILE__);
+
+ // Get and verify the number of attributes attached to a file
+ int n_attrs = file5.getNumAttrs();
+ verify_val(n_attrs, 2, "H5File::getNumAttrs()", __LINE__, __FILE__);
+
+ // Get and verify the number of attributes attached to a dataset
+ n_attrs = 0;
+ n_attrs = dataset.getNumAttrs();
+ verify_val(n_attrs, 1, "DataSet::getNumAttrs()", __LINE__, __FILE__);
+
+ // Read back attribute's data
+ HDmemset(rdata, 0, sizeof(rdata));
dattr.read(PredType::NATIVE_INT, rdata);
/* Check results */
for (i = 0; i < ATTR1_DIM1; i++) {
if (rdata[i] != dattr_data[i]) {
H5_FAILED();
- cerr << endl;
+ cerr << endl;
cerr << "element [" << i << "] is " << rdata[i] <<
- "but should have been " << dattr_data[i] << endl;
+ "but should have been " << dattr_data[i] << endl;
}
}
- PASSED();
+ PASSED();
} // end of try block
catch (Exception& E)
@@ -620,28 +620,28 @@ static void test_file_attribute()
} // test_file_attribute()
-const H5std_string FILE6("tfile5.h5");
-const H5std_string ROOTGROUP("/");
-const H5std_string GROUP1("/G1");
-const H5std_string SUBGROUP3("/G1/G3");
+const H5std_string FILE6("tfile5.h5");
+const H5std_string ROOTGROUP("/");
+const H5std_string GROUP1("/G1");
+const H5std_string SUBGROUP3("/G1/G3");
/*-------------------------------------------------------------------------
- * Function: test_libver_bounds_real
+ * Function: test_libver_bounds_real
*
- * Purpose: Verify that a file created and modified with the
- * specified libver bounds has the specified object header
- * versions for the right objects.
+ * Purpose Verify that a file created and modified with the
+ * specified libver bounds has the specified object header
+ * versions for the right objects.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
- * March, 2015
+ * Programmer Binh-Minh Ribler (use C version)
+ * March, 2015
*
*-------------------------------------------------------------------------
*/
static void test_libver_bounds_real(
- H5F_libver_t libver_create, unsigned oh_vers_create,
- H5F_libver_t libver_mod, unsigned oh_vers_mod)
+ H5F_libver_t libver_create, unsigned oh_vers_create,
+ H5F_libver_t libver_mod, unsigned oh_vers_mod)
{
try {
@@ -713,12 +713,12 @@ static void test_libver_bounds_real(
*
* Function: test_libver_bounds
*
- * Purpose: Verify that a file created and modified with various
- * libver bounds is handled correctly.
+ * Purpose Verify that a file created and modified with various
+ * libver bounds is handled correctly.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
+ * Programmer Binh-Minh Ribler (use C version)
* March 2015
*
*-------------------------------------------------------------------------
@@ -735,14 +735,14 @@ static void test_libver_bounds()
} /* end test_libver_bounds() */
/*-------------------------------------------------------------------------
- * Function: test_commonfg
+ * Function: test_commonfg
*
- * Purpose: Verify that H5File works as a root group.
+ * Purpose Verify that H5File works as a root group.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
- * March, 2015
+ * Programmer Binh-Minh Ribler (use C version)
+ * March, 2015
*
*-------------------------------------------------------------------------
*/
@@ -753,40 +753,40 @@ static void test_commonfg()
try {
// Create a file using default properties.
- H5File file4(FILE4, H5F_ACC_TRUNC);
+ H5File file4(FILE4, H5F_ACC_TRUNC);
- // Try opening the root group.
- Group rootgroup(file4.openGroup(ROOTGROUP));
+ // Try opening the root group.
+ Group rootgroup(file4.openGroup(ROOTGROUP));
- // Create a group in the root group.
- Group group(rootgroup.createGroup(GROUPNAME, 0));
+ // Create a group in the root group.
+ Group group(rootgroup.createGroup(GROUPNAME, 0));
- // Create the data space.
- hsize_t dims[RANK] = {NX, NY};
- DataSpace space(RANK, dims);
+ // Create the data space.
+ hsize_t dims[RANK] = {NX, NY};
+ DataSpace space(RANK, dims);
- // Create a new dataset.
- DataSet dataset(group.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
+ // Create a new dataset.
+ DataSet dataset(group.createDataSet (DSETNAME, PredType::NATIVE_INT, space));
- // Get and verify file name via a dataset.
- H5std_string file_name = dataset.getFileName();
- verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__);
+ // Get and verify file name via a dataset.
+ H5std_string file_name = dataset.getFileName();
+ verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__);
- // Create an attribute for the dataset.
- Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space));
+ // Create an attribute for the dataset.
+ Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space));
- // Get and verify file name via an attribute.
- file_name = attr.getFileName();
- verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__);
+ // Get and verify file name via an attribute.
+ file_name = attr.getFileName();
+ verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__);
- // Create an attribute for the file via root group.
- Attribute rootg_attr(rootgroup.createAttribute(FATTRNAME, PredType::NATIVE_INT, space));
+ // Create an attribute for the file via root group.
+ Attribute rootg_attr(rootgroup.createAttribute(FATTRNAME, PredType::NATIVE_INT, space));
- // Get and verify file name via an attribute.
- file_name = attr.getFileName();
- verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__);
+ // Get and verify file name via an attribute.
+ file_name = attr.getFileName();
+ verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__);
- PASSED();
+ PASSED();
} // end of try block
catch (Exception& E)
@@ -796,19 +796,19 @@ static void test_commonfg()
} /* end test_commonfg() */
-const H5std_string FILE7("tfile7.h5");
+const H5std_string FILE7("tfile7.h5");
/*-------------------------------------------------------------------------
- * Function: test_file_info
+ * Function: test_file_info
*
- * Purpose: Verify that various properties in a file creation property
- * lists are stored correctly in the file and can be retrieved
- * when the file is re-opened.
+ * Purpose Verify that various properties in a file creation property
+ * lists are stored correctly in the file and can be retrieved
+ * when the file is re-opened.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler
- * February, 2017
+ * Programmer Binh-Minh Ribler
+ * February, 2017
*
*-------------------------------------------------------------------------
*/
@@ -817,8 +817,8 @@ static void test_file_info()
// Output message about test being performed
SUBTEST("File general information");
- hsize_t in_threshold = 2; // Free space section threshold to set */
- hsize_t out_threshold = 0; // Free space section threshold to get */
+ hsize_t in_threshold = 2; // Free space section threshold to set */
+ hsize_t out_threshold = 0; // Free space section threshold to get */
// File space handling strategy
H5F_file_space_type_t in_strategy = H5F_FILE_SPACE_ALL;
// File space handling strategy
@@ -826,88 +826,88 @@ static void test_file_info()
try {
// Create a file using default properties.
- H5File tempfile(FILE7, H5F_ACC_TRUNC);
+ H5File tempfile(FILE7, H5F_ACC_TRUNC);
- // Get the file's version information.
- H5F_info2_t finfo;
- tempfile.getFileInfo(finfo);
- verify_val(finfo.super.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
- verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
- verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
+ // Get the file's version information.
+ H5F_info2_t finfo;
+ tempfile.getFileInfo(finfo);
+ verify_val(finfo.super.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
- // Close the file.
- tempfile.close();
+ // Close the file.
+ tempfile.close();
- // Create file creation property list.
- FileCreatPropList fcpl;
+ // Create file creation property list.
+ FileCreatPropList fcpl;
- // Set various file information.
- fcpl.setUserblock(F2_USERBLOCK_SIZE);
- fcpl.setSizes(F2_OFFSET_SIZE, F2_LENGTH_SIZE);
- fcpl.setSymk(F2_SYM_INTERN_K, F2_SYM_LEAF_K);
- fcpl.setIstorek(F2_ISTORE);
- fcpl.setFileSpace(in_strategy, in_threshold);
+ // Set various file information.
+ fcpl.setUserblock(F2_USERBLOCK_SIZE);
+ fcpl.setSizes(F2_OFFSET_SIZE, F2_LENGTH_SIZE);
+ fcpl.setSymk(F2_SYM_INTERN_K, F2_SYM_LEAF_K);
+ fcpl.setIstorek(F2_ISTORE);
+ fcpl.setFileSpace(in_strategy, in_threshold);
- // Creating a file with the non-default file creation property list
- // should create a version 1 superblock
+ // Creating a file with the non-default file creation property list
+ // should create a version 1 superblock
- // Create file with custom file creation property list.
- H5File file7(FILE7, H5F_ACC_TRUNC, fcpl);
+ // Create file with custom file creation property list.
+ H5File file7(FILE7, H5F_ACC_TRUNC, fcpl);
- // Close the file creation property list.
- fcpl.close();
+ // Close the file creation property list.
+ fcpl.close();
- // Get the file's version information.
- file7.getFileInfo(finfo);
- verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__);
- verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
- verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
+ // Get the file's version information.
+ file7.getFileInfo(finfo);
+ verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
- // Close the file.
- file7.close();
+ // Close the file.
+ file7.close();
- // Re-open the file.
- file7.openFile(FILE7, H5F_ACC_RDONLY);
+ // Re-open the file.
+ file7.openFile(FILE7, H5F_ACC_RDONLY);
- // Get the file's creation property list.
- FileCreatPropList fcpl2 = file7.getCreatePlist();
+ // Get the file's creation property list.
+ FileCreatPropList fcpl2 = file7.getCreatePlist();
- // Get the file's version information.
- file7.getFileInfo(finfo);
- verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__);
- verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
- verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
+ // Get the file's version information.
+ file7.getFileInfo(finfo);
+ verify_val(finfo.super.version, 2, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(finfo.free.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
+ verify_val(finfo.sohm.version, 0, "H5File::getFileInfo", __LINE__, __FILE__);
- // Retrieve the property values & check them.
- hsize_t userblock = fcpl2.getUserblock();
- verify_val(userblock, F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
+ // Retrieve the property values & check them.
+ hsize_t userblock = fcpl2.getUserblock();
+ verify_val(userblock, F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__);
- size_t off_size = 0, len_size = 0;
- fcpl2.getSizes(off_size, len_size);
- verify_val(off_size, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- verify_val(len_size, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
+ size_t off_size = 0, len_size = 0;
+ fcpl2.getSizes(off_size, len_size);
+ verify_val(off_size, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
+ verify_val(len_size, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__);
- unsigned sym_ik = 0, sym_lk = 0;
- fcpl2.getSymk(sym_ik, sym_lk);
- verify_val(sym_ik, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
- verify_val(sym_lk, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
+ unsigned sym_ik = 0, sym_lk = 0;
+ fcpl2.getSymk(sym_ik, sym_lk);
+ verify_val(sym_ik, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
+ verify_val(sym_lk, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
- unsigned istore_ik = fcpl2.getIstorek();
- verify_val(istore_ik, F2_ISTORE, "FileCreatPropList::getIstorek", __LINE__, __FILE__);
+ unsigned istore_ik = fcpl2.getIstorek();
+ verify_val(istore_ik, F2_ISTORE, "FileCreatPropList::getIstorek", __LINE__, __FILE__);
/* ret=H5Pget_shared_mesg_nindexes(fcpl2,&nindexes);
CHECK(ret, FAIL, "H5Pget_shared_mesg_nindexes");
VERIFY(nindexes, MISC11_NINDEXES, "H5Pget_shared_mesg_nindexes");
*/
- // Get and verify the file space info from the creation property list */
- out_strategy = fcpl2.getFileSpaceStrategy();
- verify_val(static_cast<unsigned>(out_strategy), static_cast<unsigned>(in_strategy), "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
+ // Get and verify the file space info from the creation property list */
+ out_strategy = fcpl2.getFileSpaceStrategy();
+ verify_val(static_cast<unsigned>(out_strategy), static_cast<unsigned>(in_strategy), "FileCreatPropList::getFileSpaceStrategy", __LINE__, __FILE__);
- out_threshold = fcpl2.getFileSpaceThreshold();
- verify_val(static_cast<unsigned>(out_threshold), static_cast<unsigned>(in_threshold), "FileCreatPropList::getFileSpaceThreshold", __LINE__, __FILE__);
+ out_threshold = fcpl2.getFileSpaceThreshold();
+ verify_val(static_cast<unsigned>(out_threshold), static_cast<unsigned>(in_threshold), "FileCreatPropList::getFileSpaceThreshold", __LINE__, __FILE__);
- PASSED();
+ PASSED();
} // end of try block
catch (Exception& E)
{
@@ -918,11 +918,11 @@ static void test_file_info()
/*-------------------------------------------------------------------------
* Function: test_file
*
- * Purpose: Main file testing routine
+ * Purpose Main file testing routine
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
+ * Programmer Binh-Minh Ribler (use C version)
* January 2001
*
* Modifications:
@@ -935,25 +935,25 @@ void test_file()
// Output message about test being performed
MESSAGE(5, ("Testing File I/O Operations\n"));
- test_file_create(); // Test file creation (also creation templates)
- test_file_open(); // Test file opening
- test_file_size(); // Test file size
- test_file_name(); // Test getting file's name
- test_file_attribute(); // Test file attribute feature
- test_libver_bounds(); // Test format version
- test_commonfg(); // Test H5File as a root group
- test_file_info(); // Test various file info
+ test_file_create(); // Test file creation (also creation templates)
+ test_file_open(); // Test file opening
+ test_file_size(); // Test file size
+ test_file_name(); // Test getting file's name
+ test_file_attribute(); // Test file attribute feature
+ test_libver_bounds(); // Test format version
+ test_commonfg(); // Test H5File as a root group
+ test_file_info(); // Test various file info
} // test_file()
/*-------------------------------------------------------------------------
- * Function: cleanup_file
+ * Function: cleanup_file
*
- * Purpose: Cleanup temporary test files
+ * Purpose Cleanup temporary test files
*
- * Return: none
+ * Return none
*
- * Programmer: (use C version)
+ * Programmer (use C version)
*
* Modifications:
*
diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp
index ee78fe1..19f5b5a 100644
--- a/c++/test/tfilter.cpp
+++ b/c++/test/tfilter.cpp
@@ -33,15 +33,15 @@ using namespace H5;
#include "h5test.h"
#include "h5cpputil.h" // C++ utilility header file
-#define DSET_DIM1 100
-#define DSET_DIM2 200
+#define DSET_DIM1 100
+#define DSET_DIM2 200
#define FILTER_CHUNK_DIM1 2
#define FILTER_CHUNK_DIM2 25
// will do this function later or use it as guideline - BMR - 2007/01/26
#if 0
static herr_t test_filter_internal(hid_t fid, const char *name, hid_t dcpl,
- int if_fletcher32, int corrupted, hsize_t *dset_size)
+ int if_fletcher32, int corrupted, hsize_t *dset_size)
{
cerr << "do nothing right now" << endl;
return(0);
@@ -58,25 +58,25 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
static size_t filter_bogus(size_t nbytes);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_BOGUS[1] = {{
- H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_BOGUS, /* Filter id number */
- 1, 1, /* Encoding and decoding enabled */
- "bogus", /* Filter name for debugging */
- NULL, /* The "can apply" callback */
- NULL, /* The "set local" callback */
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_BOGUS, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "bogus", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
(H5Z_func_t)filter_bogus, /* The actual filter function */
}};
/*-------------------------------------------------------------------------
* Function: filter_bogus
*
- * Purpose: A bogus compression method that doesn't do anything.
+ * Purpose A bogus compression method that doesn't do anything.
*
- * Return: Success: Data chunk size
+ * Return Success: Data chunk size
*
- * Failure: 0
+ * Failure: 0
*
- * Programmer: Robb Matzke
+ * Programmer Robb Matzke
* Tuesday, April 21, 1998
*
* Modifications:
@@ -95,17 +95,17 @@ filter_bogus(size_t nbytes)
}
/*-------------------------------------------------------------------------
- * Function: test_null_filter
+ * Function: test_null_filter
*
- * Purpose: Test null I/O filter by itself.
+ * Purpose Test null I/O filter by itself.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version, from dsets.c/test_filters)
- * January, 2007
+ * Programmer Binh-Minh Ribler (use C version, from dsets.c/test_filters)
+ * January, 2007
*
* Modifications:
- * Note: H5Z interface is not implemented yet.
+ * Note: H5Z interface is not implemented yet.
*
*-------------------------------------------------------------------------
*/
@@ -118,25 +118,25 @@ static void test_null_filter()
// Output message about test being performed
SUBTEST("'Null' filter");
try {
- //hsize_t null_size; // Size of dataset with null filter
+ //hsize_t null_size; // Size of dataset with null filter
- // Prepare dataset create property list
- DSetCreatPropList dsplist;
- dsplist.setChunk(2, chunk_size);
+ // Prepare dataset create property list
+ DSetCreatPropList dsplist;
+ dsplist.setChunk(2, chunk_size);
- if (H5Zregister (H5Z_BOGUS)<0)
+ if (H5Zregister (H5Z_BOGUS)<0)
throw Exception("test_null_filter", "H5Zregister failed");
- // Set some pretent filter
- dsplist.setFilter(H5Z_FILTER_BOGUS);
+ // Set some pretent filter
+ dsplist.setFilter(H5Z_FILTER_BOGUS);
- // this function is just a stub right now; will work on it later - BMR
- //if(test_filter_internal(file,DSET_BOGUS_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&null_size)<0)
+ // this function is just a stub right now; will work on it later - BMR
+ //if(test_filter_internal(file,DSET_BOGUS_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&null_size)<0)
// throw Exception("test_null_filter", "test_filter_internal failed");
- // Close objects.
- dsplist.close();
- PASSED();
+ // Close objects.
+ dsplist.close();
+ PASSED();
} // end of try
// catch all other exceptions
@@ -147,17 +147,17 @@ static void test_null_filter()
} // test_null_filter
/*-------------------------------------------------------------------------
- * Function: test_szip_filter
+ * Function: test_szip_filter
*
- * Purpose: Test SZIP filter by itself.
+ * Purpose Test SZIP filter by itself.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (partly from dsets.c/test_filters)
- * January, 2007
+ * Programmer Binh-Minh Ribler (partly from dsets.c/test_filters)
+ * January, 2007
*
* Modifications:
- * Note: H5Z interface is not implemented yet.
+ * Note: H5Z interface is not implemented yet.
*
*-------------------------------------------------------------------------
*/
@@ -232,7 +232,7 @@ static void test_szip_filter(H5File& file1)
delete[] tconv_buf;
} // if szip presents
else {
- SKIPPED();
+ SKIPPED();
}
#else /* H5_HAVE_FILTER_SZIP */
@@ -266,9 +266,9 @@ void test_filters()
H5File file1(FILE1, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
- // Test basic VL string datatype
- test_null_filter();
- test_szip_filter(file1);
+ // Test basic VL string datatype
+ test_null_filter();
+ test_szip_filter(file1);
}
catch (Exception& E)
{
@@ -277,13 +277,13 @@ void test_filters()
} // test_filters()
/*-------------------------------------------------------------------------
- * Function: cleanup_filters
+ * Function: cleanup_filters
*
- * Purpose: Cleanup temporary test files
+ * Purpose Cleanup temporary test files
*
- * Return: none
+ * Return none
*
- * Programmer: Quincey Koziol
+ * Programmer Quincey Koziol
* September 10, 1999
*
* Modifications:
diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp
index c795c08..a3aafb3 100644
--- a/c++/test/th5s.cpp
+++ b/c++/test/th5s.cpp
@@ -35,7 +35,7 @@ using namespace H5;
#include "h5test.h"
#include "h5cpputil.h" // C++ utilility header file
-#include "H5srcdir.h" // srcdir querying header file
+#include "H5srcdir.h" // srcdir querying header file
const H5std_string TESTFILE("th5s.h5");
const H5std_string DATAFILE("th5s1.h5");
@@ -86,124 +86,123 @@ int space5_data = 7;
/*-------------------------------------------------------------------------
*
- * Function: test_h5s_basic
+ * Function: test_h5s_basic
*
- * Purpose: Test basic H5S (dataspace) code
+ * Purpose Test basic H5S (dataspace) code
*
- * Return: none
+ * Return none
*
- * Programmer: Binh-Minh Ribler (using C version)
+ * Programmer Binh-Minh Ribler (using C version)
* Mar 2001
*
* Modifications:
* January, 2005: C tests' macro VERIFY casts values to 'long' for all
- * cases. Since there are no operator<< for 'long long'
- * or int64 in VS C++ ostream, I casted the hssize_t values
- * passed to verify_val to 'long' as well. If problems
- * arises later, this will have to be specificly handled
- * with a special routine.
+ * cases. Since there are no operator<< for 'long long'
+ * or int64 in VS C++ ostream, I casted the hssize_t values
+ * passed to verify_val to 'long' as well. If problems
+ * arises later, this will have to be specificly handled
+ * with a special routine.
* April 12, 2011: Raymond Lu
- * Starting from the 1.8.7 release, we allow dimension
- * size to be zero. So I took out the test against it.
+ * Starting from the 1.8.7 release, we allow dimension
+ * size to be zero. So I took out the test against it.
*-------------------------------------------------------------------------
*/
static void test_h5s_basic()
{
- hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
- hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3,
- SPACE2_DIM4};
- hsize_t dims3[H5S_MAX_RANK+1];
- hsize_t tmax[4];
+ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3};
+ hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3, SPACE2_DIM4};
+ hsize_t dims3[H5S_MAX_RANK+1];
+ hsize_t tmax[4];
// Output message about test being performed
SUBTEST("Dataspace Manipulation");
try {
- // Create simple dataspace sid1
- DataSpace sid1 (SPACE1_RANK, dims1 );
-
- // Get simple extent npoints of the dataspace sid1 and verify it
- hssize_t n; // Number of dataspace elements
- n = sid1.getSimpleExtentNpoints();
- verify_val((long)n, (long)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3),
- "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
-
- // Get the logical rank of dataspace sid1 and verify it
- int rank; // Logical rank of dataspace
- rank = sid1.getSimpleExtentNdims();
- verify_val(rank, SPACE1_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
-
- // Retrieves dimension size of dataspace sid1 and verify it
- int ndims; // Number of dimensions
- hsize_t tdims[4]; // Dimension array to test with
- ndims = sid1.getSimpleExtentDims( tdims );
- verify_val(ndims, SPACE1_RANK, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
- verify_val(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(unsigned)), 0,
- "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
-
- // Create simple dataspace sid2
- hsize_t max2[] = {SPACE2_MAX1, SPACE2_MAX2, SPACE2_MAX3, SPACE2_MAX4};
- DataSpace sid2 (SPACE2_RANK, dims2, max2);
-
- // Get simple extent npoints of dataspace sid2 and verify it
- n = sid2.getSimpleExtentNpoints();
- verify_val((long)n, (long)(SPACE2_DIM1 * SPACE2_DIM2 * SPACE2_DIM3 * SPACE2_DIM4),
- "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
-
- // Get the logical rank of dataspace sid2 and verify it
- rank = sid2.getSimpleExtentNdims();
- verify_val(rank, SPACE2_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
-
- // Retrieves dimension size and max size of dataspace sid2 and
- // verify them
- ndims = sid2.getSimpleExtentDims( tdims, tmax );
- verify_val(HDmemcmp(tdims, dims2, SPACE2_RANK * sizeof(unsigned)), 0,
- "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
- verify_val(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0,
- "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
-
- // Check to be sure we can't create a simple data space that has too
- // many dimensions.
- try {
- DataSpace manydims_ds(H5S_MAX_RANK+1, dims3, NULL);
-
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("DataSpace constructor", "Library allowed overwrite of existing dataset");
- }
- catch (DataSpaceIException& E) // Simple data space with too many dims
- {} // do nothing, exception expected
+ // Create simple dataspace sid1
+ DataSpace sid1 (SPACE1_RANK, dims1 );
+
+ // Get simple extent npoints of the dataspace sid1 and verify it
+ hssize_t n; // Number of dataspace elements
+ n = sid1.getSimpleExtentNpoints();
+ verify_val((long)n, (long)(SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3),
+ "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+
+ // Get the logical rank of dataspace sid1 and verify it
+ int rank; // Logical rank of dataspace
+ rank = sid1.getSimpleExtentNdims();
+ verify_val(rank, SPACE1_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+
+ // Retrieves dimension size of dataspace sid1 and verify it
+ int ndims; // Number of dimensions
+ hsize_t tdims[4]; // Dimension array to test with
+ ndims = sid1.getSimpleExtentDims( tdims );
+ verify_val(ndims, SPACE1_RANK, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(unsigned)), 0,
+ "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+
+ // Create simple dataspace sid2
+ hsize_t max2[] = {SPACE2_MAX1, SPACE2_MAX2, SPACE2_MAX3, SPACE2_MAX4};
+ DataSpace sid2 (SPACE2_RANK, dims2, max2);
+
+ // Get simple extent npoints of dataspace sid2 and verify it
+ n = sid2.getSimpleExtentNpoints();
+ verify_val((long)n, (long)(SPACE2_DIM1 * SPACE2_DIM2 * SPACE2_DIM3 * SPACE2_DIM4),
+ "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+
+ // Get the logical rank of dataspace sid2 and verify it
+ rank = sid2.getSimpleExtentNdims();
+ verify_val(rank, SPACE2_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+
+ // Retrieves dimension size and max size of dataspace sid2 and
+ // verify them
+ ndims = sid2.getSimpleExtentDims( tdims, tmax );
+ verify_val(HDmemcmp(tdims, dims2, SPACE2_RANK * sizeof(unsigned)), 0,
+ "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ verify_val(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0,
+ "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+
+ // Check to be sure we can't create a simple data space that has too
+ // many dimensions.
+ try {
+ DataSpace manydims_ds(H5S_MAX_RANK+1, dims3, NULL);
+
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("DataSpace constructor", "Library allowed overwrite of existing dataset");
+ }
+ catch (DataSpaceIException& E) // Simple data space with too many dims
+ {} // do nothing, exception expected
/*
- * Try reading a file that has been prepared that has a dataset with a
- * higher dimensionality than what the library can handle.
- *
- * If this test fails and the H5S_MAX_RANK variable has changed, follow
- * the instructions in space_overflow.c for regenating the th5s.h5 file.
- */
- char *tmp_str = new char[TESTFILE.length()+1];
- strcpy(tmp_str, TESTFILE.c_str());
- const char *testfile = H5_get_srcdir_filename(tmp_str);
- delete []tmp_str;
-
- // Create file
- H5File fid1(testfile, H5F_ACC_RDONLY);
-
- // Try to open the dataset that has higher dimensionality than
- // what the library can handle and this operation should fail.
- try {
- DataSet dset1 = fid1.openDataSet( "dset" );
-
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("H5File::openDataSet", "Opening a dataset with higher dimensionality than what the library can handle");
- }
- catch (FileIException& E) // catching higher dimensionality dataset
- {} // do nothing, exception expected
+ * Try reading a file that has been prepared that has a dataset with a
+ * higher dimensionality than what the library can handle.
+ *
+ * If this test fails and the H5S_MAX_RANK variable has changed, follow
+ * the instructions in space_overflow.c for regenating the th5s.h5 file.
+ */
+ char *tmp_str = new char[TESTFILE.length()+1];
+ strcpy(tmp_str, TESTFILE.c_str());
+ const char *testfile = H5_get_srcdir_filename(tmp_str);
+ delete []tmp_str;
+
+ // Create file
+ H5File fid1(testfile, H5F_ACC_RDONLY);
+
+ // Try to open the dataset that has higher dimensionality than
+ // what the library can handle and this operation should fail.
+ try {
+ DataSet dset1 = fid1.openDataSet( "dset" );
+
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("H5File::openDataSet", "Opening a dataset with higher dimensionality than what the library can handle");
+ }
+ catch (FileIException& E) // catching higher dimensionality dataset
+ {} // do nothing, exception expected
// CHECK_I(ret, "H5Fclose"); // leave this here, later, fake a failure
- // in the p_close see how this will handle it. - BMR
+ // in the p_close see how this will handle it. - BMR
- PASSED();
- } // end of try block
+ PASSED();
+ } // end of try block
catch (InvalidActionException& E)
{
@@ -219,22 +218,22 @@ static void test_h5s_basic()
/*-------------------------------------------------------------------------
*
- * Function: test_h5s_scalar_write
+ * Function: test_h5s_scalar_write
*
- * Purpose: Test scalar H5S (dataspace) writing code
+ * Purpose Test scalar H5S (dataspace) writing code
*
- * Return: none
+ * Return none
*
- * Programmer: Binh-Minh Ribler (using C version)
+ * Programmer Binh-Minh Ribler (using C version)
* Mar 2001
*
* Modifications:
* January, 2005: C tests' macro VERIFY casts values to 'long' for all
- * cases. Since there are no operator<< for 'long long'
- * or int64 in VS C++ ostream, I casted the hssize_t values
- * passed to verify_val to 'long' as well. If problems
- * arises later, this will have to be specificly handled
- * with a special routine.
+ * cases. Since there are no operator<< for 'long long'
+ * or int64 in VS C++ ostream, I casted the hssize_t values
+ * passed to verify_val to 'long' as well. If problems
+ * arises later, this will have to be specificly handled
+ * with a special routine.
*-------------------------------------------------------------------------
*/
static void test_h5s_scalar_write()
@@ -243,124 +242,124 @@ static void test_h5s_scalar_write()
SUBTEST("Scalar Dataspace Writing");
try {
- // Create file
- H5File fid1(DATAFILE, H5F_ACC_TRUNC);
+ // Create file
+ H5File fid1(DATAFILE, H5F_ACC_TRUNC);
- // Create scalar dataspace
- DataSpace sid1(SPACE3_RANK, NULL);
+ // Create scalar dataspace
+ DataSpace sid1(SPACE3_RANK, NULL);
- //n = H5Sget_simple_extent_npoints(sid1);
- hssize_t n; // Number of dataspace elements
- n = sid1.getSimpleExtentNpoints();
- verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ //n = H5Sget_simple_extent_npoints(sid1);
+ hssize_t n; // Number of dataspace elements
+ n = sid1.getSimpleExtentNpoints();
+ verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
- int rank; // Logical rank of dataspace
- rank = sid1.getSimpleExtentNdims();
- verify_val(rank, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+ int rank; // Logical rank of dataspace
+ rank = sid1.getSimpleExtentNdims();
+ verify_val(rank, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
- // Retrieves dimension size of dataspace sid1 and verify it
- int ndims; // Number of dimensions
- hsize_t tdims[4]; // Dimension array to test with
- ndims = sid1.getSimpleExtentDims( tdims );
- verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ // Retrieves dimension size of dataspace sid1 and verify it
+ int ndims; // Number of dimensions
+ hsize_t tdims[4]; // Dimension array to test with
+ ndims = sid1.getSimpleExtentDims( tdims );
+ verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
- // Verify extent type
- H5S_class_t ext_type; // Extent type
- ext_type = sid1.getSimpleExtentType();
- verify_val(ext_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__);
+ // Verify extent type
+ H5S_class_t ext_type; // Extent type
+ ext_type = sid1.getSimpleExtentType();
+ verify_val(ext_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__);
- // Create and write a dataset
- DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1);
- dataset.write(&space3_data, PredType::NATIVE_UINT);
+ // Create and write a dataset
+ DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1);
+ dataset.write(&space3_data, PredType::NATIVE_UINT);
- PASSED();
+ PASSED();
} // end of try block
catch (Exception& E)
{
- issue_fail_msg("test_h5s_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_h5s_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_h5s_scalar_write()
/*-------------------------------------------------------------------------
*
- * Function: test_h5s_scalar_read
+ * Function: test_h5s_scalar_read
*
- * Purpose: Test scalar H5S (dataspace) reading code
+ * Purpose Test scalar H5S (dataspace) reading code
*
- * Return: none
+ * Return none
*
- * Programmer: Binh-Minh Ribler (using C version)
+ * Programmer Binh-Minh Ribler (using C version)
* Mar 2001
*
* Modifications:
* January, 2005: C tests' macro VERIFY casts values to 'long' for all
- * cases. Since there are no operator<< for 'long long'
- * or int64 in VS C++ ostream, I casted the hssize_t values
- * passed to verify_val to 'long' as well. If problems
- * arises later, this will have to be specificly handled
- * with a special routine.
+ * cases. Since there are no operator<< for 'long long'
+ * or int64 in VS C++ ostream, I casted the hssize_t values
+ * passed to verify_val to 'long' as well. If problems
+ * arises later, this will have to be specificly handled
+ * with a special routine.
*-------------------------------------------------------------------------
*/
static void test_h5s_scalar_read()
{
- hsize_t tdims[4]; // Dimension array to test with
+ hsize_t tdims[4]; // Dimension array to test with
// Output message about test being performed
SUBTEST("Scalar Dataspace Reading");
try {
- // Open file
- H5File fid1(DATAFILE, H5F_ACC_RDWR);
+ // Open file
+ H5File fid1(DATAFILE, H5F_ACC_RDWR);
- // Create a dataset
- DataSet dataset = fid1.openDataSet("Dataset1");
+ // Create a dataset
+ DataSet dataset = fid1.openDataSet("Dataset1");
- DataSpace sid1 = dataset.getSpace();
+ DataSpace sid1 = dataset.getSpace();
- // Get the number of dataspace elements
- hssize_t n = sid1.getSimpleExtentNpoints();
- verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ // Get the number of dataspace elements
+ hssize_t n = sid1.getSimpleExtentNpoints();
+ verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
- // Get the logical rank of the dataspace
- int ndims = sid1.getSimpleExtentNdims();
- verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+ // Get the logical rank of the dataspace
+ int ndims = sid1.getSimpleExtentNdims();
+ verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
- ndims = sid1.getSimpleExtentDims(tdims);
- verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ ndims = sid1.getSimpleExtentDims(tdims);
+ verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
- // Read data back and verify it
- unsigned rdata; // Scalar data read in
- dataset.read(&rdata, PredType::NATIVE_UINT);
- verify_val(rdata, space3_data, "DataSet::read", __LINE__, __FILE__);
+ // Read data back and verify it
+ unsigned rdata; // Scalar data read in
+ dataset.read(&rdata, PredType::NATIVE_UINT);
+ verify_val(rdata, space3_data, "DataSet::read", __LINE__, __FILE__);
- PASSED();
+ PASSED();
} // end of try block
catch (Exception& E)
{
- // all the exceptions caused by negative returned values by C APIs
- issue_fail_msg("test_h5s_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg());
+ // all the exceptions caused by negative returned values by C APIs
+ issue_fail_msg("test_h5s_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_h5s_scalar_read()
/*-------------------------------------------------------------------------
*
- * Function: test_h5s_null
+ * Function: test_h5s_null
*
- * Purpose: Test null H5S (dataspace) code
+ * Purpose Test null H5S (dataspace) code
*
- * Return: none
+ * Return none
*
- * Programmer: Raymond Lu (using C version)
+ * Programmer Raymond Lu (using C version)
* May 18, 2004
*
* Modifications:
* January, 2005: C tests' macro VERIFY casts values to 'long' for all
- * cases. Since there are no operator<< for 'long long'
- * or int64 in VS C++ ostream, I casted the hssize_t values
- * passed to verify_val to 'long' as well. If problems
- * arises later, this will have to be specificly handled
- * with a special routine.
+ * cases. Since there are no operator<< for 'long long'
+ * or int64 in VS C++ ostream, I casted the hssize_t values
+ * passed to verify_val to 'long' as well. If problems
+ * arises later, this will have to be specificly handled
+ * with a special routine.
*-------------------------------------------------------------------------
*/
static void test_h5s_null()
@@ -369,53 +368,53 @@ static void test_h5s_null()
SUBTEST("Null Dataspace Writing");
try {
- // Create file
- H5File fid1(DATAFILE, H5F_ACC_TRUNC);
+ // Create file
+ H5File fid1(DATAFILE, H5F_ACC_TRUNC);
- // Create scalar dataspace
- DataSpace sid1(H5S_NULL);
+ // Create scalar dataspace
+ DataSpace sid1(H5S_NULL);
- hssize_t n; // Number of dataspace elements
- n = sid1.getSimpleExtentNpoints();
- verify_val((long)n, 0, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ hssize_t n; // Number of dataspace elements
+ n = sid1.getSimpleExtentNpoints();
+ verify_val((long)n, 0, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
- // Create a dataset
- DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1);
+ // Create a dataset
+ DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1);
// Try to write nothing to the dataset
- dataset.write(&space5_data, PredType::NATIVE_INT);
+ dataset.write(&space5_data, PredType::NATIVE_INT);
// Read the data. Make sure no change to the buffer
- dataset.read(&space5_data, PredType::NATIVE_INT);
- verify_val(space5_data, 7, "DataSet::read", __LINE__, __FILE__);
+ dataset.read(&space5_data, PredType::NATIVE_INT);
+ verify_val(space5_data, 7, "DataSet::read", __LINE__, __FILE__);
- PASSED();
+ PASSED();
} // end of try block
catch (Exception& E)
{
- issue_fail_msg("test_h5s_null()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_h5s_null()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_h5s_null()
/*-------------------------------------------------------------------------
*
- * Function: test_h5s_compound_scalar_write
+ * Function: test_h5s_compound_scalar_write
*
- * Purpose: Test scalar H5S (dataspace) writing for compound
- * datatypes
+ * Purpose Test scalar H5S (dataspace) writing for compound
+ * datatypes
*
- * Return: none
+ * Return none
*
- * Programmer: Binh-Minh Ribler (using C version)
+ * Programmer Binh-Minh Ribler (using C version)
* Mar 2001
*
* Modifications:
* January, 2005: C tests' macro VERIFY casts values to 'long' for all
- * cases. Since there are no operator<< for 'long long'
- * or int64 in VS C++ ostream, I casted the hssize_t values
- * passed to verify_val to 'long' as well. If problems
- * arises later, this will have to be specificly handled
- * with a special routine.
+ * cases. Since there are no operator<< for 'long long'
+ * or int64 in VS C++ ostream, I casted the hssize_t values
+ * passed to verify_val to 'long' as well. If problems
+ * arises later, this will have to be specificly handled
+ * with a special routine.
*-------------------------------------------------------------------------
*/
static void test_h5s_compound_scalar_write()
@@ -424,135 +423,135 @@ static void test_h5s_compound_scalar_write()
SUBTEST("Compound Dataspace Writing");
try {
- // Create file
- H5File fid1(DATAFILE, H5F_ACC_TRUNC);
-
- // Create the compound datatype.
- CompType tid1(sizeof(struct space4_struct));
- space4_field1_off=HOFFSET(struct space4_struct, c1);
- tid1.insertMember(SPACE4_FIELDNAME1, space4_field1_off,
- PredType::NATIVE_SCHAR);
- space4_field2_off=HOFFSET(struct space4_struct, u);
- tid1.insertMember(SPACE4_FIELDNAME2, space4_field2_off,
- PredType::NATIVE_UINT);
- space4_field3_off=HOFFSET(struct space4_struct, f);
- tid1.insertMember(SPACE4_FIELDNAME3, space4_field3_off,
- PredType::NATIVE_FLOAT);
- space4_field4_off=HOFFSET(struct space4_struct, c2);
- tid1.insertMember(SPACE4_FIELDNAME4, space4_field4_off,
- PredType::NATIVE_SCHAR);
-
- // Create scalar dataspace
- DataSpace sid1(SPACE3_RANK, NULL);
-
- // Get the number of dataspace elements
- hssize_t n = sid1.getSimpleExtentNpoints();
- verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
-
- // Get the logical rank of the dataspace
- int ndims = sid1.getSimpleExtentNdims();
- verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
-
- hsize_t tdims[4]; // Dimension array to test with
- ndims = sid1.getSimpleExtentDims(tdims);
- verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
-
- // Create and write a dataset
- DataSet dataset = fid1.createDataSet("Dataset1", tid1, sid1);
- dataset.write(&space4_data, tid1);
-
- PASSED();
- } // end of try block
+ // Create file
+ H5File fid1(DATAFILE, H5F_ACC_TRUNC);
+
+ // Create the compound datatype.
+ CompType tid1(sizeof(struct space4_struct));
+ space4_field1_off=HOFFSET(struct space4_struct, c1);
+ tid1.insertMember(SPACE4_FIELDNAME1, space4_field1_off,
+ PredType::NATIVE_SCHAR);
+ space4_field2_off=HOFFSET(struct space4_struct, u);
+ tid1.insertMember(SPACE4_FIELDNAME2, space4_field2_off,
+ PredType::NATIVE_UINT);
+ space4_field3_off=HOFFSET(struct space4_struct, f);
+ tid1.insertMember(SPACE4_FIELDNAME3, space4_field3_off,
+ PredType::NATIVE_FLOAT);
+ space4_field4_off=HOFFSET(struct space4_struct, c2);
+ tid1.insertMember(SPACE4_FIELDNAME4, space4_field4_off,
+ PredType::NATIVE_SCHAR);
+
+ // Create scalar dataspace
+ DataSpace sid1(SPACE3_RANK, NULL);
+
+ // Get the number of dataspace elements
+ hssize_t n = sid1.getSimpleExtentNpoints();
+ verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+
+ // Get the logical rank of the dataspace
+ int ndims = sid1.getSimpleExtentNdims();
+ verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+
+ hsize_t tdims[4]; // Dimension array to test with
+ ndims = sid1.getSimpleExtentDims(tdims);
+ verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+
+ // Create and write a dataset
+ DataSet dataset = fid1.createDataSet("Dataset1", tid1, sid1);
+ dataset.write(&space4_data, tid1);
+
+ PASSED();
+ } // end of try block
catch (Exception& E)
{
- // all the exceptions caused by negative returned values by C APIs
- issue_fail_msg("test_h5s_compound_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg());
+ // all the exceptions caused by negative returned values by C APIs
+ issue_fail_msg("test_h5s_compound_scalar_write()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_h5s_compound_scalar_write()
/*-------------------------------------------------------------------------
*
- * Function: test_h5s_compound_scalar_read
+ * Function: test_h5s_compound_scalar_read
*
- * Purpose: Test scalar H5S (dataspace) reading for compound
- * datatypes
+ * Purpose Test scalar H5S (dataspace) reading for compound
+ * datatypes
*
- * Return: none
+ * Return none
*
- * Programmer: Binh-Minh Ribler (using C version)
+ * Programmer Binh-Minh Ribler (using C version)
* Mar 2001
*
* Modifications:
* January, 2005: C tests' macro VERIFY casts values to 'long' for all
- * cases. Since there are no operator<< for 'long long'
- * or int64 in VS C++ ostream, I casted the hssize_t values
- * passed to verify_val to 'long' as well. If problems
- * arises later, this will have to be specificly handled
- * with a special routine.
+ * cases. Since there are no operator<< for 'long long'
+ * or int64 in VS C++ ostream, I casted the hssize_t values
+ * passed to verify_val to 'long' as well. If problems
+ * arises later, this will have to be specificly handled
+ * with a special routine.
*-------------------------------------------------------------------------
*/
static void test_h5s_compound_scalar_read()
{
- hsize_t tdims[4]; // Dimension array to test with
+ hsize_t tdims[4]; // Dimension array to test with
// Output message about test being performed
SUBTEST("Compound Dataspace Reading");
try {
- // Open file
- H5File fid1(DATAFILE, H5F_ACC_RDWR);
+ // Open file
+ H5File fid1(DATAFILE, H5F_ACC_RDWR);
- // Create a dataset
- DataSet dataset = fid1.openDataSet("Dataset1");
+ // Create a dataset
+ DataSet dataset = fid1.openDataSet("Dataset1");
- DataSpace sid1 = dataset.getSpace();
+ DataSpace sid1 = dataset.getSpace();
- // Get the number of dataspace elements
- hssize_t n = sid1.getSimpleExtentNpoints();
- verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
+ // Get the number of dataspace elements
+ hssize_t n = sid1.getSimpleExtentNpoints();
+ verify_val((long)n, 1, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__);
- // Get the logical rank of the dataspace
- int ndims = sid1.getSimpleExtentNdims();
- verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
+ // Get the logical rank of the dataspace
+ int ndims = sid1.getSimpleExtentNdims();
+ verify_val(ndims, SPACE3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__);
- ndims = sid1.getSimpleExtentDims(tdims);
- verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
+ ndims = sid1.getSimpleExtentDims(tdims);
+ verify_val(ndims, 0, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
- // Get the datatype of this dataset.
- CompType type(dataset);
+ // Get the datatype of this dataset.
+ CompType type(dataset);
- struct space4_struct rdata; // Scalar data read in
- dataset.read(&rdata, type);
+ struct space4_struct rdata; // Scalar data read in
+ dataset.read(&rdata, type);
- // Verify read data
- if(HDmemcmp(&space4_data,&rdata,sizeof(struct space4_struct)))
- {
+ // Verify read data
+ if(HDmemcmp(&space4_data,&rdata,sizeof(struct space4_struct)))
+ {
cerr << "scalar data different: space4_data.c1="
- << space4_data.c1 << ", read_data4.c1=" << rdata.c1 << endl;
+ << space4_data.c1 << ", read_data4.c1=" << rdata.c1 << endl;
cerr << "scalar data different: space4_data.u="
- << space4_data.u << ", read_data4.u=" << rdata.u << endl;
+ << space4_data.u << ", read_data4.u=" << rdata.u << endl;
cerr << "scalar data different: space4_data.f="
- << space4_data.f << ", read_data4.f=" << rdata.f << endl;
+ << space4_data.f << ", read_data4.f=" << rdata.f << endl;
TestErrPrintf("scalar data different: space4_data.c1=%c, read_data4.c1=%c\n",
- space4_data.c1, rdata.c2);
- } // end if
- PASSED();
+ space4_data.c1, rdata.c2);
+ } // end if
+ PASSED();
} // end of try block
catch (Exception& E)
{
- // all the exceptions caused by negative returned values by C APIs
- issue_fail_msg("test_h5s_compound_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg());
+ // all the exceptions caused by negative returned values by C APIs
+ issue_fail_msg("test_h5s_compound_scalar_read()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_h5s_compound_scalar_read()
/*-------------------------------------------------------------------------
*
- * Function: test_h5s
+ * Function: test_h5s
*
- * Purpose: Main dataspace testing routine
+ * Purpose Main dataspace testing routine
*
- * Return: none
+ * Return none
*
- * Programmer: Binh-Minh Ribler (using C version)
+ * Programmer Binh-Minh Ribler (using C version)
* Mar 2001
*
* Modifications:
@@ -564,23 +563,23 @@ void test_h5s()
// Output message about test being performed
MESSAGE(5, ("Testing Dataspaces\n"));
- test_h5s_basic(); // Test basic H5S code
- test_h5s_scalar_write(); // Test scalar H5S writing code
- test_h5s_scalar_read(); // Test scalar H5S reading code
- test_h5s_null(); // Test null H5S code
- test_h5s_compound_scalar_write(); // Test compound datatype scalar H5S writing code
- test_h5s_compound_scalar_read(); // Test compound datatype scalar H5S reading code
+ test_h5s_basic(); // Test basic H5S code
+ test_h5s_scalar_write(); // Test scalar H5S writing code
+ test_h5s_scalar_read(); // Test scalar H5S reading code
+ test_h5s_null(); // Test null H5S code
+ test_h5s_compound_scalar_write(); // Test compound datatype scalar H5S writing code
+ test_h5s_compound_scalar_read(); // Test compound datatype scalar H5S reading code
} // test_h5s()
/*-------------------------------------------------------------------------
- * Function: cleanup_h5s
+ * Function: cleanup_h5s
*
- * Purpose: Cleanup temporary test files
+ * Purpose Cleanup temporary test files
*
- * Return: none
+ * Return none
*
- * Programmer: Albert Cheng
+ * Programmer Albert Cheng
* July 2, 1998
*
* Modifications:
diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp
index 7ee2b53..fce42fa 100644
--- a/c++/test/titerate.cpp
+++ b/c++/test/titerate.cpp
@@ -49,20 +49,20 @@ using namespace H5;
//#define SPACE1_RANK 1
//#define SPACE1_DIM1 4
-const H5std_string FILE_ITERATE("titerate.h5");
-const H5std_string GROUP1("Top Group");
-const H5std_string GROUP1_PATH("/Top Group");
-const H5std_string GROUP1_1("Sub-Group 1.1");
-const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1");
-const H5std_string GROUP1_2("Sub-Group 1.2");
-const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2");
-const H5std_string DSET_DEFAULT_NAME("default");
-const H5std_string DSET_IN_FILE("Dataset in File");
-const H5std_string DSET_IN_FILE_PATH("/Dataset in File");
-const H5std_string DSET_IN_GRP1("Dataset in Group 1");
-const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset in Group 1");
-const H5std_string DSET_IN_GRP1_2("Dataset in Group 1.2");
-const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset in Group 1.2");
+const H5std_string FILE_ITERATE("titerate.h5");
+const H5std_string GROUP1("Top Group");
+const H5std_string GROUP1_PATH("/Top Group");
+const H5std_string GROUP1_1("Sub-Group 1.1");
+const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1");
+const H5std_string GROUP1_2("Sub-Group 1.2");
+const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2");
+const H5std_string DSET_DEFAULT_NAME("default");
+const H5std_string DSET_IN_FILE("Dataset in File");
+const H5std_string DSET_IN_FILE_PATH("/Dataset in File");
+const H5std_string DSET_IN_GRP1("Dataset in Group 1");
+const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset in Group 1");
+const H5std_string DSET_IN_GRP1_2("Dataset in Group 1.2");
+const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset in Group 1.2");
typedef enum {
RET_ZERO,
@@ -127,15 +127,15 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_
} /* end liter_cb() */
/*-------------------------------------------------------------------------
- * Function: test_iter_group
+ * Function: test_iter_group
*
- * Purpose: Tests group iteration
+ * Purpose Tests group iteration
*
- * Return: Success: 0
- * Failure: -1
+ * Return Success: 0
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler
- * Friday, September 9, 2016
+ * Programmer Binh-Minh Ribler
+ * Friday, September 9, 2016
*
* Modifications:
*
@@ -148,142 +148,142 @@ static void test_iter_group(FileAccPropList& fapl)
char name[NAMELEN]; /* temporary name buffer */
char *lnames[NDATASETS + 2];/* Names of the links created */
iter_info info; /* Custom iteration information */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
SUBTEST("Group Iteration");
/* Create the test file with the datasets */
try {
- // Create file
- H5File file(FILE_ITERATE, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ // Create file
+ H5File file(FILE_ITERATE, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
- /* Test iterating over empty group */
- info.command = RET_ZERO;
- idx = 0;
- ret = H5Literate(file.getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
- verify_val(ret, SUCCEED, "H5Literate", __LINE__, __FILE__);
+ /* Test iterating over empty group */
+ info.command = RET_ZERO;
+ idx = 0;
+ ret = H5Literate(file.getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
+ verify_val(ret, SUCCEED, "H5Literate", __LINE__, __FILE__);
- DataType datatype(PredType::NATIVE_INT);
+ DataType datatype(PredType::NATIVE_INT);
- // Create a scalar file space
- DataSpace filespace;
+ // Create a scalar file space
+ DataSpace filespace;
- for (i=0; i< NDATASETS; i++)
- {
+ for (i=0; i< NDATASETS; i++)
+ {
sprintf(name, "Dataset %d", i);
- // Create a dataset in the file
- DataSet dataset = file.createDataSet(name, datatype, filespace);
+ // Create a dataset in the file
+ DataSet dataset = file.createDataSet(name, datatype, filespace);
/* Keep a copy of the dataset names */
lnames[i] = HDstrdup(name);
check_values(lnames[i], "HDstrdup returns NULL", __LINE__, __FILE__);
- } /* end for */
+ } /* end for */
- /* Create a group and named datatype under root group for testing */
- Group grp(file.createGroup(GROUP1, 0));
- lnames[NDATASETS] = HDstrdup("grp");
- check_values(lnames[NDATASETS], "HDstrdup returns NULL", __LINE__, __FILE__);
+ /* Create a group and named datatype under root group for testing */
+ Group grp(file.createGroup(GROUP1, 0));
+ lnames[NDATASETS] = HDstrdup("grp");
+ check_values(lnames[NDATASETS], "HDstrdup returns NULL", __LINE__, __FILE__);
- datatype.commit(file, "dtype");
- lnames[NDATASETS + 1] = HDstrdup("dtype");
- check_values(lnames[NDATASETS], "HDstrdup returns NULL", __LINE__, __FILE__);
+ datatype.commit(file, "dtype");
+ lnames[NDATASETS + 1] = HDstrdup("dtype");
+ check_values(lnames[NDATASETS], "HDstrdup returns NULL", __LINE__, __FILE__);
- /* Sort the dataset names */
- HDqsort(lnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp);
+ /* Sort the dataset names */
+ HDqsort(lnames, (size_t)(NDATASETS + 2), sizeof(char *), iter_strcmp);
- /* Iterate through the datasets in the root group in various ways */
+ /* Iterate through the datasets in the root group in various ways */
- // Open data file to read
- file.openFile(FILE_ITERATE, H5F_ACC_RDONLY, fapl);
+ // Open data file to read
+ file.openFile(FILE_ITERATE, H5F_ACC_RDONLY, fapl);
- // Open the root group
- Group root_group(file.openGroup("/"));
+ // Open the root group
+ Group root_group(file.openGroup("/"));
- // Get the number of object in the root group
- hsize_t nobjs = root_group.getNumObjs();
- verify_val(nobjs, (hsize_t)(NDATASETS + 2), "H5Gget_info", __LINE__, __FILE__);
+ // Get the number of object in the root group
+ hsize_t nobjs = root_group.getNumObjs();
+ verify_val(nobjs, (hsize_t)(NDATASETS + 2), "H5Gget_info", __LINE__, __FILE__);
- H5std_string obj_name;
- for (i = 0; i < nobjs; i++)
- {
- //H5O_info_t oinfo; /* Object info */
+ H5std_string obj_name;
+ for (i = 0; i < nobjs; i++)
+ {
+ //H5O_info_t oinfo; /* Object info */
- obj_name = root_group.getObjnameByIdx(i);
+ obj_name = root_group.getObjnameByIdx(i);
//ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
- //oinfo = root_group.childObjType((hsize_t)i, H5_INDEX_NAME, H5_ITER_INC, ".");
+ //oinfo = root_group.childObjType((hsize_t)i, H5_INDEX_NAME, H5_ITER_INC, ".");
//ret = H5Oget_info_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5P_DEFAULT);
- } /* end for */
-
- // Attempted to iterate with invalid index, should fail
- try {
- obj_name = root_group.getObjnameByIdx(NDATASETS + 3);
-
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with invalid index");
- }
- catch (GroupIException& invalid_action) // invalid index
- {} // do nothing, exception expected
-
- // Attempted to iterate with negative index, should fail
- try {
- info.command = RET_ZERO;
- idx = (hsize_t)-1;
- obj_name = root_group.getObjnameByIdx(idx);
-
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index");
- }
- catch (FileIException& invalid_action) // invalid index
- {} // do nothing, exception expected
- catch (GroupIException& invalid_action) // invalid index
- {} // do nothing, exception expected
-
- /* Test skipping exactly as many entries as in the group */
- try {
- info.command = RET_ZERO;
- idx = NDATASETS + 2;
- obj_name = root_group.getObjnameByIdx(idx);
-
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index");
- }
- catch (FileIException& invalid_action) // invalid index
- {} // do nothing, exception expected
- catch (GroupIException& invalid_action) // invalid index
- {} // do nothing, exception expected
-
- /* Test skipping more entries than are in the group */
- try {
- info.command = RET_ZERO;
- idx = NDATASETS + 3;
- obj_name = root_group.getObjnameByIdx(idx);
-
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index");
- }
- catch (FileIException& invalid_action) // invalid index
- {} // do nothing, exception expected
- catch (GroupIException& invalid_action) // invalid index
- {} // do nothing, exception expected
-
- /* Free the dataset names */
- for(i = 0; i< (NDATASETS + 2); i++)
- HDfree(lnames[i]);
-
- // Everything will be closed as they go out of scope
-
- PASSED();
- } // try block
+ } /* end for */
+
+ // Attempted to iterate with invalid index, should fail
+ try {
+ obj_name = root_group.getObjnameByIdx(NDATASETS + 3);
+
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with invalid index");
+ }
+ catch (GroupIException& invalid_action) // invalid index
+ {} // do nothing, exception expected
+
+ // Attempted to iterate with negative index, should fail
+ try {
+ info.command = RET_ZERO;
+ idx = (hsize_t)-1;
+ obj_name = root_group.getObjnameByIdx(idx);
+
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index");
+ }
+ catch (FileIException& invalid_action) // invalid index
+ {} // do nothing, exception expected
+ catch (GroupIException& invalid_action) // invalid index
+ {} // do nothing, exception expected
+
+ /* Test skipping exactly as many entries as in the group */
+ try {
+ info.command = RET_ZERO;
+ idx = NDATASETS + 2;
+ obj_name = root_group.getObjnameByIdx(idx);
+
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index");
+ }
+ catch (FileIException& invalid_action) // invalid index
+ {} // do nothing, exception expected
+ catch (GroupIException& invalid_action) // invalid index
+ {} // do nothing, exception expected
+
+ /* Test skipping more entries than are in the group */
+ try {
+ info.command = RET_ZERO;
+ idx = NDATASETS + 3;
+ obj_name = root_group.getObjnameByIdx(idx);
+
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("Group::getObjnameByIdx", "Attempt to iterate with negative index");
+ }
+ catch (FileIException& invalid_action) // invalid index
+ {} // do nothing, exception expected
+ catch (GroupIException& invalid_action) // invalid index
+ {} // do nothing, exception expected
+
+ /* Free the dataset names */
+ for(i = 0; i< (NDATASETS + 2); i++)
+ HDfree(lnames[i]);
+
+ // Everything will be closed as they go out of scope
+
+ PASSED();
+ } // try block
// catch all other exceptions
catch (Exception& E)
{
- issue_fail_msg("test_iter_group", __LINE__, __FILE__);
+ issue_fail_msg("test_iter_group", __LINE__, __FILE__);
}
#if 0
@@ -355,59 +355,59 @@ static void test_iter_group(FileAccPropList& fapl)
/****************************************************************
**
** printelems(): Open an attribute and verify that it has a
-** the correct name
+** the correct name
**
****************************************************************/
-const H5std_string FILE_NAME("titerate.h5");
-const H5std_string GRP_NAME("/Group_A");
-const H5std_string FDATASET_NAME( "file dset" );
-const H5std_string GDATASET_NAME( "group dset" );
-const H5std_string ATTR_NAME( "Units" );
-const H5std_string FATTR_NAME( "F attr" );
-const H5std_string GATTR_NAME( "G attr" );
-const int DIM1 = 2;
+const H5std_string FILE_NAME("titerate.h5");
+const H5std_string GRP_NAME("/Group_A");
+const H5std_string FDATASET_NAME("file dset");
+const H5std_string GDATASET_NAME("group dset");
+const H5std_string ATTR_NAME("Units");
+const H5std_string FATTR_NAME("F attr");
+const H5std_string GATTR_NAME("G attr");
+const int DIM1 = 2;
void printelems(const Group& group, const H5std_string& dsname, const H5std_string& atname)
{
try
{
- DataSet d1(group.openDataSet(dsname));
- DataSpace s1 = d1.getSpace();
- s1.close();
- d1.close();
-
- unsigned idx = 0;
- Attribute a1(group.openAttribute(idx));
- H5std_string aname = a1.getName();
+ DataSet d1(group.openDataSet(dsname));
+ DataSpace s1 = d1.getSpace();
+ s1.close();
+ d1.close();
+
+ unsigned idx = 0;
+ Attribute a1(group.openAttribute(idx));
+ H5std_string aname = a1.getName();
verify_val(aname, atname, "printelems", __LINE__, __FILE__);
- a1.close();
+ a1.close();
}
// catch failure caused by the DataSpace operations
catch( DataSpaceIException error )
{
- error.printError();
+ error.printError();
}
// catch failure caused by the Group operations
catch( GroupIException error )
{
- error.printError();
+ error.printError();
}
// catch failure caused by the DataSet operations
catch( DataSetIException error )
{
- error.printError();
+ error.printError();
}
}
/*-------------------------------------------------------------------------
- * Function: test_HDFFV_9920
+ * Function: test_HDFFV_9920
*
- * Purpose: Tests the fix for HDFFV-9920
+ * Purpose Tests the fix for HDFFV-9920
*
- * Programmer: Binh-Minh Ribler
- * Friday, September 9, 2016
+ * Programmer Binh-Minh Ribler
+ * Friday, September 9, 2016
*
* Modifications:
*
@@ -420,74 +420,74 @@ static void test_HDFFV_9920()
try
{
- // Create a new file and a group in it
- H5File file( FILE_NAME, H5F_ACC_TRUNC );
+ // Create a new file and a group in it
+ H5File file( FILE_NAME, H5F_ACC_TRUNC );
- Group gr1(file.createGroup(GRP_NAME));
+ Group gr1(file.createGroup(GRP_NAME));
- // Create the data space for the attribute.
- DataSpace dspace = DataSpace (1, dims );
+ // Create the data space for the attribute.
+ DataSpace dspace = DataSpace (1, dims );
- DataSet fds = file.createDataSet(FDATASET_NAME, PredType::STD_I32BE, dspace);
- DataSet gds = gr1.createDataSet(GDATASET_NAME, PredType::STD_I32BE, dspace);
+ DataSet fds = file.createDataSet(FDATASET_NAME, PredType::STD_I32BE, dspace);
+ DataSet gds = gr1.createDataSet(GDATASET_NAME, PredType::STD_I32BE, dspace);
- // Create a file attribute and a group attribute.
- Attribute fa1 = file.createAttribute(FATTR_NAME, PredType::STD_I32BE,
- dspace);
- Attribute ga1 = gr1.createAttribute(GATTR_NAME, PredType::STD_I32BE,
- dspace);
+ // Create a file attribute and a group attribute.
+ Attribute fa1 = file.createAttribute(FATTR_NAME, PredType::STD_I32BE,
+ dspace);
+ Attribute ga1 = gr1.createAttribute(GATTR_NAME, PredType::STD_I32BE,
+ dspace);
- // Write the attribute data.
- fa1.write( PredType::NATIVE_INT, attr_data);
- ga1.write( PredType::NATIVE_INT, attr_data);
+ // Write the attribute data.
+ fa1.write( PredType::NATIVE_INT, attr_data);
+ ga1.write( PredType::NATIVE_INT, attr_data);
- fa1.close();
- ga1.close();
- fds.close();
- gds.close();
+ fa1.close();
+ ga1.close();
+ fds.close();
+ gds.close();
- // Verify the attributes have correct names.
- printelems(file, FDATASET_NAME, FATTR_NAME);
- printelems(gr1, GDATASET_NAME, GATTR_NAME);
+ // Verify the attributes have correct names.
+ printelems(file, FDATASET_NAME, FATTR_NAME);
+ printelems(gr1, GDATASET_NAME, GATTR_NAME);
} // end of try block
// catch failure caused by the H5File operations
catch( DataSpaceIException error )
{
- error.printError();
+ error.printError();
}
// catch failure caused by the H5File operations
catch( AttributeIException error )
{
- error.printError();
+ error.printError();
}
// catch failure caused by the H5File operations
catch( FileIException error )
{
- error.printError();
+ error.printError();
}
// catch failure caused by the DataSet operations
catch( DataSetIException error )
{
- error.printError();
+ error.printError();
}
}
/*-------------------------------------------------------------------------
- * Function: test_iterate
+ * Function: test_iterate
*
- * Purpose: Tests iterate functionality
+ * Purpose Tests iterate functionality
*
- * Return: Success: 0
- * Failure: -1
+ * Return Success: 0
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler
- * Tuesday, September 6, 2016
+ * Programmer Binh-Minh Ribler
+ * Tuesday, September 6, 2016
*
* Modifications:
*
@@ -503,20 +503,20 @@ void test_iterate()
FileAccPropList fapl;
fapl.setLibverBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
- test_iter_group(fapl); // Test iterating groups
- test_HDFFV_9920(); // Test the fix of HDFFV-9920
- //test_iter_attr(fapl); // Test iterating attributes
+ test_iter_group(fapl); // Test iterating groups
+ test_HDFFV_9920(); // Test the fix of HDFFV-9920
+ //test_iter_attr(fapl); // Test iterating attributes
} // test_iterate
/*-------------------------------------------------------------------------
* Function: cleanup_iterate
*
- * Purpose: Cleanup temporary test files
+ * Purpose Cleanup temporary test files
*
- * Return: none
+ * Return none
*
- * Programmer: (use C version)
+ * Programmer (use C version)
*
* Modifications:
*
diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp
index 3acf4e1..c217718 100644
--- a/c++/test/tlinks.cpp
+++ b/c++/test/tlinks.cpp
@@ -43,9 +43,9 @@ using namespace H5;
//#define H5G_TESTING
//#include "h5test.h"
-//#include "H5Gpkg.h" /* Groups */
-//#include "H5Iprivate.h" /* IDs */
-//#include "H5Lprivate.h" /* Links */
+//#include "H5Gpkg.h" /* Groups */
+//#include "H5Iprivate.h" /* IDs */
+//#include "H5Lprivate.h" /* Links */
/* File for external link test. Created with gen_udlinks.c */
#define LINKED_FILE "be_extlink2.h5"
@@ -64,39 +64,39 @@ const char *FILENAME[] = {
"links6", /* 9 */
"links7", /* 10 */
"links8", /* 11 */
- "extlinks0", /* 12: main files */
- "tmp/extlinks0", /* 13: */
- "extlinks1", /* 14: target files */
- "tmp/extlinks1", /* 15: */
- "extlinks2", /* 16: */
- "tmp/extlinks2", /* 17: */
- "extlinks3", /* 18: */
- "tmp/extlinks3", /* 19: */
- "extlinks4", /* 20: */
- "tmp/extlinks4", /* 21: */
- "extlinks5", /* 22: */
- "tmp/extlinks6", /* 23: */
- "extlinks7", /* 24: */
- "tmp/extlinks7", /* 25: */
- "tmp/extlinks8", /* 26: */
- "extlinks9", /* 27: */
- "tmp/extlinks9", /* 28: */
- "extlinks10", /* 29: */ /* TESTS for windows */
- "tmp/extlinks10", /* 30: */
- "tmp/extlinks11", /* 31: */
- "tmp/extlinks12", /* 32: */
- "extlinks13", /* 33: */
- "tmp/extlinks13", /* 34: */
- "tmp/extlinks14", /* 35: */
- "tmp/extlinks15", /* 36: */
- "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */
- "extlinks16B", /* 38: */
- "extlinks17", /* 39: */
- "extlinks18A", /* 40: */
- "extlinks18B", /* 41: */
- "extlinks19A", /* 42: */
- "extlinks19B", /* 43: */
- "extlinks20", /* 44: */
+ "extlinks0", /* 12: main files */
+ "tmp/extlinks0", /* 13: */
+ "extlinks1", /* 14: target files */
+ "tmp/extlinks1", /* 15: */
+ "extlinks2", /* 16: */
+ "tmp/extlinks2", /* 17: */
+ "extlinks3", /* 18: */
+ "tmp/extlinks3", /* 19: */
+ "extlinks4", /* 20: */
+ "tmp/extlinks4", /* 21: */
+ "extlinks5", /* 22: */
+ "tmp/extlinks6", /* 23: */
+ "extlinks7", /* 24: */
+ "tmp/extlinks7", /* 25: */
+ "tmp/extlinks8", /* 26: */
+ "extlinks9", /* 27: */
+ "tmp/extlinks9", /* 28: */
+ "extlinks10", /* 29: */ /* TESTS for windows */
+ "tmp/extlinks10", /* 30: */
+ "tmp/extlinks11", /* 31: */
+ "tmp/extlinks12", /* 32: */
+ "extlinks13", /* 33: */
+ "tmp/extlinks13", /* 34: */
+ "tmp/extlinks14", /* 35: */
+ "tmp/extlinks15", /* 36: */
+ "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */
+ "extlinks16B", /* 38: */
+ "extlinks17", /* 39: */
+ "extlinks18A", /* 40: */
+ "extlinks18B", /* 41: */
+ "extlinks19A", /* 42: */
+ "extlinks19B", /* 43: */
+ "extlinks20", /* 44: */
NULL
};
@@ -104,12 +104,12 @@ const char *FILENAME[] = {
#define TMPDIR "tmp"
-#define FAMILY_SIZE 1024
+#define FAMILY_SIZE 1024
#define CORE_INCREMENT 1024
-#define NUM400 400
+#define NUM400 400
/* do not do check_all_closed() for "ext*" files and "tmp/ext*" */
-#define EXTSTOP 12
+#define EXTSTOP 12
#define LINK_BUF_SIZE 1024
#define NAME_BUF_SIZE 1024
@@ -323,16 +323,16 @@ static const char *FILENAME[] = {
/*-------------------------------------------------------------------------
- * Function: test_basic_links
+ * Function: test_basic_links
*
- * Purpose: Test building a file with assorted links.
+ * Purpose Test building a file with assorted links.
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler
- * October 16, 2009
+ * Programmer Binh-Minh Ribler
+ * October 16, 2009
*
* Modifications:
*
@@ -340,114 +340,114 @@ static const char *FILENAME[] = {
*/
static void test_basic_links(hid_t fapl_id, hbool_t new_format)
{
- hsize_t size[1] = {1};
- char filename[NAME_BUF_SIZE];
+ hsize_t size[1] = {1};
+ char filename[NAME_BUF_SIZE];
// Use the file access template id to create a file access prop. list.
FileAccPropList fapl(fapl_id);
try
{
- if(new_format)
- SUBTEST("Link creation (w/new group format)")
- else
- SUBTEST("Link creation")
+ if(new_format)
+ SUBTEST("Link creation (w/new group format)")
+ else
+ SUBTEST("Link creation")
- h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
- H5File file(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
+ H5File file(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
- // Create simple dataspace
- DataSpace scalar (1, size, size);
+ // Create simple dataspace
+ DataSpace scalar (1, size, size);
- // Create a group then close it by letting the object go out of scope
- {
- Group group(file.createGroup("grp1", 0));
- }
+ // Create a group then close it by letting the object go out of scope
+ {
+ Group group(file.createGroup("grp1", 0));
+ }
- // Create a dataset then close it by letting the object go out of scope
- {
- DataSet dset1(file.createDataSet("dset1", PredType::NATIVE_INT, scalar));
- }
+ // Create a dataset then close it by letting the object go out of scope
+ {
+ DataSet dset1(file.createDataSet("dset1", PredType::NATIVE_INT, scalar));
+ }
- hid_t file_id = file.getId();
+ hid_t file_id = file.getId();
- // Because these are not implemented in the C++ API yet, they are
- // used so CommonFG::getLinkval can be tested.
- // Create a hard link
- if(H5Lcreate_hard(
- file_id, "dset1", H5L_SAME_LOC, "grp1/hard1",
- H5P_DEFAULT, H5P_DEFAULT) < 0)
- throw Exception("test_basic_links", "H5Lcreate_hard failed");
+ // Because these are not implemented in the C++ API yet, they are
+ // used so CommonFG::getLinkval can be tested.
+ // Create a hard link
+ if(H5Lcreate_hard(
+ file_id, "dset1", H5L_SAME_LOC, "grp1/hard1",
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ throw Exception("test_basic_links", "H5Lcreate_hard failed");
- // Create a symbolic link
- if(H5Lcreate_soft(
- "/dset1", file_id, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
- throw Exception("test_basic_links", "H5Lcreate_soft failed");
+ // Create a symbolic link
+ if(H5Lcreate_soft(
+ "/dset1", file_id, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ throw Exception("test_basic_links", "H5Lcreate_soft failed");
- // Create a symbolic link to something that doesn't exist
- if(H5Lcreate_soft(
- "foobar", file_id, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0)
- throw Exception("test_basic_links", "H5Lcreate_soft failed");
+ // Create a symbolic link to something that doesn't exist
+ if(H5Lcreate_soft(
+ "foobar", file_id, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ throw Exception("test_basic_links", "H5Lcreate_soft failed");
- // Create a recursive symbolic link
- if(H5Lcreate_soft(
- "/grp1/recursive", file_id, "/grp1/recursive",
- H5P_DEFAULT, H5P_DEFAULT) < 0)
- throw Exception("test_basic_links", "H5Lcreate_soft failed");
+ // Create a recursive symbolic link
+ if(H5Lcreate_soft(
+ "/grp1/recursive", file_id, "/grp1/recursive",
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ throw Exception("test_basic_links", "H5Lcreate_soft failed");
- // Verify link values before closing the file
+ // Verify link values before closing the file
- H5std_string softlink_val = file.getLinkval("grp1/soft");
- verify_val(softlink_val, "/dset1", "H5File::getLinkval grp1/soft", __LINE__, __FILE__);
+ H5std_string softlink_val = file.getLinkval("grp1/soft");
+ verify_val(softlink_val, "/dset1", "H5File::getLinkval grp1/soft", __LINE__, __FILE__);
- H5std_string dngllink_val = file.getLinkval("grp1/dangle");
- verify_val(dngllink_val, "foobar", "H5File::getLinkval grp1/dangle", __LINE__, __FILE__);
+ H5std_string dngllink_val = file.getLinkval("grp1/dangle");
+ verify_val(dngllink_val, "foobar", "H5File::getLinkval grp1/dangle", __LINE__, __FILE__);
- H5std_string reclink_val = file.getLinkval("grp1/recursive");
- verify_val(reclink_val, "/grp1/recursive", "H5File::getLinkval grp1/recursive", __LINE__, __FILE__);
+ H5std_string reclink_val = file.getLinkval("grp1/recursive");
+ verify_val(reclink_val, "/grp1/recursive", "H5File::getLinkval grp1/recursive", __LINE__, __FILE__);
} // end of try block
catch (Exception& E)
{
- issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
// Open the file and check on the links in it
try
{
- // Open the file above
- H5File file(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl);
+ // Open the file above
+ H5File file(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl);
- // Verify link existence
- if(file.exists("dset1", LinkAccPropList::DEFAULT) != TRUE)
- throw InvalidActionException("H5File::exists", "dset1 doesn't exist");
- if(file.exists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE)
- throw InvalidActionException("H5File::exists", "grp1/soft doesn't exist");
+ // Verify link existence
+ if(file.exists("dset1", LinkAccPropList::DEFAULT) != TRUE)
+ throw InvalidActionException("H5File::exists", "dset1 doesn't exist");
+ if(file.exists("grp1/soft", LinkAccPropList::DEFAULT) != TRUE)
+ throw InvalidActionException("H5File::exists", "grp1/soft doesn't exist");
- // Verify link values
- H5std_string softlink_val = file.getLinkval("grp1/soft");
- verify_val(softlink_val, "/dset1", "H5File::getLinkval grp1/soft", __LINE__, __FILE__);
+ // Verify link values
+ H5std_string softlink_val = file.getLinkval("grp1/soft");
+ verify_val(softlink_val, "/dset1", "H5File::getLinkval grp1/soft", __LINE__, __FILE__);
- H5std_string reclink_val = file.getLinkval("grp1/recursive");
- verify_val(reclink_val, "/grp1/recursive", "H5File::getLinkval grp1/recursive", __LINE__, __FILE__);
+ H5std_string reclink_val = file.getLinkval("grp1/recursive");
+ verify_val(reclink_val, "/grp1/recursive", "H5File::getLinkval grp1/recursive", __LINE__, __FILE__);
- PASSED();
+ PASSED();
} // end of try block
catch (Exception& E)
{
- issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
}
/*-------------------------------------------------------------------------
- * Function: test_links
+ * Function: test_links
*
- * Purpose: Test links
+ * Purpose Test links
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler
+ * Programmer Binh-Minh Ribler
* October 16, 2009
*
*-------------------------------------------------------------------------
@@ -455,7 +455,7 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
extern "C"
void test_links()
{
- hid_t fapl_id, fapl2_id; /* File access property lists */
+ hid_t fapl_id, fapl2_id; /* File access property lists */
unsigned new_format; /* Whether to use the new format or not */
const char *envval;
@@ -469,40 +469,40 @@ void test_links()
MESSAGE(5, ("Testing Various Links\n"));
try
{
- /* Copy the file access property list */
- if((fapl2_id = H5Pcopy(fapl_id)) < 0)
- throw Exception("test_links", "H5Pcopy failed");
-
- /* Set the "use the latest version of the format" bounds for creating objects in the file */
- if(H5Pset_libver_bounds(fapl2_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- throw Exception("test_links", "H5Pset_libver_bounds failed");
-
- /* Loop over using new group format */
- for(new_format = FALSE; new_format <= TRUE; new_format++)
- {
- hid_t my_fapl_id;
-
- /* Check for FAPL to use */
- if(new_format)
- my_fapl_id = fapl2_id;
- else
- my_fapl_id = fapl_id;
-
- /* General tests... (on both old & new format groups */
- // FileAccPropList may be passed in instead of fapl id
- test_basic_links(my_fapl_id, new_format);
+ /* Copy the file access property list */
+ if((fapl2_id = H5Pcopy(fapl_id)) < 0)
+ throw Exception("test_links", "H5Pcopy failed");
+
+ /* Set the "use the latest version of the format" bounds for creating objects in the file */
+ if(H5Pset_libver_bounds(fapl2_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ throw Exception("test_links", "H5Pset_libver_bounds failed");
+
+ /* Loop over using new group format */
+ for(new_format = FALSE; new_format <= TRUE; new_format++)
+ {
+ hid_t my_fapl_id;
+
+ /* Check for FAPL to use */
+ if(new_format)
+ my_fapl_id = fapl2_id;
+ else
+ my_fapl_id = fapl_id;
+
+ /* General tests... (on both old & new format groups */
+ // FileAccPropList may be passed in instead of fapl id
+ test_basic_links(my_fapl_id, new_format);
#if 0
// these tests are from the C test links.c and left here for future
// implementation of H5L API
- nerrors += test_basic_links(fapl_id, new_format) < 0 ? 1 : 0;
- nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0;
-
- /* Test new H5L link creation routine */
- nerrors += test_lcpl(my_fapl, new_format);
+ nerrors += test_basic_links(fapl_id, new_format) < 0 ? 1 : 0;
+ nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0;
+
+ /* Test new H5L link creation routine */
+ nerrors += test_lcpl(my_fapl, new_format);
nerrors += test_move(my_fapl, new_format);
nerrors += test_copy(my_fapl, new_format);
nerrors += test_move_preserves(my_fapl, new_format);
@@ -579,7 +579,7 @@ void test_links()
/* do not do this for files used by external link tests */
nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0;
#endif // 0
- } /* end for */
+ } /* end for */
#if 0
/* New group revision feature tests */
@@ -609,33 +609,33 @@ void test_links()
nerrors += group_info_old(fapl) < 0 ? 1 : 0;
#endif
- /* Close 2nd FAPL */
- H5Pclose(fapl2_id);
+ /* Close 2nd FAPL */
+ H5Pclose(fapl2_id);
- h5_clean_files(FILENAME, fapl_id);
+ h5_clean_files(FILENAME, fapl_id);
- /* Test that external links can be used after a library reset. MUST be
- * called last so the reset doesn't interfere with the property lists. This
- * routine will delete its own file. */
- /* nerrors += external_reset_register() < 0 ? 1 : 0;
+ /* Test that external links can be used after a library reset. MUST be
+ * called last so the reset doesn't interfere with the property lists. This
+ * routine will delete its own file. */
+ /* nerrors += external_reset_register() < 0 ? 1 : 0;
*/
}
catch (Exception& E)
{
- issue_fail_msg("test_links()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
}
/*-------------------------------------------------------------------------
- * Function: cleanup_links
+ * Function: cleanup_links
*
- * Purpose: Cleanup temporary test files
+ * Purpose Cleanup temporary test files
*
- * Return: none
+ * Return none
*
- * Programmer: Binh-Minh Ribler
- * October 16, 2009
+ * Programmer Binh-Minh Ribler
+ * October 16, 2009
*
* Modifications:
*
diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp
index 325b2b0..6003dd6 100644
--- a/c++/test/tobject.cpp
+++ b/c++/test/tobject.cpp
@@ -31,41 +31,41 @@ using namespace H5;
#include "h5test.h"
#include "h5cpputil.h" // C++ utilility header file
-const H5std_string FILE_OBJECTS("tobjects.h5");
-const H5std_string GROUP1("Top Group");
-const H5std_string GROUP1_PATH("/Top Group");
-const H5std_string GROUP1_1("Sub-Group 1.1");
-const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1");
-const H5std_string GROUP1_2("Sub-Group 1.2");
-const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2");
-const H5std_string DSET_DEFAULT_NAME("default");
-const H5std_string DSET_IN_FILE("Dataset in File");
-const H5std_string DSET_IN_FILE_PATH("/Dataset in File");
-const H5std_string DSET_IN_GRP1("Dataset_in_Group_1");
-const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset_in_Group_1");
-const H5std_string DSET_IN_GRP1_2("Dataset_in_Group_1.2");
-const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_in_Group_1.2");
+const H5std_string FILE_OBJECTS("tobjects.h5");
+const H5std_string GROUP1("Top Group");
+const H5std_string GROUP1_PATH("/Top Group");
+const H5std_string GROUP1_1("Sub-Group 1.1");
+const H5std_string GROUP1_1_PATH("/Top Group/Sub-Group 1.1");
+const H5std_string GROUP1_2("Sub-Group 1.2");
+const H5std_string GROUP1_2_PATH("/Top Group/Sub-Group 1.2");
+const H5std_string DSET_DEFAULT_NAME("default");
+const H5std_string DSET_IN_FILE("Dataset in File");
+const H5std_string DSET_IN_FILE_PATH("/Dataset in File");
+const H5std_string DSET_IN_GRP1("Dataset_in_Group_1");
+const H5std_string DSET_IN_GRP1_PATH("/Top Group/Dataset_in_Group_1");
+const H5std_string DSET_IN_GRP1_2("Dataset_in_Group_1.2");
+const H5std_string DSET_IN_GRP1_2_PATH("/Top Group/Sub-Group 1.2/Dataset_in_Group_1.2");
/*-------------------------------------------------------------------------
- * Function: test_get_objname
+ * Function: test_get_objname
*
- * Purpose: Tests getting object name of groups and datasets.
+ * Purpose Tests getting object name of groups and datasets.
*
* Description:
- * File structure:
- * GROUP1
- * GROUP1_1
- * GROUP1_2
- * DSET_IN_GRP1_2
- * DSET_IN_GRP1
- * DSET_IN_FILE
+ * File structure:
+ * GROUP1
+ * GROUP1_1
+ * GROUP1_2
+ * DSET_IN_GRP1_2
+ * DSET_IN_GRP1
+ * DSET_IN_FILE
*
*
- * Return: Success: 0
- * Failure: -1
+ * Return Success: 0
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler
- * Friday, March 4, 2014
+ * Programmer Binh-Minh Ribler
+ * Friday, March 4, 2014
*
* Modifications:
*
@@ -76,104 +76,104 @@ static void test_get_objname()
SUBTEST("H5Object::getObjName on Groups and Datasets");
try {
- // Create file
- H5File file(FILE_OBJECTS, H5F_ACC_TRUNC);
+ // Create file
+ H5File file(FILE_OBJECTS, H5F_ACC_TRUNC);
- // Create a top group and 2 subgroups
- Group grp1 = file.createGroup(GROUP1, 0);
- Group grp1_1 = grp1.createGroup(GROUP1_1, 0);
- Group grp1_2 = grp1.createGroup(GROUP1_2, 0);
+ // Create a top group and 2 subgroups
+ Group grp1 = file.createGroup(GROUP1, 0);
+ Group grp1_1 = grp1.createGroup(GROUP1_1, 0);
+ Group grp1_2 = grp1.createGroup(GROUP1_2, 0);
- // Get part of the group's name, random length using
- // ssize_t getObjName(char* comment, size_t buf_size)
+ // Get part of the group's name, random length using
+ // ssize_t getObjName(char* comment, size_t buf_size)
- // Get the length of the group's name first
- ssize_t name_len = grp1.getObjName(NULL);
+ // Get the length of the group's name first
+ ssize_t name_len = grp1.getObjName(NULL);
- // Random length is 4
- if (name_len > 4)
- {
- char* grp1_name = new char[5];
- name_len = grp1.getObjName(grp1_name, 5);
- verify_val((const char*)grp1_name, "/Top", "Group::getObjName", __LINE__, __FILE__);
- delete []grp1_name;
- }
+ // Random length is 4
+ if (name_len > 4)
+ {
+ char* grp1_name = new char[5];
+ name_len = grp1.getObjName(grp1_name, 5);
+ verify_val((const char*)grp1_name, "/Top", "Group::getObjName", __LINE__, __FILE__);
+ delete []grp1_name;
+ }
- // Create a data space
- hsize_t dims[2];
- dims[0] = 2;
- dims[1] = 5;
- DataSpace space (2, dims, NULL);
+ // Create a data space
+ hsize_t dims[2];
+ dims[0] = 2;
+ dims[1] = 5;
+ DataSpace space (2, dims, NULL);
- // Create a dataset in the file
- DataSet dsinfile = file.createDataSet(DSET_IN_FILE,
- PredType::NATIVE_DOUBLE, space);
+ // Create a dataset in the file
+ DataSet dsinfile = file.createDataSet(DSET_IN_FILE,
+ PredType::NATIVE_DOUBLE, space);
- // Create a dataset in the group
- DataSet dsingrp = grp1.createDataSet(DSET_IN_GRP1,
- PredType::NATIVE_INT, space);
+ // Create a dataset in the group
+ DataSet dsingrp = grp1.createDataSet(DSET_IN_GRP1,
+ PredType::NATIVE_INT, space);
- // Get and verify the name of each dataset, using
- // H5std_string getObjName() and
- // ssize_t getObjName(H5std_string& obj_name, size_t len = 0)
- H5std_string ds_name = dsinfile.getObjName();
- verify_val(ds_name, DSET_IN_FILE_PATH, "DataSet::getObjName", __LINE__, __FILE__);
+ // Get and verify the name of each dataset, using
+ // H5std_string getObjName() and
+ // ssize_t getObjName(H5std_string& obj_name, size_t len = 0)
+ H5std_string ds_name = dsinfile.getObjName();
+ verify_val(ds_name, DSET_IN_FILE_PATH, "DataSet::getObjName", __LINE__, __FILE__);
- name_len = dsingrp.getObjName(ds_name); // default len
- verify_val(ds_name, DSET_IN_GRP1_PATH, "DataSet::getObjName", __LINE__, __FILE__);
+ name_len = dsingrp.getObjName(ds_name); // default len
+ verify_val(ds_name, DSET_IN_GRP1_PATH, "DataSet::getObjName", __LINE__, __FILE__);
- // Close dataset
- dsingrp.close();
+ // Close dataset
+ dsingrp.close();
- // Create a dataset in sub-group 1.2
- dsingrp = grp1_2.createDataSet(DSET_IN_GRP1_2, PredType::NATIVE_INT, space);
+ // Create a dataset in sub-group 1.2
+ dsingrp = grp1_2.createDataSet(DSET_IN_GRP1_2, PredType::NATIVE_INT, space);
- // Get and verify the name of the dataset that belongs to subgroup
- // 1.2, using H5std_string getObjName()
- ds_name = dsingrp.getObjName();
- verify_val(ds_name, DSET_IN_GRP1_2_PATH, "DataSet::getObjName", __LINE__, __FILE__);
+ // Get and verify the name of the dataset that belongs to subgroup
+ // 1.2, using H5std_string getObjName()
+ ds_name = dsingrp.getObjName();
+ verify_val(ds_name, DSET_IN_GRP1_2_PATH, "DataSet::getObjName", __LINE__, __FILE__);
- // Close dataset
- dsingrp.close();
+ // Close dataset
+ dsingrp.close();
- // Reopen that same dataset then check the name again with another
- // overload: ssize_t getObjName(H5std_string& obj_name, size_t len = 0)
- dsingrp = grp1_2.openDataSet(DSET_IN_GRP1_2);
- name_len = dsingrp.getObjName(ds_name);
- verify_val(ds_name, DSET_IN_GRP1_2_PATH, "DataSet::getObjName", __LINE__, __FILE__);
+ // Reopen that same dataset then check the name again with another
+ // overload: ssize_t getObjName(H5std_string& obj_name, size_t len = 0)
+ dsingrp = grp1_2.openDataSet(DSET_IN_GRP1_2);
+ name_len = dsingrp.getObjName(ds_name);
+ verify_val(ds_name, DSET_IN_GRP1_2_PATH, "DataSet::getObjName", __LINE__, __FILE__);
- // Everything will be closed as they go out of scope
+ // Everything will be closed as they go out of scope
- PASSED();
- } // try block
+ PASSED();
+ } // try block
// catch all other exceptions
catch (Exception& E)
{
- issue_fail_msg("test_get_objname", __LINE__, __FILE__);
+ issue_fail_msg("test_get_objname", __LINE__, __FILE__);
}
} // test_get_objname
/*-------------------------------------------------------------------------
- * Function: test_existance
+ * Function: test_existance
*
- * Purpose: Tests getting object name of groups and datasets.
+ * Purpose Tests getting object name of groups and datasets.
*
* Description:
- * File structure:
- * GROUP1
- * GROUP1_1
- * GROUP1_2
- * DSET_IN_GRP1_2
- * DSET_IN_GRP1
- * DSET_IN_FILE
+ * File structure:
+ * GROUP1
+ * GROUP1_1
+ * GROUP1_2
+ * DSET_IN_GRP1_2
+ * DSET_IN_GRP1
+ * DSET_IN_FILE
*
*
- * Return: Success: 0
- * Failure: -1
+ * Return Success: 0
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler
- * Friday, March 4, 2014
+ * Programmer Binh-Minh Ribler
+ * Friday, March 4, 2014
*
* Modifications:
*
@@ -184,62 +184,62 @@ static void test_existance()
SUBTEST("H5File::exists and Group::exists");
try {
- // Open file
- H5File file(FILE_OBJECTS, H5F_ACC_RDONLY);
+ // Open file
+ H5File file(FILE_OBJECTS, H5F_ACC_RDONLY);
- // Check if GROUP1 exists in the file
- bool exists = file.exists(GROUP1);
+ // Check if GROUP1 exists in the file
+ bool exists = file.exists(GROUP1);
- // Open GROUP1
- Group grp1 = file.openGroup(GROUP1);
+ // Open GROUP1
+ Group grp1 = file.openGroup(GROUP1);
- // Check if GROUP1_1 and GROUP1_2 exist in GROUP1
- exists = grp1.exists(GROUP1_1);
- verify_val(exists, TRUE, "Group::exists GROUP1_1", __LINE__, __FILE__);
- exists = grp1.exists(GROUP1_2);
- verify_val(exists, TRUE, "Group::exists GROUP1_2", __LINE__, __FILE__);
+ // Check if GROUP1_1 and GROUP1_2 exist in GROUP1
+ exists = grp1.exists(GROUP1_1);
+ verify_val(exists, TRUE, "Group::exists GROUP1_1", __LINE__, __FILE__);
+ exists = grp1.exists(GROUP1_2);
+ verify_val(exists, TRUE, "Group::exists GROUP1_2", __LINE__, __FILE__);
- // Check if DSET_IN_GRP1 exists in GROUP1
- exists = grp1.exists(DSET_IN_GRP1);
- verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__);
+ // Check if DSET_IN_GRP1 exists in GROUP1
+ exists = grp1.exists(DSET_IN_GRP1);
+ verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__);
- // Open GROUP1_2
- Group grp1_2 = grp1.openGroup(GROUP1_2);
+ // Open GROUP1_2
+ Group grp1_2 = grp1.openGroup(GROUP1_2);
- // Check if DSET_IN_GRP1_2 exists in GROUP1_2
- exists = grp1_2.exists(DSET_IN_GRP1_2);
- verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1_2", __LINE__, __FILE__);
+ // Check if DSET_IN_GRP1_2 exists in GROUP1_2
+ exists = grp1_2.exists(DSET_IN_GRP1_2);
+ verify_val(exists, TRUE, "Group::exists DSET_IN_GRP1_2", __LINE__, __FILE__);
- // Check if a dataset exists given dataset as location with full path name
- DataSet dset1 = file.openDataSet(DSET_IN_FILE);
- exists = dset1.exists("/Top Group/Dataset_in_Group_1");
- verify_val(exists, TRUE, "Group::exists given dataset with full path name", __LINE__, __FILE__);
+ // Check if a dataset exists given dataset as location with full path name
+ DataSet dset1 = file.openDataSet(DSET_IN_FILE);
+ exists = dset1.exists("/Top Group/Dataset_in_Group_1");
+ verify_val(exists, TRUE, "Group::exists given dataset with full path name", __LINE__, __FILE__);
- exists = grp1_2.exists(DSET_IN_GRP1);
- verify_val(exists, FALSE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__);
+ exists = grp1_2.exists(DSET_IN_GRP1);
+ verify_val(exists, FALSE, "Group::exists DSET_IN_GRP1", __LINE__, __FILE__);
- // Everything will be closed as they go out of scope
+ // Everything will be closed as they go out of scope
- PASSED();
- } // try block
+ PASSED();
+ } // try block
// catch all other exceptions
catch (Exception& E)
{
- issue_fail_msg("test_existance", __LINE__, __FILE__);
+ issue_fail_msg("test_existance", __LINE__, __FILE__);
}
} // test_existance
/*-------------------------------------------------------------------------
- * Function: test_get_objname_ontypes
+ * Function: test_get_objname_ontypes
*
- * Purpose: Test getting object name from various committed types.
+ * Purpose Test getting object name from various committed types.
*
- * Return: Success: 0
- * Failure: -1
+ * Return Success: 0
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler
- * March 4, 2014
+ * Programmer Binh-Minh Ribler
+ * March 4, 2014
*
* Modifications:
*
@@ -250,97 +250,97 @@ static void test_get_objname_ontypes()
SUBTEST("H5Object::getObjName on Committed Datatypes");
try {
- // Create a file with default prop lists
- H5File file(FILE_OBJECTS, H5F_ACC_RDWR);
-
- // Create a group
- Group grp = file.createGroup ("typetests");
-
- // Create a datatype and save it
- IntType inttype(PredType::STD_B8LE);
- inttype.commit(file, "INT type of STD_B8LE");
-
- // Close the type then open it again to test getting its name
- inttype.close();
- inttype = file.openIntType("INT type of STD_B8LE"); // deprecated
-
- // Get and verify its name
- H5std_string inttype_name = inttype.getObjName();
- verify_val(inttype_name, "/INT type of STD_B8LE", "DataType::getObjName", __LINE__, __FILE__);
-
- // Close the type then open it again to test getting its name, but
- // with the constructor this time
- inttype.close();
- IntType std_b8le(file, "INT type of STD_B8LE");
-
- // Get and verify its name
- H5std_string std_b8le_name = std_b8le.getObjName();
- verify_val(std_b8le_name, "/INT type of STD_B8LE", "DataType::getObjName", __LINE__, __FILE__);
-
- // Make copy of a predefined type and save it
- DataType dtype(PredType::STD_B8LE);
- dtype.commit(file, "STD_B8LE");
-
- // Close the data type and file
- dtype.close();
- file.close();
-
- // Re-open the file and the data type to test getting its name
- file.openFile(FILE_OBJECTS, H5F_ACC_RDWR);
- dtype = file.openDataType("STD_B8LE"); // deprecated
-
- // Get and verify its name
- H5std_string type_name = dtype.getObjName();
- verify_val(type_name, "/STD_B8LE", "DataType::getObjName", __LINE__, __FILE__);
-
- // Close the type and open it again with the constructor then test
- // getting its name
- dtype.close();
- DataType dtype2(file, "STD_B8LE");
- type_name = dtype2.getObjName();
- verify_val(type_name, "/STD_B8LE", "DataType::getObjName", __LINE__, __FILE__);
-
- // Test getting type's name from copied type
- DataType copied_type;
- copied_type.copy(dtype2);
- copied_type.commit(file, "copy of STD_B8LE");
- type_name = copied_type.getObjName();
- verify_val(type_name, "/copy of STD_B8LE", "DataType::getObjName", __LINE__, __FILE__);
-
- // Test copying an integer predefined type
- IntType new_int_type(PredType::NATIVE_INT);
-
- // Name this datatype
- new_int_type.commit(grp, "IntType NATIVE_INT");
- ssize_t name_len = new_int_type.getObjName(type_name); // default len
- verify_val(name_len, (ssize_t)HDstrlen("/typetests/IntType NATIVE_INT"), "DataType::getObjName", __LINE__, __FILE__);
- verify_val(type_name, "/typetests/IntType NATIVE_INT", "DataType::getObjName", __LINE__, __FILE__);
-
- // Close everything or they can be closed when objects go out of scope
- dtype2.close();
- copied_type.close();
- new_int_type.close();
- grp.close();
-
- PASSED();
+ // Create a file with default prop lists
+ H5File file(FILE_OBJECTS, H5F_ACC_RDWR);
+
+ // Create a group
+ Group grp = file.createGroup ("typetests");
+
+ // Create a datatype and save it
+ IntType inttype(PredType::STD_B8LE);
+ inttype.commit(file, "INT type of STD_B8LE");
+
+ // Close the type then open it again to test getting its name
+ inttype.close();
+ inttype = file.openIntType("INT type of STD_B8LE"); // deprecated
+
+ // Get and verify its name
+ H5std_string inttype_name = inttype.getObjName();
+ verify_val(inttype_name, "/INT type of STD_B8LE", "DataType::getObjName", __LINE__, __FILE__);
+
+ // Close the type then open it again to test getting its name, but
+ // with the constructor this time
+ inttype.close();
+ IntType std_b8le(file, "INT type of STD_B8LE");
+
+ // Get and verify its name
+ H5std_string std_b8le_name = std_b8le.getObjName();
+ verify_val(std_b8le_name, "/INT type of STD_B8LE", "DataType::getObjName", __LINE__, __FILE__);
+
+ // Make copy of a predefined type and save it
+ DataType dtype(PredType::STD_B8LE);
+ dtype.commit(file, "STD_B8LE");
+
+ // Close the data type and file
+ dtype.close();
+ file.close();
+
+ // Re-open the file and the data type to test getting its name
+ file.openFile(FILE_OBJECTS, H5F_ACC_RDWR);
+ dtype = file.openDataType("STD_B8LE"); // deprecated
+
+ // Get and verify its name
+ H5std_string type_name = dtype.getObjName();
+ verify_val(type_name, "/STD_B8LE", "DataType::getObjName", __LINE__, __FILE__);
+
+ // Close the type and open it again with the constructor then test
+ // getting its name
+ dtype.close();
+ DataType dtype2(file, "STD_B8LE");
+ type_name = dtype2.getObjName();
+ verify_val(type_name, "/STD_B8LE", "DataType::getObjName", __LINE__, __FILE__);
+
+ // Test getting type's name from copied type
+ DataType copied_type;
+ copied_type.copy(dtype2);
+ copied_type.commit(file, "copy of STD_B8LE");
+ type_name = copied_type.getObjName();
+ verify_val(type_name, "/copy of STD_B8LE", "DataType::getObjName", __LINE__, __FILE__);
+
+ // Test copying an integer predefined type
+ IntType new_int_type(PredType::NATIVE_INT);
+
+ // Name this datatype
+ new_int_type.commit(grp, "IntType NATIVE_INT");
+ ssize_t name_len = new_int_type.getObjName(type_name); // default len
+ verify_val(name_len, (ssize_t)HDstrlen("/typetests/IntType NATIVE_INT"), "DataType::getObjName", __LINE__, __FILE__);
+ verify_val(type_name, "/typetests/IntType NATIVE_INT", "DataType::getObjName", __LINE__, __FILE__);
+
+ // Close everything or they can be closed when objects go out of scope
+ dtype2.close();
+ copied_type.close();
+ new_int_type.close();
+ grp.close();
+
+ PASSED();
} // end top try block
catch (Exception& E)
{
- issue_fail_msg("test_get_objname_ontypes", __LINE__, __FILE__);
+ issue_fail_msg("test_get_objname_ontypes", __LINE__, __FILE__);
}
} // test_get_objname_ontypes
/*-------------------------------------------------------------------------
- * Function: test_get_objtype
+ * Function: test_get_objtype
*
- * Purpose: Tests getting object type
+ * Purpose Tests getting object type
*
- * Return: Success: 0
- * Failure: -1
+ * Return Success: 0
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler
- * Friday, March 4, 2014
+ * Programmer Binh-Minh Ribler
+ * Friday, March 4, 2014
*
* Modifications:
*
@@ -351,61 +351,61 @@ static void test_get_objtype()
SUBTEST("H5File::childObjType and H5Group::childObjType");
try {
- // Open file
- H5File file(FILE_OBJECTS, H5F_ACC_RDWR);
+ // Open file
+ H5File file(FILE_OBJECTS, H5F_ACC_RDWR);
- // Open the top group
- Group grp1 = file.openGroup(GROUP1);
+ // Open the top group
+ Group grp1 = file.openGroup(GROUP1);
- // Create a datatype and save it
- DataType dtype(PredType::STD_I32LE);
- dtype.commit(grp1, "STD_I32LE");
+ // Create a datatype and save it
+ DataType dtype(PredType::STD_I32LE);
+ dtype.commit(grp1, "STD_I32LE");
- // Get and verify object type with
- // H5O_type_t childObjType(const H5std_string& objname)
- H5O_type_t objtype = file.childObjType(DSET_IN_FILE);
- verify_val(objtype, H5O_TYPE_DATASET, "DataSet::childObjType", __LINE__, __FILE__);
+ // Get and verify object type with
+ // H5O_type_t childObjType(const H5std_string& objname)
+ H5O_type_t objtype = file.childObjType(DSET_IN_FILE);
+ verify_val(objtype, H5O_TYPE_DATASET, "DataSet::childObjType", __LINE__, __FILE__);
- // Get and verify object type with
- // H5O_type_t childObjType(const char* objname)
- objtype = grp1.childObjType(GROUP1_1.c_str());
- verify_val(objtype, H5O_TYPE_GROUP, "DataSet::childObjType", __LINE__, __FILE__);
+ // Get and verify object type with
+ // H5O_type_t childObjType(const char* objname)
+ objtype = grp1.childObjType(GROUP1_1.c_str());
+ verify_val(objtype, H5O_TYPE_GROUP, "DataSet::childObjType", __LINE__, __FILE__);
- // Get and verify object type with
- // H5O_type_t childObjType(hsize_t index, H5_index_t index_type,
- // H5_iter_order_t order, const char* objname=".")
- objtype = grp1.childObjType((hsize_t)1, H5_INDEX_NAME, H5_ITER_INC);
- verify_val(objtype, H5O_TYPE_NAMED_DATATYPE, "DataSet::childObjType", __LINE__, __FILE__);
+ // Get and verify object type with
+ // H5O_type_t childObjType(hsize_t index, H5_index_t index_type,
+ // H5_iter_order_t order, const char* objname=".")
+ objtype = grp1.childObjType((hsize_t)1, H5_INDEX_NAME, H5_ITER_INC);
+ verify_val(objtype, H5O_TYPE_NAMED_DATATYPE, "DataSet::childObjType", __LINE__, __FILE__);
- // Get and verify object type with
- // H5O_type_t childObjType(hsize_t index,
- // H5_index_t index_type=H5_INDEX_NAME,
- // H5_iter_order_t order=H5_ITER_INC, const char* objname=".")
- objtype = grp1.childObjType((hsize_t)2);
- verify_val(objtype, H5O_TYPE_GROUP, "DataSet::childObjType", __LINE__, __FILE__);
+ // Get and verify object type with
+ // H5O_type_t childObjType(hsize_t index,
+ // H5_index_t index_type=H5_INDEX_NAME,
+ // H5_iter_order_t order=H5_ITER_INC, const char* objname=".")
+ objtype = grp1.childObjType((hsize_t)2);
+ verify_val(objtype, H5O_TYPE_GROUP, "DataSet::childObjType", __LINE__, __FILE__);
- // Everything will be closed as they go out of scope
+ // Everything will be closed as they go out of scope
- PASSED();
- } // try block
+ PASSED();
+ } // try block
// catch all other exceptions
catch (Exception& E)
{
- issue_fail_msg("test_get_objtype", __LINE__, __FILE__);
+ issue_fail_msg("test_get_objtype", __LINE__, __FILE__);
}
} // test_get_objtype
/*-------------------------------------------------------------------------
- * Function: test_objects
+ * Function: test_objects
*
- * Purpose: Tests HDF5 object related functionality
+ * Purpose Tests HDF5 object related functionality
*
- * Return: Success: 0
- * Failure: -1
+ * Return Success: 0
+ * Failure: -1
*
- * Programmer: Binh-Minh Ribler
- * Friday, Mar 4, 2014
+ * Programmer Binh-Minh Ribler
+ * Friday, Mar 4, 2014
*
* Modifications:
*
@@ -419,7 +419,7 @@ void test_object()
test_get_objname(); // Test get object name from groups/datasets
test_existance(); // Test check for object existance
- test_get_objname_ontypes(); // Test get object name from types
+ test_get_objname_ontypes(); // Test get object name from types
test_get_objtype(); // Test get object type
} // test_objects
@@ -427,11 +427,11 @@ void test_object()
/*-------------------------------------------------------------------------
* Function: cleanup_objects
*
- * Purpose: Cleanup temporary test files
+ * Purpose Cleanup temporary test files
*
- * Return: none
+ * Return none
*
- * Programmer: (use C version)
+ * Programmer (use C version)
*
* Modifications:
*
diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp
index 9bc2eb0..d8a0d5f 100644
--- a/c++/test/trefer.cpp
+++ b/c++/test/trefer.cpp
@@ -16,7 +16,7 @@
/*****************************************************************************
FILE
trefer.cpp - HDF5 C++ testing the functionalities associated with the C
- Reference interface (H5R)
+ Reference interface (H5R)
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
@@ -79,100 +79,100 @@ test_reference_params(void)
H5File* file1 = NULL;
try {
- hobj_ref_t *wbuf, // buffer to write to disk
- *rbuf, // buffer read from disk
- *tbuf; // temp. buffer read from disk
+ hobj_ref_t *wbuf, // buffer to write to disk
+ *rbuf, // buffer read from disk
+ *tbuf; // temp. buffer read from disk
- // Allocate write & read buffers
- int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t));
- wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
- rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
- tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
+ // Allocate write & read buffers
+ int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t));
+ wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
+ rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
+ tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
// Create file FILE1
file1 = new H5File (FILE1, H5F_ACC_TRUNC);
- // Create dataspace for datasets
- hsize_t dims1[] = {SPACE1_DIM1};
- DataSpace sid1(SPACE1_RANK, dims1);
-
- // Create a group
- Group group = file1->createGroup("Group1");
-
- // Set group's comment
- group.setComment(".", write_comment);
-
- // Create a dataset (inside /Group1)
- DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1);
-
- unsigned *tu32; // Temporary pointer to uint32 data
- int i;
- for (tu32=(unsigned *)wbuf, i=0; i<SPACE1_DIM1; i++)
- *tu32++=i*3; // from C test
-
- // Write selection to disk
- dataset.write(wbuf, PredType::NATIVE_UINT);
-
- // Close Dataset
- dataset.close();
-
- // Create another dataset (inside /Group1)
- dataset = group.createDataSet("Dataset2", PredType::NATIVE_UCHAR, sid1);
-
- // Close Dataset
- dataset.close();
-
- // Create a datatype to refer to
- CompType dtype1(sizeof(s1_t));
-
- // Insert fields
- dtype1.insertMember(MEMBER1, HOFFSET(s1_t, a), PredType::NATIVE_INT);
- dtype1.insertMember(MEMBER2, HOFFSET(s1_t, b), PredType::NATIVE_INT);
- dtype1.insertMember(MEMBER3, HOFFSET(s1_t, c), PredType::NATIVE_FLOAT);
-
- // Save datatype for later
- dtype1.commit(group, "Datatype1");
-
- // Close datatype and group
- dtype1.close();
- group.close();
-
- // Create a dataset
- dataset = file1->createDataSet("Dataset3", PredType::STD_REF_OBJ, sid1);
-
- /* Test parameters to H5Location::reference */
- try {
- file1->reference(NULL, "/Group1/Dataset1");
- } catch (ReferenceException& E) {} // We expect this to fail
- try {
- file1->reference(&wbuf[0], NULL);
- } catch (ReferenceException& E) {} // We expect this to fail
- try {
- file1->reference(&wbuf[0], "");
- } catch (ReferenceException& E) {} // We expect this to fail
- try {
- file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_MAXTYPE);
- } catch (ReferenceException& E) {} // We expect this to fail
- try {
- file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_DATASET_REGION);
- } catch (ReferenceException& E) {} // We expect this to fail
-
- // Close resources
- dataset.close();
- file1->close();
- // Let sid1 go out of scope
-
- // Free memory buffers
- HDfree(wbuf);
- HDfree(rbuf);
- HDfree(tbuf);
-
- PASSED();
+ // Create dataspace for datasets
+ hsize_t dims1[] = {SPACE1_DIM1};
+ DataSpace sid1(SPACE1_RANK, dims1);
+
+ // Create a group
+ Group group = file1->createGroup("Group1");
+
+ // Set group's comment
+ group.setComment(".", write_comment);
+
+ // Create a dataset (inside /Group1)
+ DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1);
+
+ unsigned *tu32; // Temporary pointer to uint32 data
+ int i;
+ for (tu32=(unsigned *)wbuf, i=0; i<SPACE1_DIM1; i++)
+ *tu32++=i*3; // from C test
+
+ // Write selection to disk
+ dataset.write(wbuf, PredType::NATIVE_UINT);
+
+ // Close Dataset
+ dataset.close();
+
+ // Create another dataset (inside /Group1)
+ dataset = group.createDataSet("Dataset2", PredType::NATIVE_UCHAR, sid1);
+
+ // Close Dataset
+ dataset.close();
+
+ // Create a datatype to refer to
+ CompType dtype1(sizeof(s1_t));
+
+ // Insert fields
+ dtype1.insertMember(MEMBER1, HOFFSET(s1_t, a), PredType::NATIVE_INT);
+ dtype1.insertMember(MEMBER2, HOFFSET(s1_t, b), PredType::NATIVE_INT);
+ dtype1.insertMember(MEMBER3, HOFFSET(s1_t, c), PredType::NATIVE_FLOAT);
+
+ // Save datatype for later
+ dtype1.commit(group, "Datatype1");
+
+ // Close datatype and group
+ dtype1.close();
+ group.close();
+
+ // Create a dataset
+ dataset = file1->createDataSet("Dataset3", PredType::STD_REF_OBJ, sid1);
+
+ /* Test parameters to H5Location::reference */
+ try {
+ file1->reference(NULL, "/Group1/Dataset1");
+ } catch (ReferenceException& E) {} // We expect this to fail
+ try {
+ file1->reference(&wbuf[0], NULL);
+ } catch (ReferenceException& E) {} // We expect this to fail
+ try {
+ file1->reference(&wbuf[0], "");
+ } catch (ReferenceException& E) {} // We expect this to fail
+ try {
+ file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_MAXTYPE);
+ } catch (ReferenceException& E) {} // We expect this to fail
+ try {
+ file1->reference(&wbuf[0], "/Group1/Dataset1", H5R_DATASET_REGION);
+ } catch (ReferenceException& E) {} // We expect this to fail
+
+ // Close resources
+ dataset.close();
+ file1->close();
+ // Let sid1 go out of scope
+
+ // Free memory buffers
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(tbuf);
+
+ PASSED();
} // end try
catch (Exception& E)
{
- issue_fail_msg("test_reference_param()",__LINE__,__FILE__,
- E.getCFuncName(), E.getCDetailMsg());
+ issue_fail_msg("test_reference_param()",__LINE__,__FILE__,
+ E.getCFuncName(), E.getCDetailMsg());
}
if(file1)
@@ -182,7 +182,7 @@ test_reference_params(void)
/****************************************************************
**
** test_reference_obj(): Test basic object reference functions
-** to various kinds of objects
+** to various kinds of objects
**
****************************************************************/
static void test_reference_obj(void)
@@ -195,176 +195,176 @@ static void test_reference_obj(void)
H5File* file1 = NULL;
try {
- hobj_ref_t *wbuf, // buffer to write to disk
- *rbuf, // buffer read from disk
- *tbuf; // temp. buffer read from disk
+ hobj_ref_t *wbuf, // buffer to write to disk
+ *rbuf, // buffer read from disk
+ *tbuf; // temp. buffer read from disk
- // Allocate write & read buffers
- int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t));
- wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
- rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
- tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
+ // Allocate write & read buffers
+ int temp_size = MAX(sizeof(unsigned),sizeof(hobj_ref_t));
+ wbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
+ rbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
+ tbuf=(hobj_ref_t*)HDmalloc(temp_size*SPACE1_DIM1);
// Create file FILE1
file1 = new H5File (FILE1, H5F_ACC_TRUNC);
- // Create dataspace for datasets
- hsize_t dims1[] = {SPACE1_DIM1};
- DataSpace sid1(SPACE1_RANK, dims1);
+ // Create dataspace for datasets
+ hsize_t dims1[] = {SPACE1_DIM1};
+ DataSpace sid1(SPACE1_RANK, dims1);
- // Create dataset access property list
- PropList dapl(H5P_DATASET_ACCESS);
+ // Create dataset access property list
+ PropList dapl(H5P_DATASET_ACCESS);
- // Create a group
- Group group = file1->createGroup("Group1");
+ // Create a group
+ Group group = file1->createGroup("Group1");
- // Set group's comment
- group.setComment(".", write_comment);
+ // Set group's comment
+ group.setComment(".", write_comment);
- // Create a dataset (inside /Group1)
- DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1);
+ // Create a dataset (inside /Group1)
+ DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1);
- unsigned *tu32; // Temporary pointer to uint32 data
- for (tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++=i*3; // from C test
+ unsigned *tu32; // Temporary pointer to uint32 data
+ for (tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
+ *tu32++=i*3; // from C test
- // Write selection to disk
- dataset.write(wbuf, PredType::NATIVE_UINT);
+ // Write selection to disk
+ dataset.write(wbuf, PredType::NATIVE_UINT);
- // Close Dataset
- dataset.close();
+ // Close Dataset
+ dataset.close();
- // Create another dataset (inside /Group1)
- dataset = group.createDataSet("Dataset2", PredType::NATIVE_UCHAR, sid1);
+ // Create another dataset (inside /Group1)
+ dataset = group.createDataSet("Dataset2", PredType::NATIVE_UCHAR, sid1);
- // Close Dataset
- dataset.close();
+ // Close Dataset
+ dataset.close();
- // Create a datatype to refer to
- CompType dtype1(sizeof(s1_t));
+ // Create a datatype to refer to
+ CompType dtype1(sizeof(s1_t));
- // Insert fields
- dtype1.insertMember(MEMBER1, HOFFSET(s1_t, a), PredType::NATIVE_INT);
- dtype1.insertMember(MEMBER2, HOFFSET(s1_t, b), PredType::NATIVE_INT);
- dtype1.insertMember(MEMBER3, HOFFSET(s1_t, c), PredType::NATIVE_FLOAT);
+ // Insert fields
+ dtype1.insertMember(MEMBER1, HOFFSET(s1_t, a), PredType::NATIVE_INT);
+ dtype1.insertMember(MEMBER2, HOFFSET(s1_t, b), PredType::NATIVE_INT);
+ dtype1.insertMember(MEMBER3, HOFFSET(s1_t, c), PredType::NATIVE_FLOAT);
- // Save datatype for later
- dtype1.commit(group, "Datatype1");
+ // Save datatype for later
+ dtype1.commit(group, "Datatype1");
- // Close datatype and group
- dtype1.close();
- group.close();
+ // Close datatype and group
+ dtype1.close();
+ group.close();
- // Create a dataset
- dataset = file1->createDataSet("Dataset3", PredType::STD_REF_OBJ, sid1);
+ // Create a dataset
+ dataset = file1->createDataSet("Dataset3", PredType::STD_REF_OBJ, sid1);
- // Create reference to dataset and test getRefObjType
- file1->reference(&wbuf[0], "/Group1/Dataset1");
- H5O_type_t refobj_type = dataset.getRefObjType(&wbuf[0], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
+ // Create reference to dataset and test getRefObjType
+ file1->reference(&wbuf[0], "/Group1/Dataset1");
+ H5O_type_t refobj_type = dataset.getRefObjType(&wbuf[0], H5R_OBJECT);
+ verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
- // Create reference to dataset and test getRefObjType
- file1->reference(&wbuf[1], "/Group1/Dataset2");
- refobj_type = dataset.getRefObjType(&wbuf[1], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
+ // Create reference to dataset and test getRefObjType
+ file1->reference(&wbuf[1], "/Group1/Dataset2");
+ refobj_type = dataset.getRefObjType(&wbuf[1], H5R_OBJECT);
+ verify_val(refobj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
- // Create reference to group
- file1->reference(&wbuf[2], "/Group1");
- refobj_type = dataset.getRefObjType(&wbuf[2], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType",__LINE__,__FILE__);
+ // Create reference to group
+ file1->reference(&wbuf[2], "/Group1");
+ refobj_type = dataset.getRefObjType(&wbuf[2], H5R_OBJECT);
+ verify_val(refobj_type, H5O_TYPE_GROUP, "DataSet::getRefObjType",__LINE__,__FILE__);
- // Create reference to named datatype
- file1->reference(&wbuf[3], "/Group1/Datatype1");
- refobj_type = dataset.getRefObjType(&wbuf[3], H5R_OBJECT);
- verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType",__LINE__,__FILE__);
+ // Create reference to named datatype
+ file1->reference(&wbuf[3], "/Group1/Datatype1");
+ refobj_type = dataset.getRefObjType(&wbuf[3], H5R_OBJECT);
+ verify_val(refobj_type, H5O_TYPE_NAMED_DATATYPE, "DataSet::getRefObjType",__LINE__,__FILE__);
- // Write selection to disk
- dataset.write(wbuf, PredType::STD_REF_OBJ);
+ // Write selection to disk
+ dataset.write(wbuf, PredType::STD_REF_OBJ);
- // Close disk dataspace, dataset, and file
- sid1.close();
- dataset.close();
- delete file1;
+ // Close disk dataspace, dataset, and file
+ sid1.close();
+ dataset.close();
+ delete file1;
- // Re-open the file
- file1 = new H5File(FILE1, H5F_ACC_RDWR);
+ // Re-open the file
+ file1 = new H5File(FILE1, H5F_ACC_RDWR);
- // Open the dataset
- dataset = file1->openDataSet("/Dataset3");
+ // Open the dataset
+ dataset = file1->openDataSet("/Dataset3");
- // Read selection from disk
- dataset.read(rbuf, PredType::STD_REF_OBJ);
+ // Read selection from disk
+ dataset.read(rbuf, PredType::STD_REF_OBJ);
- // Dereference dataset object by ctor, from the location where
- // 'dataset' is located
- DataSet dset2(dataset, &rbuf[0], H5R_OBJECT, dapl);
+ // Dereference dataset object by ctor, from the location where
+ // 'dataset' is located
+ DataSet dset2(dataset, &rbuf[0], H5R_OBJECT, dapl);
- // Check information in the referenced dataset
- sid1 = dset2.getSpace();
- hssize_t n_elements = sid1.getSimpleExtentNpoints();
- verify_val((long)n_elements, 4, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
+ // Check information in the referenced dataset
+ sid1 = dset2.getSpace();
+ hssize_t n_elements = sid1.getSimpleExtentNpoints();
+ verify_val((long)n_elements, 4, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
- // Read from disk
- dset2.read(tbuf, PredType::NATIVE_UINT);
+ // Read from disk
+ dset2.read(tbuf, PredType::NATIVE_UINT);
- for(tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
- verify_val(*tu32, (uint32_t)(i*3), "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
+ for(tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
+ verify_val(*tu32, (uint32_t)(i*3), "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
- // Close dereferenced dataset
- dset2.close();
+ // Close dereferenced dataset
+ dset2.close();
- // Dereference group object from the location where 'dataset' is located
- group.dereference(dataset, &rbuf[2]);
+ // Dereference group object from the location where 'dataset' is located
+ group.dereference(dataset, &rbuf[2]);
- // Get group's comment using
- // H5std_string getComment(const char* name, <buf_size=0 by default>)
- H5std_string read_comment1 = group.getComment(".", 10);
- verify_val(read_comment1.c_str(), write_comment, "Group::getComment",__LINE__,__FILE__);
+ // Get group's comment using
+ // H5std_string getComment(const char* name, <buf_size=0 by default>)
+ H5std_string read_comment1 = group.getComment(".", 10);
+ verify_val(read_comment1.c_str(), write_comment, "Group::getComment",__LINE__,__FILE__);
- // Test with the old default value
- read_comment1 = group.getComment(".", 256);
- verify_val(read_comment1.c_str(), write_comment, "Group::getComment",__LINE__,__FILE__);
+ // Test with the old default value
+ read_comment1 = group.getComment(".", 256);
+ verify_val(read_comment1.c_str(), write_comment, "Group::getComment",__LINE__,__FILE__);
- // Test that getComment handles failures gracefully, using
- // H5std_string getComment(const char* name, <buf_size=0 by default>)
- try {
- H5std_string read_comment_tmp = group.getComment(NULL);
- }
- catch (Exception& E) {} // We expect this to fail
+ // Test that getComment handles failures gracefully, using
+ // H5std_string getComment(const char* name, <buf_size=0 by default>)
+ try {
+ H5std_string read_comment_tmp = group.getComment(NULL);
+ }
+ catch (Exception& E) {} // We expect this to fail
- // Close group
- group.close();
+ // Close group
+ group.close();
- /*
- * Verify correct referenced datatype
- */
- // Open datatype object
- dtype1.dereference(dataset, &rbuf[3]);
+ /*
+ * Verify correct referenced datatype
+ */
+ // Open datatype object
+ dtype1.dereference(dataset, &rbuf[3]);
- // Verify correct datatype
+ // Verify correct datatype
H5T_class_t tclass;
tclass = dtype1.getClass();
- verify_val(tclass, H5T_COMPOUND, "DataType::getClass",__LINE__,__FILE__);
- int n_members = dtype1.getNmembers();
+ verify_val(tclass, H5T_COMPOUND, "DataType::getClass",__LINE__,__FILE__);
+ int n_members = dtype1.getNmembers();
verify_val(n_members, 3, "CompType::getNmembers",__LINE__,__FILE__);
- // Close all objects and file
- dtype1.close();
- dataset.close();
- file1->close();
+ // Close all objects and file
+ dtype1.close();
+ dataset.close();
+ file1->close();
- // Free allocated buffers
- HDfree(wbuf);
- HDfree(rbuf);
- HDfree(tbuf);
+ // Free allocated buffers
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(tbuf);
- PASSED();
+ PASSED();
} // end try
catch (Exception& E)
{
- issue_fail_msg("test_reference_obj()",__LINE__,__FILE__,
- E.getCFuncName(), E.getCDetailMsg());
+ issue_fail_msg("test_reference_obj()",__LINE__,__FILE__,
+ E.getCFuncName(), E.getCDetailMsg());
}
if(file1)
@@ -376,7 +376,7 @@ static void test_reference_obj(void)
**
** test_reference_group(): Test object reference functionality
** Tests for correct behavior of various routines on
-** dereferenced group
+** dereferenced group
**
****************************************************************/
#define GROUPNAME "/group"
@@ -389,8 +389,8 @@ static void test_reference_obj(void)
static void
test_reference_group(void)
{
- hobj_ref_t wref; /* Reference to write */
- hobj_ref_t rref; /* Reference to read */
+ hobj_ref_t wref; /* Reference to write */
+ hobj_ref_t rref; /* Reference to read */
const H5std_string write_comment="Foo!"; // Comments for group
// Output message about test being performed
@@ -398,102 +398,102 @@ test_reference_group(void)
H5File* file1 = NULL;
try {
- /*
- * Create file with a group and a dataset containing an object
- * reference to the group
- */
+ /*
+ * Create file with a group and a dataset containing an object
+ * reference to the group
+ */
// Create file FILE1
file1 = new H5File (FILE1, H5F_ACC_TRUNC);
- // Create scalar dataspace
- DataSpace sid1;
+ // Create scalar dataspace
+ DataSpace sid1;
- // Create a group
- Group group = file1->createGroup(GROUPNAME);
+ // Create a group
+ Group group = file1->createGroup(GROUPNAME);
- /* Create nested groups */
- Group group2 = group.createGroup(GROUPNAME2);
- group2.close();
- group2 = group.createGroup(GROUPNAME3);
- group2.close();
+ /* Create nested groups */
+ Group group2 = group.createGroup(GROUPNAME2);
+ group2.close();
+ group2 = group.createGroup(GROUPNAME3);
+ group2.close();
- // Create bottom dataset
- DataSet dset1 = group.createDataSet(DSETNAME2, PredType::NATIVE_INT, sid1);
- dset1.close();
+ // Create bottom dataset
+ DataSet dset1 = group.createDataSet(DSETNAME2, PredType::NATIVE_INT, sid1);
+ dset1.close();
- // Close group 1
- group.close();
+ // Close group 1
+ group.close();
- // Create dataset
- DataSet dset2 = file1->createDataSet(DSETNAME, PredType::STD_REF_OBJ, sid1);
+ // Create dataset
+ DataSet dset2 = file1->createDataSet(DSETNAME, PredType::STD_REF_OBJ, sid1);
- file1->reference(&wref, GROUPNAME);
+ file1->reference(&wref, GROUPNAME);
- // Write selection to disk
- dset2.write(&wref, PredType::STD_REF_OBJ);
+ // Write selection to disk
+ dset2.write(&wref, PredType::STD_REF_OBJ);
- // Close resources
- dset2.close();
- sid1.close();
- file1->close();
+ // Close resources
+ dset2.close();
+ sid1.close();
+ file1->close();
- /*
- * Re-open the file and test deferencing group
- */
+ /*
+ * Re-open the file and test deferencing group
+ */
- // Re-open file
+ // Re-open file
file1->openFile(FILE1, H5F_ACC_RDWR);
- // Re-open dataset
- dset1 = file1->openDataSet(DSETNAME);
+ // Re-open dataset
+ dset1 = file1->openDataSet(DSETNAME);
- // Read in the reference
- dset1.read(&rref, PredType::STD_REF_OBJ);
+ // Read in the reference
+ dset1.read(&rref, PredType::STD_REF_OBJ);
- // Dereference to get the group
- Group refgroup(dset1, &rref);
+ // Dereference to get the group
+ Group refgroup(dset1, &rref);
- // Dereference group object the other way
- group.dereference(dset1, &rref);
+ // Dereference group object the other way
+ group.dereference(dset1, &rref);
- /*
- * Various queries on the group opened
- */
+ /*
+ * Various queries on the group opened
+ */
- // Check number of objects in the group dereferenced by constructor
- hsize_t nobjs = refgroup.getNumObjs();
- verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs",__LINE__,__FILE__);
+ // Check number of objects in the group dereferenced by constructor
+ hsize_t nobjs = refgroup.getNumObjs();
+ verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs",__LINE__,__FILE__);
- // Check number of objects in the group dereferenced by ::reference
- nobjs = group.getNumObjs();
- verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs",__LINE__,__FILE__);
+ // Check number of objects in the group dereferenced by ::reference
+ nobjs = group.getNumObjs();
+ verify_val(nobjs, (hsize_t)3, "H5Group::getNumObjs",__LINE__,__FILE__);
- // Check getting file name given the group dereferenced via constructor
- H5std_string fname = refgroup.getFileName();
- verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__);
+ // Check getting file name given the group dereferenced via constructor
+ H5std_string fname = refgroup.getFileName();
+ verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__);
- // Check getting file name given the group dereferenced by ::reference
- fname = group.getFileName();
- verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__);
-
- // Unlink one of the objects in the dereferenced group, and re-check
- refgroup.unlink(GROUPNAME2);
- nobjs = refgroup.getNumObjs();
- verify_val(nobjs, (hsize_t)2, "H5Group::getNumObjs",__LINE__,__FILE__);
-
- // Close resources
- group.close();
- refgroup.close();
- dset1.close();
- file1->close();
-
- PASSED();
+ // Check getting file name given the group dereferenced by ::reference
+ fname = group.getFileName();
+ verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__);
+
+ // Unlink one of the objects in the dereferenced group, and re-check
+ refgroup.unlink(GROUPNAME2);
+ nobjs = refgroup.getNumObjs();
+ verify_val(nobjs, (hsize_t)2, "H5Group::getNumObjs",__LINE__,__FILE__);
+
+ // Close resources
+ group.close();
+ refgroup.close();
+ dset1.close();
+ file1->close();
+
+ PASSED();
} // end try
catch (Exception& E)
{
- issue_fail_msg("test_reference_group()",__LINE__,__FILE__,
- E.getCFuncName(), E.getCDetailMsg());
+ issue_fail_msg("test_reference_group()",__LINE__,__FILE__,
+ E.getCFuncName(), E.getCDetailMsg());
}
if(file1)
@@ -509,283 +509,283 @@ test_reference_group(void)
static void
test_reference_region_1D(void)
{
- hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
hsize_t * coords; /* Coordinate buffer */
- hsize_t low[SPACE3_RANK]; /* Selection bounds */
- hsize_t high[SPACE3_RANK]; /* Selection bounds */
+ hsize_t low[SPACE3_RANK]; /* Selection bounds */
+ hsize_t high[SPACE3_RANK]; /* Selection bounds */
int i; /* counting variables */
// Output message about test being performed
SUBTEST("1-D Dataset Region Reference Functions");
try {
- hdset_reg_ref_t *wbuf, // buffer to write to disk
- *rbuf; // buffer read from disk
- uint8_t *dwbuf, // Buffer for writing numeric data to disk
- *drbuf; // Buffer for reading numeric data from disk
+ hdset_reg_ref_t *wbuf, // buffer to write to disk
+ *rbuf; // buffer read from disk
+ uint8_t *dwbuf, // Buffer for writing numeric data to disk
+ *drbuf; // Buffer for reading numeric data from disk
- // Allocate write & read buffers
- wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
- rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
- dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
- drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
+ // Allocate write & read buffers
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
+ drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
// Create file FILE1
H5File file1(FILE2, H5F_ACC_TRUNC);
- // Create dataspace for datasets
- hsize_t dims3[] = {SPACE3_DIM1};
- DataSpace sid3(SPACE3_RANK, dims3);
+ // Create dataspace for datasets
+ hsize_t dims3[] = {SPACE3_DIM1};
+ DataSpace sid3(SPACE3_RANK, dims3);
- // Create dataset access property list
- PropList dapl(H5P_DATASET_ACCESS);
+ // Create dataset access property list
+ PropList dapl(H5P_DATASET_ACCESS);
- // Create a dataset
- DataSet dset3 = file1.createDataSet(DSET2_NAME, PredType::STD_U8LE, sid3);
+ // Create a dataset
+ DataSet dset3 = file1.createDataSet(DSET2_NAME, PredType::STD_U8LE, sid3);
- uint8_t *tu8; // Temporary pointer to uint8 data
- for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
- *tu8++ = i * 3; // from C test
+ uint8_t *tu8; // Temporary pointer to uint8 data
+ for (tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
+ *tu8++ = i * 3; // from C test
- // Write selection to disk
- dset3.write(dwbuf, PredType::STD_U8LE);
+ // Write selection to disk
+ dset3.write(dwbuf, PredType::STD_U8LE);
- // Close Dataset
- dset3.close();
+ // Close Dataset
+ dset3.close();
- // Create dataspace for datasets
- hsize_t dims1[] = {SPACE1_DIM1};
- DataSpace sid1(SPACE1_RANK, dims1);
+ // Create dataspace for datasets
+ hsize_t dims1[] = {SPACE1_DIM1};
+ DataSpace sid1(SPACE1_RANK, dims1);
- // Create a dataset
- DataSet dset1 = file1.createDataSet(DSET1_NAME, PredType::STD_REF_DSETREG, sid1);
+ // Create a dataset
+ DataSet dset1 = file1.createDataSet(DSET1_NAME, PredType::STD_REF_DSETREG, sid1);
- /*
- * Create references and prepare for testing
- */
+ /*
+ * Create references and prepare for testing
+ */
- /* Select 15 2x1 hyperslabs for first reference */
- start[0] = 2;
- stride[0] = 5;
- count[0] = 15;
- block[0] = 2;
+ /* Select 15 2x1 hyperslabs for first reference */
+ start[0] = 2;
+ stride[0] = 5;
+ count[0] = 15;
+ block[0] = 2;
- // Select a hyperslab region to add to the current selected region
- sid3.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
+ // Select a hyperslab region to add to the current selected region
+ sid3.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
- // Get and verify the number of elements in a dataspace selection
- hssize_t nelms = sid3.getSelectNpoints();
- verify_val(nelms, 30, "DataSet::getRefObjType",__LINE__,__FILE__);
+ // Get and verify the number of elements in a dataspace selection
+ hssize_t nelms = sid3.getSelectNpoints();
+ verify_val(nelms, 30, "DataSet::getRefObjType",__LINE__,__FILE__);
- // Store first dataset region
- file1.reference(&wbuf[0], "/Dataset2", sid3);
+ // Store first dataset region
+ file1.reference(&wbuf[0], "/Dataset2", sid3);
- // Get and verify object type
- H5O_type_t obj_type = dset1.getRefObjType(&wbuf[0], H5R_DATASET_REGION);
- verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
+ // Get and verify object type
+ H5O_type_t obj_type = dset1.getRefObjType(&wbuf[0], H5R_DATASET_REGION);
+ verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
- /* Select sequence of ten points for second reference */
- coord1[0][0] = 16;
- coord1[1][0] = 22;
- coord1[2][0] = 38;
- coord1[3][0] = 41;
- coord1[4][0] = 52;
- coord1[5][0] = 63;
- coord1[6][0] = 70;
- coord1[7][0] = 89;
- coord1[8][0] = 97;
- coord1[9][0] = 3;
-
- // Selects array elements to be included in the selection for sid3
- sid3.selectElements(H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
-
- // Get and verify the number of elements in a dataspace selection
- nelms = sid3.getSelectNpoints();
- verify_val(nelms, 10, "DataSet::getRefObjType",__LINE__,__FILE__);
-
- // Store first dataset region
- file1.reference(&wbuf[1], "/Dataset2", sid3);
-
- // Write selection to disk
- dset1.write(wbuf, PredType::STD_REF_DSETREG);
-
- // Close disk dataspace, dataset, and file
- sid1.close();
- dset1.close();
- sid3.close();
- file1.close();
-
- /*
- * Testing various dereference functions
- */
-
- // Re-open the file
- file1.openFile(FILE2, H5F_ACC_RDWR);
-
- // Open the dataset
- dset1 = file1.openDataSet("/Dataset1");
-
- // Read selection from disk
- dset1.read(rbuf, PredType::STD_REF_DSETREG);
-
- { // Test DataSet::dereference
- dset3.dereference(dset1, &rbuf[0], H5R_DATASET_REGION, dapl);
-
- // Get and verify object type
- obj_type = dset1.getRefObjType(&rbuf[0], H5R_DATASET_REGION);
- verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
-
- // Get dataspace of dset3 the verify number of elements
- sid1 = dset3.getSpace();
- nelms = sid1.getSimpleExtentNpoints();
- verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
- } // End of test DataSet::dereference
-
- { // Test DataSet constructor -by dereference
- // Dereference dataset object by ctor, from the location where
- // 'dset1' is located
- DataSet newds(dset1, &rbuf[0], H5R_DATASET_REGION, dapl);
-
- // Get dataspace of newds then verify number of elements
- sid1 = newds.getSpace();
- nelms = sid1.getSimpleExtentNpoints();
- verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
-
- // Close objects for this mini test
- newds.close();
- sid1.close();
- } // End of test DataSet constructor -by dereference
-
- // Read from disk
- dset3.read(drbuf, PredType::STD_U8LE);
-
- for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
- verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
-
- /*
- * Test getting the referenced region
- */
-
- // Get region
- DataSpace reg_sp = dset1.getRegion(&rbuf[0]);
-
- // Get and verify number of elements in a dataspace selection
- nelms = reg_sp.getSelectNpoints();
- verify_val((long)nelms, 30, "DataSpace::getSelectNpoints",__LINE__,__FILE__);
-
- // Get and verify number of hyperslab blocks
- nelms = reg_sp.getSelectHyperNblocks();
- verify_val((long)nelms, 15, "DataSpace::getSelectNpoints",__LINE__,__FILE__);
-
- /* Allocate space for the hyperslab blocks */
- coords = (hsize_t *)HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2);
-
- // Get the list of hyperslab blocks currently selected
- reg_sp.getSelectHyperBlocklist((hsize_t)0, (hsize_t)nelms, coords);
-
- // Verify values in the list
- verify_val(coords[0], (hsize_t)2, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[1], (hsize_t)3, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[2], (hsize_t)7, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[3], (hsize_t)8, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[4],(hsize_t)12, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[5],(hsize_t)13, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[6],(hsize_t)17, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[7],(hsize_t)18, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[8],(hsize_t)22, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[9],(hsize_t)23, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[10],(hsize_t)27, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[11],(hsize_t)28, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[12],(hsize_t)32, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[13],(hsize_t)33, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[14],(hsize_t)37, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[15],(hsize_t)38, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[16],(hsize_t)42, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[17],(hsize_t)43, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[18],(hsize_t)47, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[19],(hsize_t)48, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[20],(hsize_t)52, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[21],(hsize_t)53, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[22],(hsize_t)57, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[23],(hsize_t)58, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[24],(hsize_t)62, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[25],(hsize_t)63, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[26],(hsize_t)67, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[27],(hsize_t)68, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[28],(hsize_t)72, "Hyperslab Coordinates",__LINE__,__FILE__);
- verify_val(coords[29],(hsize_t)73, "Hyperslab Coordinates",__LINE__,__FILE__);
-
- HDfree(coords);
-
- // Check boundaries
- reg_sp.getSelectBounds(low, high);
- verify_val(low[0],(hsize_t)2, "DataSpace::getSelectBounds",__LINE__,__FILE__);
- verify_val(high[0],(hsize_t)73, "DataSpace::getSelectBounds",__LINE__,__FILE__);
-
- /* Close region space */
- reg_sp.close();
-
- /*
- * Another test on getting the referenced region
- */
-
- // Get region
- DataSpace elm_sp = dset1.getRegion(&rbuf[1]);
-
- // Get and verify number of element points in the current selection
- hssize_t nelmspts = elm_sp.getSelectElemNpoints();
- verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints",__LINE__,__FILE__);
-
- /* Allocate space for the hyperslab blocks */
- coords = (hsize_t *)HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t));
-
- // Get the list of element points currently selected
- elm_sp.getSelectElemPointlist((hsize_t)0, (hsize_t)nelmspts, coords);
-
- // Verify points
- verify_val(coords[0], coord1[0][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[1], coord1[1][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[2], coord1[2][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[3], coord1[3][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[4], coord1[4][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[5], coord1[5][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[6], coord1[6][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[7], coord1[7][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[8], coord1[8][0], "Element Coordinates",__LINE__,__FILE__);
- verify_val(coords[9], coord1[9][0], "Element Coordinates",__LINE__,__FILE__);
-
- HDfree(coords);
-
- // Check boundaries
- elm_sp.getSelectBounds(low, high);
- verify_val(low[0],(hsize_t)3, "DataSpace::getSelectBounds",__LINE__,__FILE__);
- verify_val(high[0],(hsize_t)97, "DataSpace::getSelectBounds",__LINE__,__FILE__);
-
- // Close element space
- elm_sp.close();
-
- // Close resources
- sid1.close();
- dset3.close();
- dset1.close();
- file1.close();
-
- // Free memory buffers
- HDfree(wbuf);
- HDfree(rbuf);
- HDfree(dwbuf);
- HDfree(drbuf);
-
- PASSED();
+ /* Select sequence of ten points for second reference */
+ coord1[0][0] = 16;
+ coord1[1][0] = 22;
+ coord1[2][0] = 38;
+ coord1[3][0] = 41;
+ coord1[4][0] = 52;
+ coord1[5][0] = 63;
+ coord1[6][0] = 70;
+ coord1[7][0] = 89;
+ coord1[8][0] = 97;
+ coord1[9][0] = 3;
+
+ // Selects array elements to be included in the selection for sid3
+ sid3.selectElements(H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+
+ // Get and verify the number of elements in a dataspace selection
+ nelms = sid3.getSelectNpoints();
+ verify_val(nelms, 10, "DataSet::getRefObjType",__LINE__,__FILE__);
+
+ // Store first dataset region
+ file1.reference(&wbuf[1], "/Dataset2", sid3);
+
+ // Write selection to disk
+ dset1.write(wbuf, PredType::STD_REF_DSETREG);
+
+ // Close disk dataspace, dataset, and file
+ sid1.close();
+ dset1.close();
+ sid3.close();
+ file1.close();
+
+ /*
+ * Testing various dereference functions
+ */
+
+ // Re-open the file
+ file1.openFile(FILE2, H5F_ACC_RDWR);
+
+ // Open the dataset
+ dset1 = file1.openDataSet("/Dataset1");
+
+ // Read selection from disk
+ dset1.read(rbuf, PredType::STD_REF_DSETREG);
+
+ { // Test DataSet::dereference
+ dset3.dereference(dset1, &rbuf[0], H5R_DATASET_REGION, dapl);
+
+ // Get and verify object type
+ obj_type = dset1.getRefObjType(&rbuf[0], H5R_DATASET_REGION);
+ verify_val(obj_type, H5O_TYPE_DATASET, "DataSet::getRefObjType",__LINE__,__FILE__);
+
+ // Get dataspace of dset3 the verify number of elements
+ sid1 = dset3.getSpace();
+ nelms = sid1.getSimpleExtentNpoints();
+ verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
+ } // End of test DataSet::dereference
+
+ { // Test DataSet constructor -by dereference
+ // Dereference dataset object by ctor, from the location where
+ // 'dset1' is located
+ DataSet newds(dset1, &rbuf[0], H5R_DATASET_REGION, dapl);
+
+ // Get dataspace of newds then verify number of elements
+ sid1 = newds.getSpace();
+ nelms = sid1.getSimpleExtentNpoints();
+ verify_val((long)nelms, 100, "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
+
+ // Close objects for this mini test
+ newds.close();
+ sid1.close();
+ } // End of test DataSet constructor -by dereference
+
+ // Read from disk
+ dset3.read(drbuf, PredType::STD_U8LE);
+
+ for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
+ verify_val(*tu8, (uint8_t)(i * 3), "DataSpace::getSimpleExtentNpoints",__LINE__,__FILE__);
+
+ /*
+ * Test getting the referenced region
+ */
+
+ // Get region
+ DataSpace reg_sp = dset1.getRegion(&rbuf[0]);
+
+ // Get and verify number of elements in a dataspace selection
+ nelms = reg_sp.getSelectNpoints();
+ verify_val((long)nelms, 30, "DataSpace::getSelectNpoints",__LINE__,__FILE__);
+
+ // Get and verify number of hyperslab blocks
+ nelms = reg_sp.getSelectHyperNblocks();
+ verify_val((long)nelms, 15, "DataSpace::getSelectNpoints",__LINE__,__FILE__);
+
+ /* Allocate space for the hyperslab blocks */
+ coords = (hsize_t *)HDmalloc(nelms * SPACE3_RANK * sizeof(hsize_t) * 2);
+
+ // Get the list of hyperslab blocks currently selected
+ reg_sp.getSelectHyperBlocklist((hsize_t)0, (hsize_t)nelms, coords);
+
+ // Verify values in the list
+ verify_val(coords[0], (hsize_t)2, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[1], (hsize_t)3, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[2], (hsize_t)7, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[3], (hsize_t)8, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[4],(hsize_t)12, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[5],(hsize_t)13, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[6],(hsize_t)17, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[7],(hsize_t)18, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[8],(hsize_t)22, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[9],(hsize_t)23, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[10],(hsize_t)27, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[11],(hsize_t)28, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[12],(hsize_t)32, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[13],(hsize_t)33, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[14],(hsize_t)37, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[15],(hsize_t)38, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[16],(hsize_t)42, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[17],(hsize_t)43, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[18],(hsize_t)47, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[19],(hsize_t)48, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[20],(hsize_t)52, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[21],(hsize_t)53, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[22],(hsize_t)57, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[23],(hsize_t)58, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[24],(hsize_t)62, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[25],(hsize_t)63, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[26],(hsize_t)67, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[27],(hsize_t)68, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[28],(hsize_t)72, "Hyperslab Coordinates",__LINE__,__FILE__);
+ verify_val(coords[29],(hsize_t)73, "Hyperslab Coordinates",__LINE__,__FILE__);
+
+ HDfree(coords);
+
+ // Check boundaries
+ reg_sp.getSelectBounds(low, high);
+ verify_val(low[0],(hsize_t)2, "DataSpace::getSelectBounds",__LINE__,__FILE__);
+ verify_val(high[0],(hsize_t)73, "DataSpace::getSelectBounds",__LINE__,__FILE__);
+
+ /* Close region space */
+ reg_sp.close();
+
+ /*
+ * Another test on getting the referenced region
+ */
+
+ // Get region
+ DataSpace elm_sp = dset1.getRegion(&rbuf[1]);
+
+ // Get and verify number of element points in the current selection
+ hssize_t nelmspts = elm_sp.getSelectElemNpoints();
+ verify_val((long)nelmspts, 10, "DataSpace::getSelectNpoints",__LINE__,__FILE__);
+
+ /* Allocate space for the hyperslab blocks */
+ coords = (hsize_t *)HDmalloc(nelmspts * SPACE3_RANK * sizeof(hsize_t));
+
+ // Get the list of element points currently selected
+ elm_sp.getSelectElemPointlist((hsize_t)0, (hsize_t)nelmspts, coords);
+
+ // Verify points
+ verify_val(coords[0], coord1[0][0], "Element Coordinates",__LINE__,__FILE__);
+ verify_val(coords[1], coord1[1][0], "Element Coordinates",__LINE__,__FILE__);
+ verify_val(coords[2], coord1[2][0], "Element Coordinates",__LINE__,__FILE__);
+ verify_val(coords[3], coord1[3][0], "Element Coordinates",__LINE__,__FILE__);
+ verify_val(coords[4], coord1[4][0], "Element Coordinates",__LINE__,__FILE__);
+ verify_val(coords[5], coord1[5][0], "Element Coordinates",__LINE__,__FILE__);
+ verify_val(coords[6], coord1[6][0], "Element Coordinates",__LINE__,__FILE__);
+ verify_val(coords[7], coord1[7][0], "Element Coordinates",__LINE__,__FILE__);
+ verify_val(coords[8], coord1[8][0], "Element Coordinates",__LINE__,__FILE__);
+ verify_val(coords[9], coord1[9][0], "Element Coordinates",__LINE__,__FILE__);
+
+ HDfree(coords);
+
+ // Check boundaries
+ elm_sp.getSelectBounds(low, high);
+ verify_val(low[0],(hsize_t)3, "DataSpace::getSelectBounds",__LINE__,__FILE__);
+ verify_val(high[0],(hsize_t)97, "DataSpace::getSelectBounds",__LINE__,__FILE__);
+
+ // Close element space
+ elm_sp.close();
+
+ // Close resources
+ sid1.close();
+ dset3.close();
+ dset1.close();
+ file1.close();
+
+ // Free memory buffers
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(dwbuf);
+ HDfree(drbuf);
+
+ PASSED();
} // end try
catch (Exception& E)
{
- issue_fail_msg("test_reference_region_1D()",__LINE__,__FILE__,
- E.getCFuncName(), E.getCDetailMsg());
+ issue_fail_msg("test_reference_region_1D()",__LINE__,__FILE__,
+ E.getCFuncName(), E.getCDetailMsg());
}
} /* test_reference_region_1D() */
@@ -823,9 +823,9 @@ void test_reference(void)
/****************************************************************
-** Function: cleanup_reference
-** Purpose: Cleanup temporary test files
-** Return: none
+** Function: cleanup_reference
+** Purpose Cleanup temporary test files
+** Return none
****************************************************************/
extern "C"
void cleanup_reference(void)
diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp
index 6605c03..0cc8918 100644
--- a/c++/test/ttypes.cpp
+++ b/c++/test/ttypes.cpp
@@ -37,7 +37,7 @@ using namespace H5;
* Offset from alinged memory returned by malloc(). This can be used to test
* that type conversions handle non-aligned buffers correctly.
*/
-#define ALIGNMENT 1
+#define ALIGNMENT 1
/*
* Define if you want to test alignment code on a machine that doesn't
@@ -70,7 +70,7 @@ const char *FILENAME[] = {
* endian. If local variable `endian' is H5T_ORDER_BE then the result will
* be I, otherwise the result will be Z-(I+1).
*/
-#define ENDIAN(Z,I) (H5T_ORDER_BE==endian?(I):(Z)-((I)+1))
+#define ENDIAN(Z,I) (H5T_ORDER_BE==endian?(I):(Z)-((I)+1))
typedef enum flt_t {
@@ -86,12 +86,12 @@ typedef enum int_t {
/*-------------------------------------------------------------------------
* Function: test_classes
*
- * Purpose: Test type classes
+ * Purpose Test type classes
*
- * Return: None.
+ * Return None.
*
- * Programmer: Binh-Minh Ribler (using C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (using C version)
+ * January, 2007
*
* Modifications:
*
@@ -101,38 +101,38 @@ static void test_classes()
{
SUBTEST("PredType::getClass()");
try {
- // maybe later, int curr_nerrors = GetTestNumErrs();
-
- // PredType::NATIVE_INT should be in H5T_INTEGER class
- H5T_class_t tcls = PredType::NATIVE_INT.getClass();
- if (H5T_INTEGER!=tcls) {
- puts(" Invalid type class for H5T_NATIVE_INT");
- }
-
- // PredType::NATIVE_DOUBLE should be in H5T_FLOAT class
- tcls = PredType::NATIVE_DOUBLE.getClass();
- if (H5T_FLOAT!=tcls) {
- verify_val(tcls, H5T_FLOAT, "test_class: invalid type class for NATIVE_DOUBLE -", __LINE__, __FILE__);
- }
- PASSED();
+ // maybe later, int curr_nerrors = GetTestNumErrs();
+
+ // PredType::NATIVE_INT should be in H5T_INTEGER class
+ H5T_class_t tcls = PredType::NATIVE_INT.getClass();
+ if (H5T_INTEGER!=tcls) {
+ puts(" Invalid type class for H5T_NATIVE_INT");
+ }
+
+ // PredType::NATIVE_DOUBLE should be in H5T_FLOAT class
+ tcls = PredType::NATIVE_DOUBLE.getClass();
+ if (H5T_FLOAT!=tcls) {
+ verify_val(tcls, H5T_FLOAT, "test_class: invalid type class for NATIVE_DOUBLE -", __LINE__, __FILE__);
+ }
+ PASSED();
} // end of try block
catch (Exception& E)
{
- issue_fail_msg("test_classes", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_classes", __LINE__, __FILE__, E.getCDetailMsg());
}
}
/*-------------------------------------------------------------------------
* Function: test_copy
*
- * Purpose: Test datatype copy functionality
+ * Purpose Test datatype copy functionality
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Binh-Minh Ribler (using C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (using C version)
+ * January, 2007
*
* Modifications:
*
@@ -143,21 +143,21 @@ static void test_copy()
SUBTEST("DataType::copy() and DataType::operator=");
try {
- // Test copying from a predefined datatype using DataType::operator=
- DataType assigned_type;
- assigned_type = PredType::NATIVE_SHORT;
+ // Test copying from a predefined datatype using DataType::operator=
+ DataType assigned_type;
+ assigned_type = PredType::NATIVE_SHORT;
// Test copying a predefined type using DataType::copy
- DataType copied_type;
+ DataType copied_type;
copied_type.copy (PredType::STD_B8LE);
- // Test copying a user-defined type using DataType::operator=
- DataType assigned_usertype;
- assigned_usertype = copied_type;
+ // Test copying a user-defined type using DataType::operator=
+ DataType assigned_usertype;
+ assigned_usertype = copied_type;
- // Test copying from a user-defined datatype using DataType::copy
- DataType copied_usertype;
- copied_usertype.copy(copied_type);
+ // Test copying from a user-defined datatype using DataType::copy
+ DataType copied_usertype;
+ copied_usertype.copy(copied_type);
// Test copying a user-defined int type using DataType::operator=
IntType orig_int(PredType::STD_B8LE);
@@ -171,26 +171,26 @@ static void test_copy()
IntType another_int_type;
another_int_type = new_int_type;
- PASSED();
+ PASSED();
}
catch (Exception& E)
{
- issue_fail_msg("test_copy", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_copy", __LINE__, __FILE__, E.getCDetailMsg());
}
}
/*-------------------------------------------------------------------------
- * Function: test_query
+ * Function: test_query
*
- * Purpose: Tests query functions of compound and enumeration types.
+ * Purpose Tests query functions of compound and enumeration types.
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Binh-Minh Ribler (use C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (use C version)
+ * January, 2007
*
* Modifications:
*
@@ -203,113 +203,113 @@ const H5std_string EnumT_NAME("Enum_type");
static void test_query()
{
typedef struct {
- int a;
- float b;
- long c;
- double d;
+ int a;
+ float b;
+ long c;
+ double d;
} src_typ_t;
- short enum_val;
+ short enum_val;
// Output message about test being performed
SUBTEST("Query functions of compound and enumeration types");
try
{
- // Create File
- H5File file(FILENAME[2], H5F_ACC_TRUNC);
-
- // Create a compound datatype
- CompType tid1(sizeof(src_typ_t));
-
- tid1.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT);
- tid1.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_FLOAT);
- tid1.insertMember("c", HOFFSET(src_typ_t, c), PredType::NATIVE_LONG);
- tid1.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_DOUBLE);
-
- // Create a enumerate datatype
- EnumType tid2(sizeof(short));
-
- tid2.insert("RED", (enum_val=0,&enum_val));
- tid2.insert("GREEN", (enum_val=1,&enum_val));
- tid2.insert("BLUE", (enum_val=2,&enum_val));
- tid2.insert("ORANGE", (enum_val=3,&enum_val));
- tid2.insert("YELLOW", (enum_val=4,&enum_val));
-
- // Query member number and member index by name, for compound type
- int nmembs = tid1.getNmembers();
- verify_val(nmembs, 4, "CompType::getNmembers()", __LINE__, __FILE__);
-
- int index = tid1.getMemberIndex("c");
- verify_val(index, 2, "CompType::getMemberIndex()", __LINE__, __FILE__);
-
- // Query member number and member index by name, for enumeration type.
- nmembs = tid2.getNmembers();
- verify_val(nmembs, 5, "EnumType::getNmembers()", __LINE__, __FILE__);
-
- index = tid2.getMemberIndex("ORANGE");
- verify_val(index, 3, "EnumType::getMemberIndex()", __LINE__, __FILE__);
-
- // Commit compound datatype and close it
- tid1.commit(file, CompT_NAME);
- tid1.close();
-
- // Commit enumeration datatype and close it
- tid2.commit(file, EnumT_NAME);
- tid2.close();
-
- // Open the datatypes for query
-
- // Deprecated functions
- tid1 = file.openCompType(CompT_NAME);
- tid1.close();
- tid2 = file.openEnumType(EnumT_NAME);
- tid2.close();
-
- CompType comptype(file, CompT_NAME);
- EnumType enumtype(file, EnumT_NAME);
-
- // Query member number and member index by name, for compound type
- nmembs = comptype.getNmembers();
- verify_val(nmembs, 4, "CompType::getNmembers()", __LINE__, __FILE__);
- index = comptype.getMemberIndex("c");
- verify_val(index, 2, "CompType::getMemberIndex()", __LINE__, __FILE__);
-
- // Query member number and member index by name, for enumeration type
- nmembs = enumtype.getNmembers();
- verify_val(nmembs, 5, "EnumType::getNmembers()", __LINE__, __FILE__);
- index = enumtype.getMemberIndex("ORANGE");
- verify_val(index, 3, "EnumType::getMemberIndex()", __LINE__, __FILE__);
-
- // Close datatypes and file
- comptype.close();
- enumtype.close();
- file.close();
-
- // Try truncating the file to make sure reference counting is good.
- // If any references to ids of the accessed types are left unterminated,
- // the truncating will fail, because the file will not be closed in
- // the file.close() above.
- H5File file1(FILENAME[2], H5F_ACC_TRUNC);
-
- PASSED();
+ // Create File
+ H5File file(FILENAME[2], H5F_ACC_TRUNC);
+
+ // Create a compound datatype
+ CompType tid1(sizeof(src_typ_t));
+
+ tid1.insertMember("a", HOFFSET(src_typ_t, a), PredType::NATIVE_INT);
+ tid1.insertMember("b", HOFFSET(src_typ_t, b), PredType::NATIVE_FLOAT);
+ tid1.insertMember("c", HOFFSET(src_typ_t, c), PredType::NATIVE_LONG);
+ tid1.insertMember("d", HOFFSET(src_typ_t, d), PredType::NATIVE_DOUBLE);
+
+ // Create a enumerate datatype
+ EnumType tid2(sizeof(short));
+
+ tid2.insert("RED", (enum_val=0,&enum_val));
+ tid2.insert("GREEN", (enum_val=1,&enum_val));
+ tid2.insert("BLUE", (enum_val=2,&enum_val));
+ tid2.insert("ORANGE", (enum_val=3,&enum_val));
+ tid2.insert("YELLOW", (enum_val=4,&enum_val));
+
+ // Query member number and member index by name, for compound type
+ int nmembs = tid1.getNmembers();
+ verify_val(nmembs, 4, "CompType::getNmembers()", __LINE__, __FILE__);
+
+ int index = tid1.getMemberIndex("c");
+ verify_val(index, 2, "CompType::getMemberIndex()", __LINE__, __FILE__);
+
+ // Query member number and member index by name, for enumeration type.
+ nmembs = tid2.getNmembers();
+ verify_val(nmembs, 5, "EnumType::getNmembers()", __LINE__, __FILE__);
+
+ index = tid2.getMemberIndex("ORANGE");
+ verify_val(index, 3, "EnumType::getMemberIndex()", __LINE__, __FILE__);
+
+ // Commit compound datatype and close it
+ tid1.commit(file, CompT_NAME);
+ tid1.close();
+
+ // Commit enumeration datatype and close it
+ tid2.commit(file, EnumT_NAME);
+ tid2.close();
+
+ // Open the datatypes for query
+
+ // Deprecated functions
+ tid1 = file.openCompType(CompT_NAME);
+ tid1.close();
+ tid2 = file.openEnumType(EnumT_NAME);
+ tid2.close();
+
+ CompType comptype(file, CompT_NAME);
+ EnumType enumtype(file, EnumT_NAME);
+
+ // Query member number and member index by name, for compound type
+ nmembs = comptype.getNmembers();
+ verify_val(nmembs, 4, "CompType::getNmembers()", __LINE__, __FILE__);
+ index = comptype.getMemberIndex("c");
+ verify_val(index, 2, "CompType::getMemberIndex()", __LINE__, __FILE__);
+
+ // Query member number and member index by name, for enumeration type
+ nmembs = enumtype.getNmembers();
+ verify_val(nmembs, 5, "EnumType::getNmembers()", __LINE__, __FILE__);
+ index = enumtype.getMemberIndex("ORANGE");
+ verify_val(index, 3, "EnumType::getMemberIndex()", __LINE__, __FILE__);
+
+ // Close datatypes and file
+ comptype.close();
+ enumtype.close();
+ file.close();
+
+ // Try truncating the file to make sure reference counting is good.
+ // If any references to ids of the accessed types are left unterminated,
+ // the truncating will fail, because the file will not be closed in
+ // the file.close() above.
+ H5File file1(FILENAME[2], H5F_ACC_TRUNC);
+
+ PASSED();
} // end of try block
catch (Exception& E)
{
- issue_fail_msg("test_query", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_query", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_query
/*-------------------------------------------------------------------------
- * Function: test_transient
+ * Function: test_transient
*
- * Purpose: Tests transient datatypes.
+ * Purpose Tests transient datatypes.
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Binh-Minh Ribler (use C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (use C version)
+ * January, 2007
*
* Modifications:
*
@@ -318,58 +318,58 @@ static void test_query()
const char* filename1 = "dtypes1.h5";
static void test_transient ()
{
- static hsize_t ds_size[2] = {10, 20};
+ static hsize_t ds_size[2] = {10, 20};
SUBTEST("Transient datatypes");
try {
- // Create the file and the dataspace.
- H5File file(filename1, H5F_ACC_TRUNC);
- DataSpace space(2, ds_size, ds_size);
-
- // Copying a predefined type results in a modifiable copy
- IntType type(PredType::NATIVE_INT);
- type.setPrecision(256);
-
- // It should not be possible to create an attribute for a transient type
- try {
- Attribute attr(type.createAttribute("attr1", PredType::NATIVE_INT, space));
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("H5Object::createAttribute", "Attempted to commit a predefined datatype.");
- } catch (AttributeIException& err) {} // do nothing, failure expected
-
- // Create a dataset from a transient datatype
- // type.close(); - put trace in H5Tclose to make sure it's closed
- type.copy(PredType::NATIVE_INT);
- DataSet dset(file.createDataSet("dset1", type, space));
-
- // The type returned from a dataset should not be modifiable
- IntType itype(dset);
- try {
- itype.setPrecision(256);
-
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("PredType::setPrecision", "Dataset datatypes should not be modifiable!");
- } catch (DataTypeIException& err) {}
- itype.close();
-
- // Get a copy of the dataset's datatype by applying DataType::copy()
- // to the dataset. The resulted datatype should be modifiable.
- itype.copy(dset);
- itype.setPrecision(256);
- itype.close();
-
- // Close the dataset and reopen it, testing that its type is still
- // read-only. (Note that a copy of it is modifiable.)
- dset.close();
- dset = file.openDataSet("dset1");
-
- // Close objects and file.
- dset.close();
- file.close();
- type.close();
- space.close();
- PASSED();
+ // Create the file and the dataspace.
+ H5File file(filename1, H5F_ACC_TRUNC);
+ DataSpace space(2, ds_size, ds_size);
+
+ // Copying a predefined type results in a modifiable copy
+ IntType type(PredType::NATIVE_INT);
+ type.setPrecision(256);
+
+ // It should not be possible to create an attribute for a transient type
+ try {
+ Attribute attr(type.createAttribute("attr1", PredType::NATIVE_INT, space));
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("H5Object::createAttribute", "Attempted to commit a predefined datatype.");
+ } catch (AttributeIException& err) {} // do nothing, failure expected
+
+ // Create a dataset from a transient datatype
+ // type.close(); - put trace in H5Tclose to make sure it's closed
+ type.copy(PredType::NATIVE_INT);
+ DataSet dset(file.createDataSet("dset1", type, space));
+
+ // The type returned from a dataset should not be modifiable
+ IntType itype(dset);
+ try {
+ itype.setPrecision(256);
+
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("PredType::setPrecision", "Dataset datatypes should not be modifiable!");
+ } catch (DataTypeIException& err) {}
+ itype.close();
+
+ // Get a copy of the dataset's datatype by applying DataType::copy()
+ // to the dataset. The resulted datatype should be modifiable.
+ itype.copy(dset);
+ itype.setPrecision(256);
+ itype.close();
+
+ // Close the dataset and reopen it, testing that its type is still
+ // read-only. (Note that a copy of it is modifiable.)
+ dset.close();
+ dset = file.openDataSet("dset1");
+
+ // Close objects and file.
+ dset.close();
+ file.close();
+ type.close();
+ space.close();
+ PASSED();
} // end of try block
catch (Exception& E)
{
@@ -379,16 +379,16 @@ static void test_transient ()
/*-------------------------------------------------------------------------
- * Function: test_named
+ * Function: test_named
*
- * Purpose: Tests named datatypes.
+ * Purpose Tests named datatypes.
*
- * Return: Success: 0
+ * Return Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Binh-Minh Ribler (use C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (use C version)
+ * January, 2007
*
* Modifications:
*
@@ -397,141 +397,141 @@ static void test_transient ()
const H5std_string filename2("dtypes2.h5");
static void test_named ()
{
- static hsize_t ds_size[2] = {10, 20};
- hsize_t i;
- unsigned attr_data[10][20];
- DataType *ds_type = NULL;
+ static hsize_t ds_size[2] = {10, 20};
+ hsize_t i;
+ unsigned attr_data[10][20];
+ DataType *ds_type = NULL;
SUBTEST("Named datatypes");
try {
- // Create the file.
- H5File file(filename2, H5F_ACC_TRUNC);
+ // Create the file.
+ H5File file(filename2, H5F_ACC_TRUNC);
- // Create a simple dataspace.
- DataSpace space(2, ds_size, ds_size);
+ // Create a simple dataspace.
+ DataSpace space(2, ds_size, ds_size);
- // Predefined types cannot be committed.
- try {
- PredType nativeint(PredType::NATIVE_INT);
- nativeint.commit(file, "test_named_1 (should not exist)");
+ // Predefined types cannot be committed.
+ try {
+ PredType nativeint(PredType::NATIVE_INT);
+ nativeint.commit(file, "test_named_1 (should not exist)");
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("PredType::commit", "Attempted to commit a predefined datatype.");
- } catch (DataTypeIException& err) {}
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("PredType::commit", "Attempted to commit a predefined datatype.");
+ } catch (DataTypeIException& err) {}
- // Copy a predefined datatype and commit the copy.
+ // Copy a predefined datatype and commit the copy.
IntType itype(PredType::NATIVE_INT);
itype.commit(file, "native-int");
- // Test commit passing in const H5File& for prototype with const
- try
- {
- // Create random char type
- IntType atype(PredType::NATIVE_UCHAR);
+ // Test commit passing in const H5File& for prototype with const
+ try
+ {
+ // Create random char type
+ IntType atype(PredType::NATIVE_UCHAR);
- // Creating group, declared as const
- const Group const_grp = file.createGroup("GR as loc");
+ // Creating group, declared as const
+ const Group const_grp = file.createGroup("GR as loc");
- // Commit type passing in const group; compilation would fail if
- // no matching prototype
- atype.commit(const_grp, "random uchar");
- } // end of try block
- catch (Exception& E)
+ // Commit type passing in const group; compilation would fail if
+ // no matching prototype
+ atype.commit(const_grp, "random uchar");
+ } // end of try block
+ catch (Exception& E)
{
- issue_fail_msg("test_named", __LINE__, __FILE__, "Commit at const group");
- }
-
- // Check that it is committed.
- if (itype.committed() == false)
- cerr << "IntType::committed() returned false" << endl;
-
- // We should not be able to modify a type after it has been committed.
- try {
- itype.setPrecision(256); // attempt an invalid action...
-
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("IntType::setPrecision", "Attempted to modify a committed datatype.");
- } catch (DataTypeIException& err) {}
-
- // We should not be able to re-commit a committed type
- try {
- itype.commit(file, "test_named_2 (should not exist)");
-
- // Should FAIL but didn't, so throw an invalid action exception
- throw InvalidActionException("IntType::commit", "Attempted to re-commit a committed datatype.");
- } catch (DataTypeIException& err) {} // do nothing, failure expected
-
- // It should be possible to define an attribute for the named type
- Attribute attr1 = itype.createAttribute("attr1", PredType::NATIVE_UCHAR, space);
- for (i=0; i<ds_size[0]*ds_size[1]; i++)
- attr_data[0][i] = (int)i;/*tricky*/
- attr1.write(PredType::NATIVE_UINT, attr_data);
- attr1.close();
-
- // Copying a committed type should result in a transient type which is
- // not locked.
- IntType trans_type;
- trans_type.copy(itype);
- bool iscommitted = trans_type.committed();
- verify_val(iscommitted, 0, "DataType::committed() - Copying a named type should result in a transient type!", __LINE__, __FILE__);
- trans_type.setPrecision(256);
- trans_type.close();
-
- // Close the committed type and reopen it. It should be a named type.
- itype.close();
- itype = file.openIntType("native-int");
- iscommitted = itype.committed();
- if (!iscommitted)
- throw InvalidActionException("IntType::committed()", "Opened named types should be named types!");
-
- // Create a dataset that uses the named type, then get the dataset's
- // datatype and make sure it's a named type.
- DataSet dset = file.createDataSet("dset1", itype, space);
- ds_type = new DataType(dset.getDataType());
- iscommitted = ds_type->committed();
- if (!iscommitted)
- throw InvalidActionException("IntType::committed()", "Dataset type should be named type!");
- dset.close();
- ds_type->close();
+ issue_fail_msg("test_named", __LINE__, __FILE__, "Commit at const group");
+ }
+
+ // Check that it is committed.
+ if (itype.committed() == false)
+ cerr << "IntType::committed() returned false" << endl;
+
+ // We should not be able to modify a type after it has been committed.
+ try {
+ itype.setPrecision(256); // attempt an invalid action...
+
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("IntType::setPrecision", "Attempted to modify a committed datatype.");
+ } catch (DataTypeIException& err) {}
+
+ // We should not be able to re-commit a committed type
+ try {
+ itype.commit(file, "test_named_2 (should not exist)");
+
+ // Should FAIL but didn't, so throw an invalid action exception
+ throw InvalidActionException("IntType::commit", "Attempted to re-commit a committed datatype.");
+ } catch (DataTypeIException& err) {} // do nothing, failure expected
+
+ // It should be possible to define an attribute for the named type
+ Attribute attr1 = itype.createAttribute("attr1", PredType::NATIVE_UCHAR, space);
+ for (i=0; i<ds_size[0]*ds_size[1]; i++)
+ attr_data[0][i] = (int)i;/*tricky*/
+ attr1.write(PredType::NATIVE_UINT, attr_data);
+ attr1.close();
+
+ // Copying a committed type should result in a transient type which is
+ // not locked.
+ IntType trans_type;
+ trans_type.copy(itype);
+ bool iscommitted = trans_type.committed();
+ verify_val(iscommitted, 0, "DataType::committed() - Copying a named type should result in a transient type!", __LINE__, __FILE__);
+ trans_type.setPrecision(256);
+ trans_type.close();
+
+ // Close the committed type and reopen it. It should be a named type.
+ itype.close();
+ itype = file.openIntType("native-int");
+ iscommitted = itype.committed();
+ if (!iscommitted)
+ throw InvalidActionException("IntType::committed()", "Opened named types should be named types!");
+
+ // Create a dataset that uses the named type, then get the dataset's
+ // datatype and make sure it's a named type.
+ DataSet dset = file.createDataSet("dset1", itype, space);
+ ds_type = new DataType(dset.getDataType());
+ iscommitted = ds_type->committed();
+ if (!iscommitted)
+ throw InvalidActionException("IntType::committed()", "Dataset type should be named type!");
+ dset.close();
+ ds_type->close();
delete ds_type;
- // Reopen the dataset and its type, then make sure the type is
- // a named type.
- dset = file.openDataSet("dset1");
- ds_type = new DataType(dset.getDataType());
- iscommitted = ds_type->committed();
- if (!iscommitted)
- throw InvalidActionException("IntType::committed()", "Dataset type should be named type!");
-
- // Close the dataset and create another with the type returned from
- // the first dataset.
- dset.close();
- dset = file.createDataSet("dset2", *ds_type, space);
- ds_type->close();
- dset.close();
+ // Reopen the dataset and its type, then make sure the type is
+ // a named type.
+ dset = file.openDataSet("dset1");
+ ds_type = new DataType(dset.getDataType());
+ iscommitted = ds_type->committed();
+ if (!iscommitted)
+ throw InvalidActionException("IntType::committed()", "Dataset type should be named type!");
+
+ // Close the dataset and create another with the type returned from
+ // the first dataset.
+ dset.close();
+ dset = file.createDataSet("dset2", *ds_type, space);
+ ds_type->close();
+ dset.close();
delete ds_type;
- // Reopen the second dataset and make sure the type is shared
- dset = file.openDataSet("dset2");
- ds_type = new DataType(dset.getDataType());
- iscommitted = ds_type->committed();
- if (!iscommitted)
- throw InvalidActionException("DataType::iscommitted()", "Dataset type should be named type!");
- ds_type->close();
-
- // Get the dataset datatype by applying DataType::copy() to the
- // dataset. The resulted datatype should be modifiable.
- IntType copied_type;
- copied_type.copy(dset);
- copied_type.setPrecision(256);
- copied_type.close();
-
- // Clean up
- dset.close();
- itype.close();
- space.close();
- file.close();
- PASSED();
+ // Reopen the second dataset and make sure the type is shared
+ dset = file.openDataSet("dset2");
+ ds_type = new DataType(dset.getDataType());
+ iscommitted = ds_type->committed();
+ if (!iscommitted)
+ throw InvalidActionException("DataType::iscommitted()", "Dataset type should be named type!");
+ ds_type->close();
+
+ // Get the dataset datatype by applying DataType::copy() to the
+ // dataset. The resulted datatype should be modifiable.
+ IntType copied_type;
+ copied_type.copy(dset);
+ copied_type.setPrecision(256);
+ copied_type.close();
+
+ // Clean up
+ dset.close();
+ itype.close();
+ space.close();
+ file.close();
+ PASSED();
} // end of try block
catch (Exception& E)
{
@@ -565,14 +565,14 @@ void test_types()
/*-------------------------------------------------------------------------
- * Function: cleanup_types
+ * Function: cleanup_types
*
- * Purpose: Cleanup temporary test files
+ * Purpose Cleanup temporary test files
*
- * Return: none
+ * Return none
*
- * Programmer: Quincey Koziol
- * September 10, 1999
+ * Programmer Quincey Koziol
+ * September 10, 1999
*
* Modifications:
*
@@ -582,5 +582,5 @@ extern "C"
void cleanup_types()
{
for (int i = 0; i < 3; i++)
- HDremove(FILENAME[i]);
+ HDremove(FILENAME[i]);
} // cleanup_types
diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp
index 43dcc0b..5dee1a2 100644
--- a/c++/test/tvlstr.cpp
+++ b/c++/test/tvlstr.cpp
@@ -45,9 +45,9 @@ const hsize_t SPACE1_DIM1 = 4;
/****************************************************************
**
** test_vlstr_alloc_custom(): Test VL datatype custom memory
-** allocation routines. This routine just uses malloc to
-** allocate the memory and increments the amount of memory
-** allocated. It is passed into setVlenMemManager.
+** allocation routines. This routine just uses malloc to
+** allocate the memory and increments the amount of memory
+** allocated. It is passed into setVlenMemManager.
**
** Note: exact copy from the C version.
** (Not used now)
@@ -55,9 +55,9 @@ const hsize_t SPACE1_DIM1 = 4;
#if 0 // not used now
static void *test_vlstr_alloc_custom(size_t size, void *info)
{
- void *ret_value=NULL; // Pointer to return
+ void *ret_value=NULL; // Pointer to return
size_t *mem_used=(size_t *)info; // Get the pointer to the memory used
- size_t extra; // Extra space needed
+ size_t extra; // Extra space needed
/*
* This weird contortion is required on the DEC Alpha to keep the
@@ -67,8 +67,8 @@ static void *test_vlstr_alloc_custom(size_t size, void *info)
extra=MAX(sizeof(void *),sizeof(size_t));
if((ret_value=HDmalloc(extra+size))!=NULL) {
- *(size_t *)ret_value=size;
- *mem_used+=size;
+ *(size_t *)ret_value=size;
+ *mem_used+=size;
} // end if
ret_value = ((unsigned char *)ret_value) + extra;
@@ -79,9 +79,9 @@ static void *test_vlstr_alloc_custom(size_t size, void *info)
/****************************************************************
**
** test_vlstr_free_custom(): Test VL datatype custom memory
-** allocation routines. This routine just uses free to
-** release the memory and decrements the amount of memory
-** allocated. It is passed into setVlenMemManager.
+** allocation routines. This routine just uses free to
+** release the memory and decrements the amount of memory
+** allocated. It is passed into setVlenMemManager.
**
** Note: exact copy from the C version.
** (Not used now)
@@ -91,7 +91,7 @@ static void test_vlstr_free_custom(void *_mem, void *info)
{
unsigned char *mem;
size_t *mem_used=(size_t *)info; // Get the pointer to the memory used
- size_t extra; // Extra space needed
+ size_t extra; // Extra space needed
/*
* This weird contortion is required on the DEC Alpha to keep the
@@ -109,14 +109,14 @@ static void test_vlstr_free_custom(void *_mem, void *info)
#endif
/*-------------------------------------------------------------------------
- * Function: test_vlstring_dataset
+ * Function: test_vlstring_dataset
*
- * Purpose: Test writing/reading VL strings on datasets.
+ * Purpose Test writing/reading VL strings on datasets.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (use C version)
+ * January, 2007
*
*-------------------------------------------------------------------------
*/
@@ -136,89 +136,89 @@ static void test_vlstring_dataset()
SUBTEST("VL String on Datasets");
try {
- // Open the file
- H5File file1(FILENAME, H5F_ACC_TRUNC);
+ // Open the file
+ H5File file1(FILENAME, H5F_ACC_TRUNC);
- // Create a datatype to refer to.
- StrType vlst(0, H5T_VARIABLE);
+ // Create a datatype to refer to.
+ StrType vlst(0, H5T_VARIABLE);
- // Open the root group.
- Group root = file1.openGroup("/");
+ // Open the root group.
+ Group root = file1.openGroup("/");
- // Create dataspace for the dataset.
- DataSpace ds_space (H5S_SCALAR);
+ // Create dataspace for the dataset.
+ DataSpace ds_space (H5S_SCALAR);
- // Create an dataset in the root group.
- DataSet dset1 = root.createDataSet(DSET1_NAME, vlst, ds_space);
+ // Create an dataset in the root group.
+ DataSet dset1 = root.createDataSet(DSET1_NAME, vlst, ds_space);
- // Write data to the dataset.
- dset1.write(DSET1_DATA, vlst);
+ // Write data to the dataset.
+ dset1.write(DSET1_DATA, vlst);
- // Read and verify the dataset string as a string of chars.
- dset1.read(&string_ds_check, vlst);
- if(HDstrcmp(string_ds_check, DSET1_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,string_ds_check=%s\n",__LINE__, DSET1_DATA.c_str(), string_ds_check);
+ // Read and verify the dataset string as a string of chars.
+ dset1.read(&string_ds_check, vlst);
+ if(HDstrcmp(string_ds_check, DSET1_DATA.c_str())!=0)
+ TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,string_ds_check=%s\n",__LINE__, DSET1_DATA.c_str(), string_ds_check);
- HDfree(string_ds_check); // note: no need for std::string test
+ HDfree(string_ds_check); // note: no need for std::string test
string_ds_check = NULL;
- // Read and verify the dataset string as an std::string.
- H5std_string read_str;
- dset1.read(read_str, vlst);
- if (read_str != DSET1_DATA)
- TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,read_str=%s\n",__LINE__, DSET1_DATA.c_str(), read_str.c_str());
+ // Read and verify the dataset string as an std::string.
+ H5std_string read_str;
+ dset1.read(read_str, vlst);
+ if (read_str != DSET1_DATA)
+ TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,read_str=%s\n",__LINE__, DSET1_DATA.c_str(), read_str.c_str());
- // Close the dataset.
- dset1.close();
+ // Close the dataset.
+ dset1.close();
- // Test scalar type dataset with 1 value.
- dset1 = root.createDataSet("test_scalar_small", vlst, ds_space);
+ // Test scalar type dataset with 1 value.
+ dset1 = root.createDataSet("test_scalar_small", vlst, ds_space);
- dynstring_ds_write = (char*)HDcalloc(1, sizeof(char));
- HDmemset(dynstring_ds_write, 'A', 1);
+ dynstring_ds_write = (char*)HDcalloc(1, sizeof(char));
+ HDmemset(dynstring_ds_write, 'A', 1);
- // Write data to the dataset, then read it back.
- dset1.write(&dynstring_ds_write, vlst);
- dset1.read(&string_ds_check, vlst);
+ // Write data to the dataset, then read it back.
+ dset1.write(&dynstring_ds_write, vlst);
+ dset1.read(&string_ds_check, vlst);
- // Verify data read.
- if(HDstrcmp(string_ds_check,dynstring_ds_write)!=0)
- TestErrPrintf("VL string datasets don't match!, dynstring_ds_write=%s, string_ds_check=%s\n",dynstring_ds_write,string_ds_check);
- HDfree(string_ds_check);
+ // Verify data read.
+ if(HDstrcmp(string_ds_check,dynstring_ds_write)!=0)
+ TestErrPrintf("VL string datasets don't match!, dynstring_ds_write=%s, string_ds_check=%s\n",dynstring_ds_write,string_ds_check);
+ HDfree(string_ds_check);
string_ds_check = NULL;
- dset1.close();
+ dset1.close();
- // Open dataset DSET1_NAME again.
- dset1 = root.openDataSet(DSET1_NAME);
+ // Open dataset DSET1_NAME again.
+ dset1 = root.openDataSet(DSET1_NAME);
- // Close dataset and file
- dset1.close();
- file1.close();
+ // Close dataset and file
+ dset1.close();
+ file1.close();
- PASSED();
+ PASSED();
} // end try block
// Catch all exceptions.
catch (Exception& E)
{
- issue_fail_msg("test_vlstring_dataset()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_vlstring_dataset()", __LINE__, __FILE__, E.getCDetailMsg());
}
if(dynstring_ds_write)
HDfree(dynstring_ds_write);
if(string_ds_check)
- HDfree(string_ds_check);
+ HDfree(string_ds_check);
} // test_vlstring_dataset()
/*-------------------------------------------------------------------------
- * Function: test_vlstring_array_dataset
+ * Function: test_vlstring_array_dataset
*
- * Purpose: Test writing/reading VL string array to/from datasets.
+ * Purpose Test writing/reading VL string array to/from datasets.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler
- * July, 2009
+ * Programmer Binh-Minh Ribler
+ * July, 2009
*
*-------------------------------------------------------------------------
*/
@@ -235,89 +235,89 @@ static void test_vlstring_array_dataset()
H5File* file1 = NULL;
try {
// Create file.
- file1 = new H5File(FILENAME, H5F_ACC_RDWR);
+ file1 = new H5File(FILENAME, H5F_ACC_RDWR);
// Create dataspace for datasets.
hsize_t dims1[] = {SPACE1_DIM1};
DataSpace ds_space(SPACE1_RANK, dims1);
- // Create a datatype to refer to.
- StrType vlst(0, H5T_VARIABLE);
-
- // Create and write a dataset.
- DataSet dataset(file1->createDataSet(DSSTRARR_NAME, vlst, ds_space));
- dataset.write(string_ds_array, vlst);
-
- // Read and verify the dataset using strings of chars as buffer.
- // Note: reading by array of H5std_string doesn't work yet.
- char *string_ds_check[SPACE1_DIM1];
- dataset.read(string_ds_check, vlst);
-
- hsize_t ii;
- for (ii = 0; ii < SPACE1_DIM1; ii++)
- {
- if(HDstrcmp(string_ds_check[ii], string_ds_array[ii])!=0)
- TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n",__LINE__, string_ds_array[ii], string_ds_check[ii]);
-
- HDfree(string_ds_check[ii]);
- }
-
- // Close objects that are no longer needed.
- dataset.close();
- ds_space.close();
-
- //
- // Test with scalar data space.
- //
-
- // Create H5S_SCALAR data space.
- DataSpace scalar_space;
-
- // Create and write another dataset.
- DataSet dataset2(file1->createDataSet("Dataset2", vlst, scalar_space));
- char *wdata2 = (char*)HDcalloc(65534, sizeof(char));
- HDmemset(wdata2, 'A', 65533);
- dataset2.write(&wdata2, vlst);
-
- char *rdata2;
- dataset2.read(&rdata2, vlst);
- if (HDstrcmp(wdata2, rdata2)!=0)
- TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n",__LINE__, wdata2, rdata2);
-
- // Release resources from second dataset operation.
- scalar_space.close();
- dataset2.close();
- HDfree(wdata2);
- HDfree(rdata2);
-
- // Close objects and file.
- dataset2.close();
- vlst.close();
- file1->close();
-
- PASSED();
+ // Create a datatype to refer to.
+ StrType vlst(0, H5T_VARIABLE);
+
+ // Create and write a dataset.
+ DataSet dataset(file1->createDataSet(DSSTRARR_NAME, vlst, ds_space));
+ dataset.write(string_ds_array, vlst);
+
+ // Read and verify the dataset using strings of chars as buffer.
+ // Note: reading by array of H5std_string doesn't work yet.
+ char *string_ds_check[SPACE1_DIM1];
+ dataset.read(string_ds_check, vlst);
+
+ hsize_t ii;
+ for (ii = 0; ii < SPACE1_DIM1; ii++)
+ {
+ if(HDstrcmp(string_ds_check[ii], string_ds_array[ii])!=0)
+ TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n",__LINE__, string_ds_array[ii], string_ds_check[ii]);
+
+ HDfree(string_ds_check[ii]);
+ }
+
+ // Close objects that are no longer needed.
+ dataset.close();
+ ds_space.close();
+
+ //
+ // Test with scalar data space.
+ //
+
+ // Create H5S_SCALAR data space.
+ DataSpace scalar_space;
+
+ // Create and write another dataset.
+ DataSet dataset2(file1->createDataSet("Dataset2", vlst, scalar_space));
+ char *wdata2 = (char*)HDcalloc(65534, sizeof(char));
+ HDmemset(wdata2, 'A', 65533);
+ dataset2.write(&wdata2, vlst);
+
+ char *rdata2;
+ dataset2.read(&rdata2, vlst);
+ if (HDstrcmp(wdata2, rdata2)!=0)
+ TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n",__LINE__, wdata2, rdata2);
+
+ // Release resources from second dataset operation.
+ scalar_space.close();
+ dataset2.close();
+ HDfree(wdata2);
+ HDfree(rdata2);
+
+ // Close objects and file.
+ dataset2.close();
+ vlst.close();
+ file1->close();
+
+ PASSED();
} // end try
// Catch all exceptions.
catch (Exception& E)
{
- issue_fail_msg("test_vlstring_array_dataset()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_vlstring_array_dataset()", __LINE__, __FILE__, E.getCDetailMsg());
}
if(file1)
- delete file1;
+ delete file1;
} // end test_vlstring_array_dataset()
/*-------------------------------------------------------------------------
- * Function: test_vlstrings_special
+ * Function: test_vlstrings_special
*
- * Purpose: Test VL string code for special string cases, nil and
- * zero-sized.
+ * Purpose Test VL string code for special string cases, nil and
+ * zero-sized.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (use C version)
+ * January, 2007
*
*-------------------------------------------------------------------------
*/
@@ -331,110 +331,110 @@ static void test_vlstrings_special()
SUBTEST("Special VL Strings");
try {
- // Create file.
- H5File file1(FILENAME, H5F_ACC_TRUNC);
+ // Create file.
+ H5File file1(FILENAME, H5F_ACC_TRUNC);
// Create dataspace for datasets.
hsize_t dims1[] = {SPACE1_DIM1};
DataSpace sid1(SPACE1_RANK, dims1);
- // Create a datatype to refer to.
- StrType vlst(0, H5T_VARIABLE);
-
- // Create a dataset.
- DataSet dataset(file1.createDataSet("Dataset3", vlst, sid1));
-
- // Read from the dataset before writing data.
- dataset.read(rdata, vlst);
-
- // Check data read in.
- hsize_t ii; // counting variable
- for (ii=0; ii<SPACE1_DIM1; ii++)
- if(rdata[ii]!=NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
-
- // Write dataset to disk, then read it back.
- dataset.write(wdata, vlst);
- dataset.read(rdata, vlst);
-
- // Compare data read in.
- for (ii = 0; ii < SPACE1_DIM1; ii++) {
- size_t wlen = HDstrlen(wdata[ii]);
- size_t rlen = HDstrlen(rdata[ii]);
- if(wlen != rlen) {
- TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%u, strlen(rdata[%d])=%u\n", (int)ii, (unsigned)wlen, (int)ii, (unsigned)rlen);
- continue;
- } // end if
- if(HDstrcmp(wdata[ii],rdata[ii]) != 0) {
- TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)ii, wdata[ii], (int)ii, rdata[ii]);
- continue;
- } // end if
- } // end for
-
- // Reclaim the read VL data.
- DataSet::vlenReclaim((void *)rdata, vlst, sid1);
-
- // Close Dataset.
- dataset.close();
-
- /*
- * Create another dataset to test nil strings.
- */
-
- // Create the property list and set the fill value for the second
- // dataset.
- DSetCreatPropList dcpl;
- char *fill = NULL; // Fill value
- dcpl.setFillValue(vlst, &fill);
- dataset = file1.createDataSet("Dataset4", vlst, sid1, dcpl);
-
- // Close dataset creation property list.
- dcpl.close();
-
- // Read from dataset before writing data.
- dataset.read(rdata, vlst);
-
- // Check data read in.
- for (ii=0; ii<SPACE1_DIM1; ii++)
- if(rdata[ii]!=NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
-
- // Try to write nil strings to disk.
- dataset.write(wdata2, vlst);
-
- // Read nil strings back from disk.
- dataset.read(rdata, vlst);
-
- // Check data read in.
- for (ii=0; ii<SPACE1_DIM1; ii++)
- if(rdata[ii]!=NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
-
- // Close objects and file.
- dataset.close();
- vlst.close();
- sid1.close();
- file1.close();
-
- PASSED();
+ // Create a datatype to refer to.
+ StrType vlst(0, H5T_VARIABLE);
+
+ // Create a dataset.
+ DataSet dataset(file1.createDataSet("Dataset3", vlst, sid1));
+
+ // Read from the dataset before writing data.
+ dataset.read(rdata, vlst);
+
+ // Check data read in.
+ hsize_t ii; // counting variable
+ for (ii=0; ii<SPACE1_DIM1; ii++)
+ if(rdata[ii]!=NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
+
+ // Write dataset to disk, then read it back.
+ dataset.write(wdata, vlst);
+ dataset.read(rdata, vlst);
+
+ // Compare data read in.
+ for (ii = 0; ii < SPACE1_DIM1; ii++) {
+ size_t wlen = HDstrlen(wdata[ii]);
+ size_t rlen = HDstrlen(rdata[ii]);
+ if(wlen != rlen) {
+ TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%u, strlen(rdata[%d])=%u\n", (int)ii, (unsigned)wlen, (int)ii, (unsigned)rlen);
+ continue;
+ } // end if
+ if(HDstrcmp(wdata[ii],rdata[ii]) != 0) {
+ TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)ii, wdata[ii], (int)ii, rdata[ii]);
+ continue;
+ } // end if
+ } // end for
+
+ // Reclaim the read VL data.
+ DataSet::vlenReclaim((void *)rdata, vlst, sid1);
+
+ // Close Dataset.
+ dataset.close();
+
+ /*
+ * Create another dataset to test nil strings.
+ */
+
+ // Create the property list and set the fill value for the second
+ // dataset.
+ DSetCreatPropList dcpl;
+ char *fill = NULL; // Fill value
+ dcpl.setFillValue(vlst, &fill);
+ dataset = file1.createDataSet("Dataset4", vlst, sid1, dcpl);
+
+ // Close dataset creation property list.
+ dcpl.close();
+
+ // Read from dataset before writing data.
+ dataset.read(rdata, vlst);
+
+ // Check data read in.
+ for (ii=0; ii<SPACE1_DIM1; ii++)
+ if(rdata[ii]!=NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
+
+ // Try to write nil strings to disk.
+ dataset.write(wdata2, vlst);
+
+ // Read nil strings back from disk.
+ dataset.read(rdata, vlst);
+
+ // Check data read in.
+ for (ii=0; ii<SPACE1_DIM1; ii++)
+ if(rdata[ii]!=NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)ii,rdata[ii]);
+
+ // Close objects and file.
+ dataset.close();
+ vlst.close();
+ sid1.close();
+ file1.close();
+
+ PASSED();
} // end try
// Catch all exceptions.
catch (Exception& E)
{
- issue_fail_msg("test_vlstrings_special()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_vlstrings_special()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_vlstrings_special
/*-------------------------------------------------------------------------
- * Function: test_vlstring_type
+ * Function: test_vlstring_type
*
- * Purpose: Test if VL string is treated as string.
+ * Purpose Test if VL string is treated as string.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (use C version)
+ * January, 2007
*
*-------------------------------------------------------------------------
*/
@@ -446,67 +446,67 @@ static void test_vlstring_type()
H5File* file1 = NULL;
try {
- // Open file.
- file1 = new H5File(FILENAME, H5F_ACC_RDWR);
+ // Open file.
+ file1 = new H5File(FILENAME, H5F_ACC_RDWR);
- // Create a datatype to refer to.
- StrType vlst(PredType::C_S1);
+ // Create a datatype to refer to.
+ StrType vlst(PredType::C_S1);
- // Change padding and verify it.
- vlst.setStrpad(H5T_STR_NULLPAD);
- H5T_str_t pad = vlst.getStrpad();
- verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__);
+ // Change padding and verify it.
+ vlst.setStrpad(H5T_STR_NULLPAD);
+ H5T_str_t pad = vlst.getStrpad();
+ verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__);
- // Convert to variable-length string.
- vlst.setSize(H5T_VARIABLE);
+ // Convert to variable-length string.
+ vlst.setSize(H5T_VARIABLE);
- // Check if datatype is VL string.
- H5T_class_t type_class = vlst.getClass();
- verify_val(type_class, H5T_STRING, "DataType::getClass", __LINE__, __FILE__);
- bool is_variable_str = vlst.isVariableStr();
- verify_val(is_variable_str, true, "DataType::isVariableStr", __LINE__, __FILE__);
+ // Check if datatype is VL string.
+ H5T_class_t type_class = vlst.getClass();
+ verify_val(type_class, H5T_STRING, "DataType::getClass", __LINE__, __FILE__);
+ bool is_variable_str = vlst.isVariableStr();
+ verify_val(is_variable_str, true, "DataType::isVariableStr", __LINE__, __FILE__);
- // Check default character set and padding.
- H5T_cset_t cset = vlst.getCset();
- verify_val(cset, H5T_CSET_ASCII, "StrType::getCset", __LINE__, __FILE__);
- pad = vlst.getStrpad();
- verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__);
+ // Check default character set and padding.
+ H5T_cset_t cset = vlst.getCset();
+ verify_val(cset, H5T_CSET_ASCII, "StrType::getCset", __LINE__, __FILE__);
+ pad = vlst.getStrpad();
+ verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__);
- // Commit variable-length string datatype to storage.
- vlst.commit(*file1, VLSTR_TYPE);
+ // Commit variable-length string datatype to storage.
+ vlst.commit(*file1, VLSTR_TYPE);
- // Close datatype.
- vlst.close();
+ // Close datatype.
+ vlst.close();
- // Try opening datatype again.
- vlst = file1->openStrType(VLSTR_TYPE); // deprecated
+ // Try opening datatype again.
+ vlst = file1->openStrType(VLSTR_TYPE); // deprecated
- // Close again and reopen with constructor.
- vlst.close();
- StrType vlst1(*file1, VLSTR_TYPE);
+ // Close again and reopen with constructor.
+ vlst.close();
+ StrType vlst1(*file1, VLSTR_TYPE);
- // Close datatype and file.
- vlst1.close();
- file1->close();
+ // Close datatype and file.
+ vlst1.close();
+ file1->close();
delete file1;
- // Open file.
- file1 = new H5File(FILENAME, H5F_ACC_RDWR);
+ // Open file.
+ file1 = new H5File(FILENAME, H5F_ACC_RDWR);
- // Open the variable-length string datatype just created
- StrType vlst2(*file1, VLSTR_TYPE);
+ // Open the variable-length string datatype just created
+ StrType vlst2(*file1, VLSTR_TYPE);
- // Verify character set and padding
- cset = vlst2.getCset();
- verify_val(cset, H5T_CSET_ASCII, "StrType::getCset", __LINE__, __FILE__);
- pad = vlst2.getStrpad();
- verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__);
+ // Verify character set and padding
+ cset = vlst2.getCset();
+ verify_val(cset, H5T_CSET_ASCII, "StrType::getCset", __LINE__, __FILE__);
+ pad = vlst2.getStrpad();
+ verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__);
- // Close datatype and file
- vlst2.close();
- file1->close();
+ // Close datatype and file
+ vlst2.close();
+ file1->close();
- PASSED();
+ PASSED();
} // end try block
// Catch all exceptions.
@@ -516,18 +516,18 @@ static void test_vlstring_type()
}
if(file1)
- delete file1;
+ delete file1;
} // end test_vlstring_type()
/*-------------------------------------------------------------------------
- * Function: test_compact_vlstring
+ * Function: test_compact_vlstring
*
- * Purpose: Test storing VL strings in compact datasets.
+ * Purpose Test storing VL strings in compact datasets.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (use C version)
+ * January, 2007
*
*-------------------------------------------------------------------------
*/
@@ -537,55 +537,55 @@ static void test_compact_vlstring()
SUBTEST("VL Strings on Compact Dataset");
try {
- // Create file
- H5File file1(FILENAME, H5F_ACC_TRUNC);
+ // Create file
+ H5File file1(FILENAME, H5F_ACC_TRUNC);
- // Create dataspace for datasets
+ // Create dataspace for datasets
hsize_t dims1[] = {SPACE1_DIM1};
DataSpace sid1(SPACE1_RANK, dims1);
- // Create a datatype to refer to
- StrType vlst(0, H5T_VARIABLE);
-
- // Create dataset create property list and set layout
- DSetCreatPropList plist;
- plist.setLayout(H5D_COMPACT);
-
- // Create a dataset
- DataSet dataset(file1.createDataSet("Dataset5", vlst, sid1, plist));
-
- // Write dataset to disk
- const char *wdata[SPACE1_DIM1] = {"one", "two", "three", "four"};
- dataset.write(wdata, vlst);
-
- // Read dataset from disk
- char *rdata[SPACE1_DIM1]; // Information read in
- dataset.read(rdata, vlst);
-
- // Compare data read in
- hsize_t i;
- for (i=0; i<SPACE1_DIM1; i++) {
- if (HDstrlen(wdata[i])!=strlen(rdata[i])) {
- TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
- continue;
- } // end if
- if (HDstrcmp(wdata[i],rdata[i]) != 0) {
- TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
- continue;
- } // end if
- } // end for
-
- // Reclaim the read VL data
- DataSet::vlenReclaim((void *)rdata, vlst, sid1);
-
- // Close objects and file
- dataset.close();
- vlst.close();
- sid1.close();
- plist.close();
- file1.close();
-
- PASSED();
+ // Create a datatype to refer to
+ StrType vlst(0, H5T_VARIABLE);
+
+ // Create dataset create property list and set layout
+ DSetCreatPropList plist;
+ plist.setLayout(H5D_COMPACT);
+
+ // Create a dataset
+ DataSet dataset(file1.createDataSet("Dataset5", vlst, sid1, plist));
+
+ // Write dataset to disk
+ const char *wdata[SPACE1_DIM1] = {"one", "two", "three", "four"};
+ dataset.write(wdata, vlst);
+
+ // Read dataset from disk
+ char *rdata[SPACE1_DIM1]; // Information read in
+ dataset.read(rdata, vlst);
+
+ // Compare data read in
+ hsize_t i;
+ for (i=0; i<SPACE1_DIM1; i++) {
+ if (HDstrlen(wdata[i])!=strlen(rdata[i])) {
+ TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
+ continue;
+ } // end if
+ if (HDstrcmp(wdata[i],rdata[i]) != 0) {
+ TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
+ continue;
+ } // end if
+ } // end for
+
+ // Reclaim the read VL data
+ DataSet::vlenReclaim((void *)rdata, vlst, sid1);
+
+ // Close objects and file
+ dataset.close();
+ vlst.close();
+ sid1.close();
+ plist.close();
+ file1.close();
+
+ PASSED();
} // end try
// Catch all exceptions.
@@ -596,14 +596,14 @@ static void test_compact_vlstring()
} // test_compact_vlstrings
/*-------------------------------------------------------------------------
- * Function: test_vlstring_attribute
+ * Function: test_vlstring_attribute
*
- * Purpose: Test writing/reading VL strings on attributes.
+ * Purpose Test writing/reading VL strings on attributes.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (use C version)
+ * January, 2007
*
*-------------------------------------------------------------------------
*/
@@ -620,81 +620,81 @@ static void test_vlstring_attribute()
SUBTEST("VL String on Attributes");
try {
- // Open the file
- H5File file1(FILENAME, H5F_ACC_RDWR);
+ // Open the file
+ H5File file1(FILENAME, H5F_ACC_RDWR);
- // Create a datatype to refer to.
- StrType vlst(0, H5T_VARIABLE);
+ // Create a datatype to refer to.
+ StrType vlst(0, H5T_VARIABLE);
- // Open the root group.
- Group root = file1.openGroup("/");
+ // Open the root group.
+ Group root = file1.openGroup("/");
- // Create dataspace for the attribute.
- DataSpace att_space (H5S_SCALAR);
+ // Create dataspace for the attribute.
+ DataSpace att_space (H5S_SCALAR);
- // Create an attribute for the root group.
- Attribute gr_attr = root.createAttribute(ATTRSTR_NAME, vlst, att_space);
+ // Create an attribute for the root group.
+ Attribute gr_attr = root.createAttribute(ATTRSTR_NAME, vlst, att_space);
- // Write data to the attribute.
- gr_attr.write(vlst, ATTRSTR_DATA);
+ // Write data to the attribute.
+ gr_attr.write(vlst, ATTRSTR_DATA);
- // Read and verify the attribute string as a string of chars.
- char *string_att_check;
- gr_attr.read(vlst, &string_att_check);
- if(HDstrcmp(string_att_check, ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), string_att_check);
+ // Read and verify the attribute string as a string of chars.
+ char *string_att_check;
+ gr_attr.read(vlst, &string_att_check);
+ if(HDstrcmp(string_att_check, ATTRSTR_DATA.c_str())!=0)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",__LINE__, ATTRSTR_DATA.c_str(), string_att_check);
- HDfree(string_att_check); // note: no need for std::string test
+ HDfree(string_att_check); // note: no need for std::string test
- // Read and verify the attribute string as an std::string.
- H5std_string read_str;
- gr_attr.read(vlst, read_str);
- if (read_str != ATTRSTR_DATA)
- TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_str=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_str.c_str());
+ // Read and verify the attribute string as an std::string.
+ H5std_string read_str;
+ gr_attr.read(vlst, read_str);
+ if (read_str != ATTRSTR_DATA)
+ TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,read_str=%s\n",__LINE__, ATTRSTR_DATA.c_str(), read_str.c_str());
- // Close group's attribute.
- gr_attr.close();
+ // Close group's attribute.
+ gr_attr.close();
- // Test creating a "large" sized string attribute
- gr_attr = root.createAttribute("test_scalar_large", vlst, att_space);
+ // Test creating a "large" sized string attribute
+ gr_attr = root.createAttribute("test_scalar_large", vlst, att_space);
- string_att_write = (char*)HDcalloc(8192, sizeof(char));
- HDmemset(string_att_write, 'A', 8191);
+ string_att_write = (char*)HDcalloc(8192, sizeof(char));
+ HDmemset(string_att_write, 'A', 8191);
- // Write data to the attribute, then read it back.
- gr_attr.write(vlst, &string_att_write);
- gr_attr.read(vlst, &string_att_check);
+ // Write data to the attribute, then read it back.
+ gr_attr.write(vlst, &string_att_write);
+ gr_attr.read(vlst, &string_att_check);
- // Verify data read.
- if(HDstrcmp(string_att_check,string_att_write)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
+ // Verify data read.
+ if(HDstrcmp(string_att_check,string_att_write)!=0)
+ TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
- // Release resources.
- HDfree(string_att_check);
- HDfree(string_att_write);
- gr_attr.close();
- file1.close();
+ // Release resources.
+ HDfree(string_att_check);
+ HDfree(string_att_write);
+ gr_attr.close();
+ file1.close();
- PASSED();
+ PASSED();
} // end try block
// Catch all exceptions.
catch (Exception& E)
{
- issue_fail_msg("test_vlstring_attribute()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_vlstring_attribute()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_vlstring_attribute()
#if 0
/*-------------------------------------------------------------------------
- * Function: test_read_vl_string_attribute
+ * Function: test_read_vl_string_attribute
*
- * Purpose: Test reading VL strings from attributes.
+ * Purpose Test reading VL strings from attributes.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (use C version)
+ * January, 2007
*
*-------------------------------------------------------------------------
*/
@@ -705,58 +705,58 @@ static void test_read_vl_string_attribute()
SUBTEST("reading VL String as attributes");
try {
- // Open file
- H5File file1(FILENAME, H5F_ACC_RDONLY);
-
- // Create a datatype to refer to.
- StrType vlst(0, H5T_VARIABLE);
-
- // Open the root group and its attribute named ATTRSTR_NAME.
- Group root = file1.openGroup("/");
- Attribute att = root.openAttribute(ATTRSTR_NAME);
-
- // Test reading "normal" sized string attribute
- char *string_att_check;
- att.read(vlst, &string_att_check);
- if(HDstrcmp(string_att_check,ATTRSTR_DATA.c_str())!=0)
- TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",ATTRSTR_DATA.c_str(),string_att_check);
- HDfree(string_att_check);
- att.close();
-
- // Test reading "large" sized string attribute
- att = root.openAttribute("test_scalar_large");
- att.read(vlst, &string_att_check);
- if(HDstrcmp(string_att_check,string_att_write)!=0)
- TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
- HDfree(string_att_check);
- HDfree(string_att_write); // Free string allocated in test_write_vl_string_attribute
-
- // Close objects and file.
- att.close();
- vlst.close();
- root.close();
- file1.close();
-
- PASSED();
+ // Open file
+ H5File file1(FILENAME, H5F_ACC_RDONLY);
+
+ // Create a datatype to refer to.
+ StrType vlst(0, H5T_VARIABLE);
+
+ // Open the root group and its attribute named ATTRSTR_NAME.
+ Group root = file1.openGroup("/");
+ Attribute att = root.openAttribute(ATTRSTR_NAME);
+
+ // Test reading "normal" sized string attribute
+ char *string_att_check;
+ att.read(vlst, &string_att_check);
+ if(HDstrcmp(string_att_check,ATTRSTR_DATA.c_str())!=0)
+ TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",ATTRSTR_DATA.c_str(),string_att_check);
+ HDfree(string_att_check);
+ att.close();
+
+ // Test reading "large" sized string attribute
+ att = root.openAttribute("test_scalar_large");
+ att.read(vlst, &string_att_check);
+ if(HDstrcmp(string_att_check,string_att_write)!=0)
+ TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
+ HDfree(string_att_check);
+ HDfree(string_att_write); // Free string allocated in test_write_vl_string_attribute
+
+ // Close objects and file.
+ att.close();
+ vlst.close();
+ root.close();
+ file1.close();
+
+ PASSED();
} // end try
// Catch all exceptions.
catch (Exception& E)
{
- issue_fail_msg("test_read_vl_string_attribute()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_read_vl_string_attribute()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_read_vl_string_attribute
#endif // 2013: need to verify before adding to test
/*-------------------------------------------------------------------------
- * Function: test_vlstring_array_attribute
+ * Function: test_vlstring_array_attribute
*
- * Purpose: Test writing/reading VL string array to/from attributes.
+ * Purpose Test writing/reading VL string array to/from attributes.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler
- * July, 2009
+ * Programmer Binh-Minh Ribler
+ * July, 2009
*
*-------------------------------------------------------------------------
*/
@@ -772,105 +772,105 @@ static void test_vlstring_array_attribute()
SUBTEST("VL String Array on Attributes");
try {
- // Open the file
- H5File file1(FILENAME, H5F_ACC_RDWR);
+ // Open the file
+ H5File file1(FILENAME, H5F_ACC_RDWR);
- // Create a datatype to refer to.
- StrType vlst(0, H5T_VARIABLE);
+ // Create a datatype to refer to.
+ StrType vlst(0, H5T_VARIABLE);
- // Open the root group.
- Group root = file1.openGroup("/");
+ // Open the root group.
+ Group root = file1.openGroup("/");
// Create dataspace for datasets.
hsize_t dims1[] = {SPACE1_DIM1};
DataSpace att_space(SPACE1_RANK, dims1);
- // Create an attribute for the root group.
- Attribute gr_attr = root.createAttribute(ATTRSTRARR_NAME, vlst, att_space);
+ // Create an attribute for the root group.
+ Attribute gr_attr = root.createAttribute(ATTRSTRARR_NAME, vlst, att_space);
- // Write data to the attribute.
- gr_attr.write(vlst, string_att_array);
+ // Write data to the attribute.
+ gr_attr.write(vlst, string_att_array);
- // Read and verify the attribute string as a string of chars.
- // Note: reading by array of H5std_string doesn't work yet.
- char *string_att_check[SPACE1_DIM1];
- gr_attr.read(vlst, &string_att_check);
+ // Read and verify the attribute string as a string of chars.
+ // Note: reading by array of H5std_string doesn't work yet.
+ char *string_att_check[SPACE1_DIM1];
+ gr_attr.read(vlst, &string_att_check);
- hsize_t ii;
- for (ii = 0; ii < SPACE1_DIM1; ii++)
- {
- if(HDstrcmp(string_att_check[ii], string_att_array[ii])!=0)
- TestErrPrintf("Line %d: Attribute data different: written=%s,read=%s\n",__LINE__, string_att_check[ii], string_att_check[ii]);
+ hsize_t ii;
+ for (ii = 0; ii < SPACE1_DIM1; ii++)
+ {
+ if(HDstrcmp(string_att_check[ii], string_att_array[ii])!=0)
+ TestErrPrintf("Line %d: Attribute data different: written=%s,read=%s\n",__LINE__, string_att_check[ii], string_att_check[ii]);
- HDfree(string_att_check[ii]); // note: no need for std::string test
- }
+ HDfree(string_att_check[ii]); // note: no need for std::string test
+ }
- // Close group's attribute.
- gr_attr.close();
- file1.close();
+ // Close group's attribute.
+ gr_attr.close();
+ file1.close();
- PASSED();
+ PASSED();
} // end try block
// Catch all exceptions.
catch (Exception& E)
{
- issue_fail_msg("test_vlstring_array_attribute()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_vlstring_array_attribute()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_vlstring_array_attribute()
/* Helper routine for test_vl_rewrite() */
static void write_scalar_dset(H5File& file, DataType& type, DataSpace& space,
- char *name, char *data)
+ char *name, char *data)
{
DataSet dset;
try {
- dset = file.createDataSet(name, type, space);
- dset.write(&data, type, space, space);
- dset.close();
+ dset = file.createDataSet(name, type, space);
+ dset.write(&data, type, space, space);
+ dset.close();
} // end try
catch (FileIException& ferr) {
- throw;
+ throw;
}
catch (DataSetIException& derr) {
- throw;
+ throw;
}
}
/* Helper routine for test_vl_rewrite() */
static void read_scalar_dset(H5File& file, DataType& type, DataSpace& space,
- char *name, char *data)
+ char *name, char *data)
{
char *data_read;
DataSet dset;
try {
- dset = file.openDataSet(name);
- dset.read(&data_read, type, space, space);
- dset.close();
+ dset = file.openDataSet(name);
+ dset.read(&data_read, type, space, space);
+ dset.close();
- if(HDstrcmp(data, data_read))
- TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read);
+ if(HDstrcmp(data, data_read))
+ TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read);
- HDfree(data_read);
+ HDfree(data_read);
} // end try
catch (FileIException& ferr) {
- throw;
+ throw;
}
catch (DataSetIException& derr) {
- throw;
+ throw;
}
}
/*-------------------------------------------------------------------------
- * Function: test_vl_rewrite
+ * Function: test_vl_rewrite
*
- * Purpose: Test I/O on VL strings when many objects in the file
- * have been linked/unlinked.
+ * Purpose Test I/O on VL strings when many objects in the file
+ * have been linked/unlinked.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler (use C version)
- * January, 2007
+ * Programmer Binh-Minh Ribler (use C version)
+ * January, 2007
*
*-------------------------------------------------------------------------
*/
@@ -882,75 +882,75 @@ static void test_vl_rewrite()
SUBTEST("I/O on VL strings with link/unlink");
try {
- // Create the files.
- H5File file1(FILENAME, H5F_ACC_TRUNC);
- H5File file2(FILENAME2, H5F_ACC_TRUNC);
-
- // Create the VL string datatype.
- StrType type(0, H5T_VARIABLE);
-
- // Create dataspace for the attribute.
- DataSpace space (H5S_SCALAR);
-
- // Create in file 1.
- int i;
- char name[256]; // Buffer for names & data
- for (i=0; i<REWRITE_NDATASETS; i++) {
- sprintf(name, "/set_%d", i);
- write_scalar_dset(file1, type, space, name, name);
- }
-
- // Effectively copy data from file 1 to 2.
- for (i=0; i<REWRITE_NDATASETS; i++) {
- sprintf(name, "/set_%d", i);
- read_scalar_dset(file1, type, space, name, name);
- write_scalar_dset(file2, type, space, name, name);
- }
-
- // Read back from file 2.
- for (i=0; i<REWRITE_NDATASETS; i++) {
- sprintf(name, "/set_%d", i);
- read_scalar_dset(file2, type, space, name, name);
- }
-
- // Remove from file 2.
- for (i=0; i<REWRITE_NDATASETS; i++) {
- sprintf(name, "/set_%d", i);
- file2.unlink(name);
- }
-
- // Effectively copy from file 1 to file 2.
- for (i=0; i<REWRITE_NDATASETS; i++) {
- sprintf(name, "/set_%d", i);
- read_scalar_dset(file1, type, space, name, name);
- write_scalar_dset(file2, type, space, name, name);
- }
-
- // Close objects and file.
- type.close();
- space.close();
- file1.close();
- file2.close();
-
- PASSED();
+ // Create the files.
+ H5File file1(FILENAME, H5F_ACC_TRUNC);
+ H5File file2(FILENAME2, H5F_ACC_TRUNC);
+
+ // Create the VL string datatype.
+ StrType type(0, H5T_VARIABLE);
+
+ // Create dataspace for the attribute.
+ DataSpace space (H5S_SCALAR);
+
+ // Create in file 1.
+ int i;
+ char name[256]; // Buffer for names & data
+ for (i=0; i<REWRITE_NDATASETS; i++) {
+ sprintf(name, "/set_%d", i);
+ write_scalar_dset(file1, type, space, name, name);
+ }
+
+ // Effectively copy data from file 1 to 2.
+ for (i=0; i<REWRITE_NDATASETS; i++) {
+ sprintf(name, "/set_%d", i);
+ read_scalar_dset(file1, type, space, name, name);
+ write_scalar_dset(file2, type, space, name, name);
+ }
+
+ // Read back from file 2.
+ for (i=0; i<REWRITE_NDATASETS; i++) {
+ sprintf(name, "/set_%d", i);
+ read_scalar_dset(file2, type, space, name, name);
+ }
+
+ // Remove from file 2.
+ for (i=0; i<REWRITE_NDATASETS; i++) {
+ sprintf(name, "/set_%d", i);
+ file2.unlink(name);
+ }
+
+ // Effectively copy from file 1 to file 2.
+ for (i=0; i<REWRITE_NDATASETS; i++) {
+ sprintf(name, "/set_%d", i);
+ read_scalar_dset(file1, type, space, name, name);
+ write_scalar_dset(file2, type, space, name, name);
+ }
+
+ // Close objects and file.
+ type.close();
+ space.close();
+ file1.close();
+ file2.close();
+
+ PASSED();
} // end try
// Catch all exceptions.
catch (Exception& E)
{
- issue_fail_msg("test_vl_rewrite()", __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_vl_rewrite()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // end test_vl_rewrite()
/*-------------------------------------------------------------------------
- * Function: test_vlstrings
+ * Function: test_vlstrings
*
- * Purpose: VL string testing main routine.
+ * Purpose VL string testing main routine.
*
- * Return: None
+ * Return None
*
- * Programmer: Binh-Minh Ribler
- * January, 2007
+ * Programmer Binh-Minh Ribler
+ * January, 2007
*
*-------------------------------------------------------------------------
*/
@@ -981,13 +981,13 @@ void test_vlstrings()
/*-------------------------------------------------------------------------
- * Function: cleanup_vlstrings
+ * Function: cleanup_vlstrings
*
- * Purpose: Cleanup temporary test files
+ * Purpose Cleanup temporary test files
*
- * Return: none
+ * Return none
*
- * Programmer: Quincey Koziol
+ * Programmer Quincey Koziol
* September 10, 1999
*
* Modifications: