summaryrefslogtreecommitdiffstats
path: root/c++/src
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-05-07 21:05:14 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-05-07 21:05:14 (GMT)
commit984ecb72c2fa62d233383b24047e04061754ae34 (patch)
treea0a1ce905153a08466dae1354e14d426c86b3849 /c++/src
parented599421c5ef01347368d50b1b7dbed3b323c43f (diff)
parent8f82c9b8be875cd28e18402e920f8e162d8f8d38 (diff)
downloadhdf5-984ecb72c2fa62d233383b24047e04061754ae34.zip
hdf5-984ecb72c2fa62d233383b24047e04061754ae34.tar.gz
hdf5-984ecb72c2fa62d233383b24047e04061754ae34.tar.bz2
[svn-r27038] Merge of r26393-27031 from the trunk.
Tested on 64-bit linux VM w/ C++ and Fortran 2003
Diffstat (limited to 'c++/src')
-rw-r--r--c++/src/CMakeLists.txt2
-rw-r--r--c++/src/H5AbstractDs.cpp54
-rw-r--r--c++/src/H5AbstractDs.h17
-rw-r--r--c++/src/H5ArrayType.h1
-rw-r--r--c++/src/H5Attribute.cpp18
-rw-r--r--c++/src/H5Attribute.h23
-rw-r--r--c++/src/H5CommonFG.cpp127
-rw-r--r--c++/src/H5CommonFG.h10
-rw-r--r--c++/src/H5CompType.cpp10
-rw-r--r--c++/src/H5DataSet.cpp18
-rw-r--r--c++/src/H5DataSet.h5
-rw-r--r--c++/src/H5DataSpace.cpp3
-rw-r--r--c++/src/H5DataSpace.h3
-rw-r--r--c++/src/H5DataType.cpp44
-rw-r--r--c++/src/H5DataType.h6
-rw-r--r--c++/src/H5Exception.cpp48
-rw-r--r--c++/src/H5FaccProp.cpp65
-rw-r--r--c++/src/H5FaccProp.h7
-rw-r--r--c++/src/H5File.cpp84
-rw-r--r--c++/src/H5File.h7
-rw-r--r--c++/src/H5Group.cpp11
-rw-r--r--c++/src/H5IdComponent.cpp25
-rw-r--r--c++/src/H5IdComponent.h10
-rw-r--r--c++/src/H5Include.h12
-rw-r--r--c++/src/H5IntType.h2
-rw-r--r--c++/src/H5Location.cpp77
-rw-r--r--c++/src/H5Location.h16
-rw-r--r--c++/src/H5Object.cpp29
-rw-r--r--c++/src/H5Object.h13
-rw-r--r--c++/src/H5PropList.cpp3
-rw-r--r--c++/src/H5VarLenType.h1
-rw-r--r--c++/src/cpp_doc_config2
32 files changed, 574 insertions, 179 deletions
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index 513bbb6..2f3a0c4 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -84,7 +84,7 @@ set (CPP_HDRS
)
add_library (${HDF5_CPP_LIB_TARGET} ${LIB_TYPE} ${CPP_SRCS} ${CPP_HDRS})
-TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} " " " ")
+TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} ${LIB_TYPE} " " " ")
target_link_libraries (${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} ${LIB_TYPE})
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp
index e6cacf9..d59c1eb 100644
--- a/c++/src/H5AbstractDs.cpp
+++ b/c++/src/H5AbstractDs.cpp
@@ -21,6 +21,7 @@
#include "H5PropList.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
+#include "H5DataSpace.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5Alltypes.h"
@@ -40,6 +41,12 @@ AbstractDs::AbstractDs(){}
// 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
+// been moved to the sub-classes. It will be removed in 1.10 release. If its
+// removal does not raise any problems in 1.10, it will be removed from 1.8 in
+// subsequent releases.
//--------------------------------------------------------------------------
AbstractDs::AbstractDs(const hid_t ds_id){}
@@ -47,8 +54,13 @@ AbstractDs::AbstractDs(const hid_t ds_id){}
// Function: AbstractDs copy constructor
///\brief Copy constructor: makes a copy of the original AbstractDs 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 is removed from 1.8.15 because it is
+// a noop and it can be generated by the compiler if needed.
//--------------------------------------------------------------------------
-AbstractDs::AbstractDs(const AbstractDs& original){}
+//--------------------------------------------------------------------------
+// AbstractDs::AbstractDs(const AbstractDs& original){}
//--------------------------------------------------------------------------
// Function: AbstractDs::getTypeClass
@@ -113,8 +125,9 @@ DataType AbstractDs::getDataType() const
// depending on which object invokes getDataType. Then, create and
// return the DataType object
try {
- DataType datatype(p_get_type());
- return(datatype);
+ DataType datatype;
+ f_DataType_setId(&datatype, p_get_type());
+ return(datatype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getDataType", E.getDetailMsg());
@@ -139,8 +152,9 @@ ArrayType AbstractDs::getArrayType() const
// depending on which object invokes getArrayType. Then, create and
// return the ArrayType object
try {
- ArrayType arraytype(p_get_type());
- return(arraytype);
+ ArrayType arraytype;
+ f_DataType_setId(&arraytype, p_get_type());
+ return(arraytype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getArrayType", E.getDetailMsg());
@@ -165,8 +179,9 @@ CompType AbstractDs::getCompType() const
// depending on which object invokes getCompType. Then, create and
// return the CompType object
try {
- CompType comptype(p_get_type());
- return(comptype);
+ CompType comptype;
+ f_DataType_setId(&comptype, p_get_type());
+ return(comptype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getCompType", E.getDetailMsg());
@@ -191,8 +206,9 @@ EnumType AbstractDs::getEnumType() const
// depending on which object invokes getEnumType. Then, create and
// return the EnumType object
try {
- EnumType enumtype(p_get_type());
- return(enumtype);
+ EnumType enumtype;
+ f_DataType_setId(&enumtype, p_get_type());
+ return(enumtype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getEnumType", E.getDetailMsg());
@@ -217,8 +233,9 @@ IntType AbstractDs::getIntType() const
// depending on which object invokes getIntType. Then, create and
// return the IntType object
try {
- IntType inttype(p_get_type());
- return(inttype);
+ IntType inttype;
+ f_DataType_setId(&inttype, p_get_type());
+ return(inttype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getIntType", E.getDetailMsg());
@@ -243,8 +260,9 @@ FloatType AbstractDs::getFloatType() const
// depending on which object invokes getFloatType. Then, create and
// return the FloatType object
try {
- FloatType floatype(p_get_type());
- return(floatype);
+ FloatType floatype;
+ f_DataType_setId(&floatype, p_get_type());
+ return(floatype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getFloatType", E.getDetailMsg());
@@ -269,8 +287,9 @@ StrType AbstractDs::getStrType() const
// depending on which object invokes getStrType. Then, create and
// return the StrType object
try {
- StrType strtype(p_get_type());
- return(strtype);
+ StrType strtype;
+ f_DataType_setId(&strtype, p_get_type());
+ return(strtype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getStrType", E.getDetailMsg());
@@ -295,8 +314,9 @@ VarLenType AbstractDs::getVarLenType() const
// depending on which object invokes getVarLenType. Then, create and
// return the VarLenType object
try {
- VarLenType varlentype(p_get_type());
- return(varlentype);
+ VarLenType varlentype;
+ f_DataType_setId(&varlentype, p_get_type());
+ return(varlentype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getVarLenType", E.getDetailMsg());
diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h
index 01d05b8..810dc8b 100644
--- a/c++/src/H5AbstractDs.h
+++ b/c++/src/H5AbstractDs.h
@@ -28,6 +28,7 @@ class FloatType;
class IntType;
class StrType;
class VarLenType;
+class DataSpace;
/*! \class AbstractDs
\brief AbstractDs is an abstract base class, inherited by Attribute
@@ -70,9 +71,6 @@ class H5_DLLCPP AbstractDs {
///\brief Returns this class name.
virtual H5std_string fromClass() const = 0;
- // Copy constructor
- AbstractDs( const AbstractDs& original );
-
// Destructor
virtual ~AbstractDs();
@@ -80,8 +78,17 @@ class H5_DLLCPP AbstractDs {
// Default constructor
AbstractDs();
- // Constructor that takes an attribute id or a dataset id.
- AbstractDs( const hid_t ds_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.
+
+ AbstractDs(const hid_t h5_id);
+
+ // Copy constructor
+ // AbstractDs( const AbstractDs& original );
private:
// This member function is implemented by DataSet and Attribute.
diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h
index 511126e..6577a6e 100644
--- a/c++/src/H5ArrayType.h
+++ b/c++/src/H5ArrayType.h
@@ -49,7 +49,6 @@ class H5_DLLCPP ArrayType : public DataType {
// Noop destructor
virtual ~ArrayType();
- protected:
// Default constructor
ArrayType();
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index a9e928d..0bfdff8 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -74,7 +74,8 @@ Attribute::Attribute(const Attribute& original) : AbstractDs(), IdComponent()
//--------------------------------------------------------------------------
Attribute::Attribute(const hid_t existing_id) : AbstractDs(), IdComponent()
{
- id = existing_id;
+ id = existing_id;
+ incRefCount(); // increment number of references to this id
}
//--------------------------------------------------------------------------
@@ -270,8 +271,9 @@ DataSpace Attribute::getSpace() const
// If the dataspace id is valid, create and return the DataSpace object
if( dataspace_id > 0 )
{
- DataSpace dataspace( dataspace_id );
- return( dataspace );
+ DataSpace dataspace;
+ f_DataSpace_setId(&dataspace, dataspace_id);
+ return(dataspace);
}
else
{
@@ -392,10 +394,12 @@ H5std_string Attribute::getName() const
//--------------------------------------------------------------------------
H5std_string Attribute::getName(size_t len) const
{
- H5std_string attr_name;
- ssize_t name_size = getName(attr_name, len);
- return(attr_name);
- // let caller catch exception if any
+ H5std_string attr_name;
+ ssize_t name_size = getName(attr_name, len);
+ if (name_size < 0)
+ return("");
+ else
+ return(attr_name);
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h
index f57b922..eced64e 100644
--- a/c++/src/H5Attribute.h
+++ b/c++/src/H5Attribute.h
@@ -31,6 +31,16 @@ namespace H5 {
*/
class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
public:
+
+ // Copy constructor: makes a copy of an existing Attribute object.
+ Attribute( const Attribute& original );
+
+ // Default constructor
+ Attribute();
+
+ // Creates a copy of an existing attribute using the attribute id
+ Attribute( const hid_t attr_id );
+
// Closes this attribute.
virtual void close();
@@ -70,15 +80,6 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("Attribute"); }
- // Creates a copy of an existing attribute using the attribute id
- Attribute( const hid_t attr_id );
-
- // Copy constructor: makes a copy of an existing Attribute object.
- Attribute( const Attribute& original );
-
- // Default constructor
- Attribute();
-
// Gets the attribute id.
virtual hid_t getId() const;
@@ -109,6 +110,10 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
// do not inherit H5Object::renameAttr
void renameAttr() {}
+
+ // Friend function to set Attribute id. For library use only.
+ friend void f_Attribute_setId(Attribute* attr, hid_t new_id);
+
};
#ifndef H5_NO_NAMESPACE
}
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index 3aa0386..dbe26b4 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -14,6 +14,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <string>
+#include <iostream>
#include "H5Include.h"
#include "H5Exception.h"
@@ -33,9 +34,6 @@
#include "H5Alltypes.h"
#include "H5private.h" // for HDstrcpy
-#include <iostream>
-using namespace std;
-
// There are a few comments that are common to most of the functions
// defined in this file so they are listed here.
// - getLocId is called by all functions, that call a C API, to get
@@ -51,6 +49,7 @@ using namespace std;
#ifndef H5_NO_NAMESPACE
namespace H5 {
+using namespace std;
#endif
//--------------------------------------------------------------------------
@@ -100,7 +99,9 @@ Group CommonFG::createGroup( const char* name, size_t size_hint ) const
throwException("createGroup", "H5Gcreate2 failed");
// No failure, create and return the Group object
- Group group( group_id );
+ Group group;
+ CommonFG *ptr = &group;
+ ptr->p_setId(group_id);
return( group );
}
@@ -136,7 +137,9 @@ Group CommonFG::openGroup( const char* name ) const
throwException("openGroup", "H5Gopen2 failed");
// No failure, create and return the Group object
- Group group( group_id );
+ Group group;
+ CommonFG *ptr = &group;
+ ptr->p_setId(group_id);
return( group );
}
@@ -178,7 +181,8 @@ DataSet CommonFG::createDataSet( const char* name, const DataType& data_type, co
throwException("createDataSet", "H5Dcreate2 failed");
// No failure, create and return the DataSet object
- DataSet dataset( dataset_id );
+ DataSet dataset;
+ f_DataSet_setId(&dataset, dataset_id);
return( dataset );
}
@@ -213,7 +217,8 @@ DataSet CommonFG::openDataSet( const char* name ) const
throwException("openDataSet", "H5Dopen2 failed");
// No failure, create and return the DataSet object
- DataSet dataset( dataset_id );
+ DataSet dataset;
+ f_DataSet_setId(&dataset, dataset_id);
return( dataset );
}
@@ -576,7 +581,8 @@ DataType CommonFG::openDataType( const char* name ) const
throwException("openDataType", "H5Topen2 failed");
// No failure, create and return the DataType object
- DataType data_type(type_id);
+ DataType data_type;
+ f_DataType_setId(&data_type, type_id);
return(data_type);
}
@@ -611,7 +617,8 @@ ArrayType CommonFG::openArrayType( const char* name ) const
throwException("openArrayType", "H5Topen2 failed");
// No failure, create and return the ArrayType object
- ArrayType array_type (type_id);
+ ArrayType array_type;
+ f_DataType_setId(&array_type, type_id);
return(array_type);
}
@@ -646,7 +653,8 @@ CompType CommonFG::openCompType( const char* name ) const
throwException("openCompType", "H5Topen2 failed");
// No failure, create and return the CompType object
- CompType comp_type(type_id);
+ CompType comp_type;
+ f_DataType_setId(&comp_type, type_id);
return(comp_type);
}
@@ -681,7 +689,8 @@ EnumType CommonFG::openEnumType( const char* name ) const
throwException("openEnumType", "H5Topen2 failed");
// No failure, create and return the EnumType object
- EnumType enum_type(type_id);
+ EnumType enum_type;
+ f_DataType_setId(&enum_type, type_id);
return(enum_type);
}
@@ -716,7 +725,8 @@ IntType CommonFG::openIntType( const char* name ) const
throwException("openIntType", "H5Topen2 failed");
// No failure, create and return the IntType object
- IntType int_type(type_id);
+ IntType int_type;
+ f_DataType_setId(&int_type, type_id);
return(int_type);
}
@@ -751,7 +761,8 @@ FloatType CommonFG::openFloatType( const char* name ) const
throwException("openFloatType", "H5Topen2 failed");
// No failure, create and return the FloatType object
- FloatType float_type(type_id);
+ FloatType float_type;
+ f_DataType_setId(&float_type, type_id);
return(float_type);
}
@@ -786,7 +797,8 @@ StrType CommonFG::openStrType( const char* name ) const
throwException("openStrType", "H5Topen2 failed");
// No failure, create and return the StrType object
- StrType str_type(type_id);
+ StrType str_type;
+ f_DataType_setId(&str_type, type_id);
return(str_type);
}
@@ -821,7 +833,8 @@ VarLenType CommonFG::openVarLenType( const char* name ) const
throwException("openVarLenType", "H5Topen2 failed");
// No failure, create and return the VarLenType object
- VarLenType varlen_type(type_id);
+ VarLenType varlen_type;
+ f_DataType_setId(&varlen_type, type_id);
return(varlen_type);
}
@@ -1100,6 +1113,58 @@ H5O_type_t CommonFG::childObjType(hsize_t index, H5_index_t index_type, H5_iter_
return(objtype);
}
+//--------------------------------------------------------------------------
+// Function: CommonFG::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 CommonFG::childObjVersion(const char* objname) const
+{
+ H5O_info_t objinfo;
+ unsigned version = 0;
+
+ // Use C API to get information of the object
+ herr_t ret_value = H5Oget_info_by_name(getLocId(), objname, &objinfo, H5P_DEFAULT);
+
+ // Throw exception if C API returns failure
+ if (ret_value < 0)
+ 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");
+ }
+ return(version);
+}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::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 CommonFG::childObjVersion(const H5std_string& objname) const
+{
+ // Use overloaded function
+ unsigned version = childObjVersion(objname.c_str());
+ return(version);
+}
+
#ifndef H5_NO_DEPRECATED_SYMBOLS
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
@@ -1172,6 +1237,7 @@ H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const
}
return (obj_type);
}
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -1189,6 +1255,37 @@ CommonFG::CommonFG() {}
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
CommonFG::~CommonFG() {}
+
+//--------------------------------------------------------------------------
+// Function: f_DataType_setId - friend
+// Purpose: This function is friend to class H5::DataType so that it
+// can set DataType::id in order to work around a problem
+// described in the JIRA issue HDFFV-7947.
+// Applications shouldn't need to use it.
+// param dtype - IN/OUT: DataType object to be changed
+// param new_id - IN: New id to set
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+void f_DataType_setId(DataType* dtype, hid_t new_id)
+{
+ dtype->id = new_id;
+}
+
+//--------------------------------------------------------------------------
+// Function: f_DataSet_setId - friend
+// Purpose: This function is friend to class H5::DataSet so that it
+// can set DataSet::id in order to work around a problem
+// described in the JIRA issue HDFFV-7947.
+// Applications shouldn't need to use it.
+// param dset - IN/OUT: DataSet object to be changed
+// param new_id - IN: New id to set
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+void f_DataSet_setId(DataSet* dset, hid_t new_id)
+{
+ dset->id = new_id;
+}
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h
index 5c8a142..d36d78c 100644
--- a/c++/src/H5CommonFG.h
+++ b/c++/src/H5CommonFG.h
@@ -21,6 +21,7 @@
namespace H5 {
#endif
+// Class forwarding
class Group;
class H5File;
class ArrayType;
@@ -70,6 +71,11 @@ class H5_DLLCPP CommonFG {
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.
@@ -159,6 +165,10 @@ class H5_DLLCPP CommonFG {
// Noop destructor.
virtual ~CommonFG();
+
+ protected:
+ virtual void p_setId(const hid_t new_id) = 0;
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
}; // end of CommonFG declaration
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index 191f004..393aafc 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -227,7 +227,8 @@ hid_t CompType::p_get_member_type(unsigned member_num) const
DataType CompType::getMemberDataType( unsigned member_num ) const
{
try {
- DataType datatype(p_get_member_type(member_num));
+ DataType datatype;
+ f_DataType_setId(&datatype, p_get_member_type(member_num));
return(datatype);
}
catch (DataTypeIException E) {
@@ -248,6 +249,7 @@ 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) {
@@ -268,6 +270,7 @@ 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));
return(comptype);
}
catch (DataTypeIException E) {
@@ -288,6 +291,7 @@ 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));
return(enumtype);
}
catch (DataTypeIException E) {
@@ -308,6 +312,7 @@ 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));
return(inttype);
}
catch (DataTypeIException E) {
@@ -328,6 +333,7 @@ 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));
return(floatype);
}
catch (DataTypeIException E) {
@@ -348,6 +354,7 @@ 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));
return(strtype);
}
catch (DataTypeIException E) {
@@ -368,6 +375,7 @@ 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));
return(varlentype);
}
catch (DataTypeIException E) {
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 6728264..717ef88 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -52,7 +52,7 @@ namespace H5 {
///\brief Default constructor: creates a stub DataSet.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSet::DataSet() : AbstractDs(), H5Object(), id(H5I_INVALID_HID) {}
+DataSet::DataSet() : H5Object(), AbstractDs(), id(H5I_INVALID_HID) {}
//--------------------------------------------------------------------------
// Function: DataSet overloaded constructor
@@ -60,9 +60,10 @@ DataSet::DataSet() : AbstractDs(), H5Object(), id(H5I_INVALID_HID) {}
///\param existing_id - IN: Id of an existing dataset
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSet::DataSet(const hid_t existing_id) : AbstractDs(), H5Object()
+DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs()
{
id = existing_id;
+ incRefCount(); // increment number of references to this id
}
//--------------------------------------------------------------------------
@@ -71,7 +72,7 @@ DataSet::DataSet(const hid_t existing_id) : AbstractDs(), H5Object()
///\param original - IN: DataSet instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSet::DataSet(const DataSet& original) : AbstractDs(original), H5Object(original)
+DataSet::DataSet(const DataSet& original) : H5Object(), AbstractDs()
{
id = original.getId();
incRefCount(); // increment number of references to this id
@@ -95,7 +96,7 @@ DataSet::DataSet(const DataSet& original) : AbstractDs(original), H5Object(origi
// Jul, 2008
// Added for application convenience.
//--------------------------------------------------------------------------
-DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object(), id(H5I_INVALID_HID)
+DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereferenced");
}
@@ -114,7 +115,7 @@ DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, co
// Jul, 2008
// Added for application convenience.
//--------------------------------------------------------------------------
-DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : AbstractDs(), H5Object(), id(H5I_INVALID_HID)
+DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference");
}
@@ -137,7 +138,8 @@ DataSpace DataSet::getSpace() const
throw DataSetIException("DataSet::getSpace", "H5Dget_space failed");
}
//create dataspace object using the existing id then return the object
- DataSpace data_space( dataspace_id );
+ DataSpace data_space;
+ f_DataSpace_setId(&data_space, dataspace_id);
return( data_space );
}
@@ -170,8 +172,8 @@ DSetCreatPropList DataSet::getCreatePlist() const
throw DataSetIException("DataSet::getCreatePlist", "H5Dget_create_plist failed");
}
// create and return the DSetCreatPropList object
- DSetCreatPropList create_plist( create_plist_id );
- return( create_plist );
+ DSetCreatPropList create_plist(create_plist_id); // ok to use existing id const
+ return(create_plist);
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5DataSet.h b/c++/src/H5DataSet.h
index 529466a..b2544a2 100644
--- a/c++/src/H5DataSet.h
+++ b/c++/src/H5DataSet.h
@@ -30,6 +30,7 @@ namespace H5 {
*/
class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
public:
+
// Close this dataset.
virtual void close();
@@ -125,6 +126,10 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
// 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);
+
};
#ifndef H5_NO_NAMESPACE
}
diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp
index 20b4e5e..d9c262d 100644
--- a/c++/src/H5DataSpace.cpp
+++ b/c++/src/H5DataSpace.cpp
@@ -85,6 +85,7 @@ DataSpace::DataSpace( int rank, const hsize_t * dims, const hsize_t * maxdims) :
DataSpace::DataSpace(const hid_t existing_id) : IdComponent()
{
id = existing_id;
+ incRefCount(); // increment number of references to this id
}
//--------------------------------------------------------------------------
@@ -93,7 +94,7 @@ DataSpace::DataSpace(const hid_t existing_id) : IdComponent()
///\param original - IN: DataSpace object to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataSpace::DataSpace(const DataSpace& original) : IdComponent(original)
+DataSpace::DataSpace(const DataSpace& original) : IdComponent()
{
id = original.getId();
incRefCount(); // increment number of references to this id
diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h
index b007fd0..a43cecd 100644
--- a/c++/src/H5DataSpace.h
+++ b/c++/src/H5DataSpace.h
@@ -129,6 +129,9 @@ class H5_DLLCPP DataSpace : public IdComponent {
private:
hid_t id; // HDF5 dataspace id
+
+ // Friend function to set DataSpace id. For library use only.
+ friend void f_DataSpace_setId(DataSpace *dspace, hid_t new_id);
};
#ifndef H5_NO_NAMESPACE
}
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index a435b4e..cdcd1e6 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -71,6 +71,7 @@ DataType::DataType() : H5Object(), id(H5I_INVALID_HID) {}
DataType::DataType(const hid_t existing_id) : H5Object()
{
id = existing_id;
+ incRefCount(); // increment number of references to this id
}
//--------------------------------------------------------------------------
@@ -105,7 +106,7 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object()
// Jul, 2008
// Added for application convenience.
//--------------------------------------------------------------------------
-DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID)
+DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object()
{
id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference");
}
@@ -134,13 +135,34 @@ DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type,
///\brief Copy constructor: makes a copy of the original DataType object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-DataType::DataType(const DataType& original) : H5Object(original)
+DataType::DataType(const DataType& original) : H5Object()
{
id = original.getId();
incRefCount(); // increment number of references to this id
}
//--------------------------------------------------------------------------
+// Function: DataType 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
+// 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
+//--------------------------------------------------------------------------
+DataType::DataType(const PredType& pred_type) : H5Object()
+{
+ // call C routine to copy the datatype
+ id = H5Tcopy( pred_type.getId() );
+ if (id < 0)
+ throw DataTypeIException("DataType constructor", "H5Tcopy failed");
+}
+
+//--------------------------------------------------------------------------
// Function: DataType::copy
///\brief Copies an existing datatype to this datatype object
///\param like_type - IN: Datatype to be copied
@@ -203,11 +225,22 @@ void DataType::copy(const DataSet& dset)
// 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
//--------------------------------------------------------------------------
DataType& DataType::operator=( const DataType& rhs )
{
if (this != &rhs)
- copy(rhs);
+ {
+ id = rhs.id;
+ incRefCount(); // increment number of references to this id
+ }
return(*this);
}
@@ -463,8 +496,9 @@ DataType DataType::getSuper() const
// the base type, otherwise, raise exception
if( base_type_id > 0 )
{
- DataType base_type( base_type_id );
- return( base_type );
+ DataType base_type;
+ base_type.p_setId(base_type_id);
+ return(base_type);
}
else
{
diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h
index 064bfe1..6c8a312 100644
--- a/c++/src/H5DataType.h
+++ b/c++/src/H5DataType.h
@@ -36,6 +36,9 @@ class H5_DLLCPP DataType : public H5Object {
// 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 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);
@@ -133,6 +136,9 @@ class H5_DLLCPP DataType : public H5Object {
#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);
+
void p_commit(hid_t loc_id, const char* name);
};
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp
index f153c92..fb1e42e 100644
--- a/c++/src/H5Exception.cpp
+++ b/c++/src/H5Exception.cpp
@@ -35,11 +35,11 @@ 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_name - IN: Name of the function where failure occurs
+///\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_name, const H5std_string& message) : detail_message(message), func_name(func_name) {}
+Exception::Exception(const H5std_string& func, const H5std_string& message) : detail_message(message), func_name(func) {}
//--------------------------------------------------------------------------
// Function: Exception copy constructor
@@ -350,10 +350,10 @@ 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_name - IN: Name of the function where failure occurs
+///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-FileIException::FileIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
+FileIException::FileIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
// Function: FileIException destructor
///\brief Noop destructor.
@@ -373,10 +373,10 @@ 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_name - IN: Name of the function where failure occurs
+///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-GroupIException::GroupIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
+GroupIException::GroupIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
// Function: GroupIException destructor
///\brief Noop destructor.
@@ -396,10 +396,10 @@ 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_name - IN: Name of the function where failure occurs
+///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-DataSpaceIException::DataSpaceIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
+DataSpaceIException::DataSpaceIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
// Function: DataSpaceIException destructor
///\brief Noop destructor.
@@ -419,10 +419,10 @@ 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_name - IN: Name of the function where failure occurs
+///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-DataTypeIException::DataTypeIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
+DataTypeIException::DataTypeIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
// Function: DataTypeIException destructor
///\brief Noop destructor.
@@ -442,10 +442,10 @@ 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_name - IN: Name of the function where failure occurs
+///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-PropListIException::PropListIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
+PropListIException::PropListIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
// Function: PropListIException destructor
///\brief Noop destructor.
@@ -465,10 +465,10 @@ 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_name - IN: Name of the function where failure occurs
+///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-DataSetIException::DataSetIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
+DataSetIException::DataSetIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
// Function: DataSetIException destructor
///\brief Noop destructor.
@@ -488,10 +488,10 @@ 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_name - IN: Name of the function where failure occurs
+///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-AttributeIException::AttributeIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
+AttributeIException::AttributeIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
// Function: AttributeIException destructor
///\brief Noop destructor.
@@ -511,10 +511,10 @@ 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_name - IN: Name of the function where failure occurs
+///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-ReferenceException::ReferenceException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
+ReferenceException::ReferenceException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
// Function: ReferenceException destructor
///\brief Noop destructor.
@@ -534,10 +534,10 @@ 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_name - IN: Name of the function where failure occurs
+///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-LibraryIException::LibraryIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
+LibraryIException::LibraryIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
// Function: LibraryIException destructor
///\brief Noop destructor.
@@ -557,10 +557,10 @@ 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_name - IN: Name of the function where failure occurs
+///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-LocationException::LocationException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
+LocationException::LocationException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
// Function: LocationException destructor
///\brief Noop destructor.
@@ -580,10 +580,10 @@ 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_name - IN: Name of the function where failure occurs
+///\param func - IN: Name of the function where failure occurs
///\param message - IN: Message on the failure
//--------------------------------------------------------------------------
-IdComponentException::IdComponentException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
+IdComponentException::IdComponentException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
//--------------------------------------------------------------------------
// Function: IdComponentException destructor
///\brief Noop destructor.
diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp
index 5696742..5ce9d8e 100644
--- a/c++/src/H5FaccProp.cpp
+++ b/c++/src/H5FaccProp.cpp
@@ -40,10 +40,10 @@ FileAccPropList::FileAccPropList() : PropList( H5P_FILE_ACCESS ) {}
//--------------------------------------------------------------------------
// Function: FileAccPropList copy constructor
///\brief Copy Constructor: makes a copy of the original
-/// FileAccPropList object.
+///\param original - IN: FileAccPropList instance to copy
// Programmer: Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-FileAccPropList::FileAccPropList(const FileAccPropList& orig) : PropList(orig) {}
+FileAccPropList::FileAccPropList(const FileAccPropList& original) : PropList(original) {}
//--------------------------------------------------------------------------
// Function: FileAccPropList overloaded constructor
@@ -664,6 +664,67 @@ unsigned FileAccPropList::getGcReferences() const
}
//--------------------------------------------------------------------------
+// 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_high are as follows:
+/// \li \c H5F_LIBVER_18
+/// \li \c H5F_LIBVER_LATEST (Default)
+///
+/// For more details, please refer to
+/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetLibverBounds
+// 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");
+ }
+}
+
+//--------------------------------------------------------------------------
+// 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
+///
+/// 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 )
+ {
+ throw PropListIException("FileAccPropList::getLibverBounds", "H5Pget_libver_bounds failed");
+ }
+}
+
+//--------------------------------------------------------------------------
// Function: FileAccPropList destructor
///\brief Noop destructor
// Programmer Binh-Minh Ribler - 2000
diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h
index 861ac4c..fddc446 100644
--- a/c++/src/H5FaccProp.h
+++ b/c++/src/H5FaccProp.h
@@ -126,6 +126,13 @@ class H5_DLLCPP FileAccPropList : public PropList {
// 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;
+
+ // 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"); }
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 45e08b2..84e7827 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -50,7 +50,7 @@ namespace H5 {
///\brief Default constructor: creates a stub H5File object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-H5File::H5File() : H5Location(), id(H5I_INVALID_HID) {}
+H5File::H5File() : H5Location(), CommonFG(), id(H5I_INVALID_HID) {}
//--------------------------------------------------------------------------
// Function: H5File overloaded constructor
@@ -73,9 +73,6 @@ H5File::H5File() : H5Location(), id(H5I_INVALID_HID) {}
/// exists, and fail, otherwise
/// \li \c H5F_ACC_RDWR - Open file for read/write, if it already
/// exists, and fail, otherwise
-/// \li \c H5F_ACC_DEBUG - print debug information. This flag is
-/// used only by HDF5 library developers; it is neither
-/// tested nor supported for use in applications.
///\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
@@ -86,7 +83,7 @@ H5File::H5File() : H5Location(), id(H5I_INVALID_HID) {}
// 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 ) : H5Location(), id(H5I_INVALID_HID)
+H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), CommonFG(), id(H5I_INVALID_HID)
{
try {
p_get_file(name, flags, create_plist, access_plist);
@@ -111,7 +108,7 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c
// 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 ) : H5Location(), id(H5I_INVALID_HID)
+H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(), CommonFG(), id(H5I_INVALID_HID)
{
try {
p_get_file(name.c_str(), flags, create_plist, access_plist);
@@ -133,38 +130,57 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro
{
// These bits only set for creation, so if any of them are set,
// create the file.
- if( flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC|H5F_ACC_DEBUG))
+ 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
- {
- throw FileIException("H5File constructor", "H5Fcreate failed");
- }
+ 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
+ {
+ throw FileIException("H5File constructor", "H5Fcreate failed");
+ }
}
// Open the file if none of the bits above are set.
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
- {
- throw FileIException("H5File constructor", "H5Fopen failed");
- }
+ 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
+ {
+ throw FileIException("H5File constructor", "H5Fopen failed");
+ }
}
}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
+// 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)
+//--------------------------------------------------------------------------
+H5File::H5File(hid_t existing_id) : H5Location(), CommonFG()
+{
+ id = existing_id;
+ incRefCount(); // increment number of references to this id
+}
+
+//--------------------------------------------------------------------------
// 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) : H5Location(original)
+H5File::H5File(const H5File& original) : H5Location(), CommonFG()
{
id = original.getId();
incRefCount(); // increment number of references to this id
@@ -225,6 +241,13 @@ bool H5File::isHdf5(const H5std_string& name )
//--------------------------------------------------------------------------
void H5File::openFile(const char* name, unsigned int flags, const FileAccPropList& access_plist)
{
+ try {
+ close();
+ }
+ catch (Exception close_error) {
+ throw FileIException("H5File::openFile", close_error.getDetailMsg());
+ }
+
hid_t access_plist_id = access_plist.getId();
id = H5Fopen (name, flags, access_plist_id);
if (id < 0) // throw an exception when open fails
@@ -379,25 +402,6 @@ ssize_t H5File::getObjCount(unsigned types) const
}
//--------------------------------------------------------------------------
-// Function: H5File::getObjCount
-///\brief This is an overloaded member function, provided for convenience.
-/// It takes no parameter and returns the object count of all
-/// object types.
-///\return Number of opened object IDs
-///\exception H5::FileIException
-// Programmer Binh-Minh Ribler - May 2004
-//--------------------------------------------------------------------------
-ssize_t H5File::getObjCount() const
-{
- ssize_t num_objs = H5Fget_obj_count(id, H5F_OBJ_ALL);
- 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.
diff --git a/c++/src/H5File.h b/c++/src/H5File.h
index 0ef85b5..939ac8e 100644
--- a/c++/src/H5File.h
+++ b/c++/src/H5File.h
@@ -59,8 +59,7 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG {
// Returns the number of opened object IDs (files, datasets, groups
// and datatypes) in the same file.
- ssize_t getObjCount(unsigned types) const;
- ssize_t getObjCount() const;
+ 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.
@@ -84,6 +83,10 @@ class H5_DLLCPP H5File : public H5Location, public CommonFG {
// Gets the file id
virtual hid_t getLocId() const;
+ // 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.
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index cad5e29..4d1d61c 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -51,7 +51,7 @@ namespace H5 {
///\brief Default constructor: creates a stub Group.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group::Group() : H5Object(), id(H5I_INVALID_HID) {}
+Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) {}
//--------------------------------------------------------------------------
// Function: Group copy constructor
@@ -59,7 +59,7 @@ Group::Group() : H5Object(), id(H5I_INVALID_HID) {}
///\param original - IN: Original group to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group::Group(const Group& original) : H5Object(original)
+Group::Group(const Group& original) : H5Object(), CommonFG()
{
id = original.getId();
incRefCount(); // increment number of references to this id
@@ -82,9 +82,10 @@ hid_t Group::getLocId() const
///\param existing_id - IN: Id of an existing group
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-Group::Group(const hid_t existing_id) : H5Object()
+Group::Group(const hid_t existing_id) : H5Object(), CommonFG()
{
id = existing_id;
+ incRefCount(); // increment number of references to this id
}
//--------------------------------------------------------------------------
@@ -100,7 +101,7 @@ Group::Group(const hid_t existing_id) : H5Object()
/// 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(), id(H5I_INVALID_HID)
+Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), CommonFG(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference");
}
@@ -115,7 +116,7 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const
///\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)
+Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), CommonFG(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference");
}
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index 4a9dcac..c01d41e 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -37,16 +37,33 @@ namespace H5 {
///\param h5_id - IN: Id of an existing object
///\exception H5::DataTypeIException
// 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
+// removal does not raise any problems in 1.10, it will be removed from 1.8 in
+// subsequent releases.
//--------------------------------------------------------------------------
IdComponent::IdComponent(const hid_t h5_id) {}
+//void IdComponent::p_setId(const hid_t new_id)
+//{
+ //p_setId(new_id);
+//}
+
//--------------------------------------------------------------------------
// Function: IdComponent copy constructor
-///\brief Copy constructor: makes a copy of the original IdComponent object.
-///\param original - IN: IdComponent instance to copy
+// Purpose: This noop copy constructor is removed as a result of the data
+// member "id" being moved down to sub-classes. (Mar 2015)
+// Parameters: original - IN: IdComponent 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
+// a noop and it can be generated by the compiler if needed.
//--------------------------------------------------------------------------
-IdComponent::IdComponent( const IdComponent& original ) {}
+// IdComponent::IdComponent(const IdComponent& original) {}
//--------------------------------------------------------------------------
// Function: IdComponent::incRefCount
@@ -82,12 +99,14 @@ 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");
+ }
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h
index 3208a39..068fb74 100644
--- a/c++/src/H5IdComponent.h
+++ b/c++/src/H5IdComponent.h
@@ -60,11 +60,18 @@ class H5_DLLCPP IdComponent {
// 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.
+
// Creates an object to hold an HDF5 identifier.
IdComponent( const hid_t h5_id );
// Copy constructor: makes copy of the original IdComponent object.
- IdComponent( const IdComponent& original );
+ // IdComponent( const IdComponent& original );
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Pure virtual function for there are various H5*close for the
@@ -97,6 +104,7 @@ class H5_DLLCPP IdComponent {
// 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;
+ //virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/c++/src/H5Include.h b/c++/src/H5Include.h
index 87cb182..1e0e952 100644
--- a/c++/src/H5Include.h
+++ b/c++/src/H5Include.h
@@ -28,3 +28,15 @@ typedef int bool;
const bool false = 0;
const bool true = 1;
#endif
+
+// These are defined in H5Opkg.h, which should not be included in the C++ API,
+// so re-define them here for now.
+
+/* Initial version of the object header format */
+#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
+
diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h
index 95fa642..e28f5c2 100644
--- a/c++/src/H5IntType.h
+++ b/c++/src/H5IntType.h
@@ -24,7 +24,7 @@ namespace H5 {
//! Class IntType operates on HDF5 integer datatype.
class H5_DLLCPP IntType : public AtomType {
public:
- // Creates a integer type using a predefined type
+ // Creates an integer type using a predefined type
IntType(const PredType& pred_type);
// Gets the integer datatype of the specified dataset
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index cd733c4..5100e12 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -70,17 +70,28 @@ H5Location::H5Location() : IdComponent() {}
// 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
+// removal does not raise any problems in 1.10, it will be removed from 1.8 in
+// subsequent releases.
//--------------------------------------------------------------------------
-H5Location::H5Location(const hid_t object_id) : IdComponent(object_id) {}
+H5Location::H5Location(const hid_t object_id) : IdComponent() {}
//--------------------------------------------------------------------------
// Function: H5Location copy constructor
-///\brief Copy constructor: makes a copy of the original H5Location
-/// instance.
+// 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
+// been moved to the sub-classes. It is removed from 1.8.15 because it is
+// a noop and it can be generated by the compiler if needed.
//--------------------------------------------------------------------------
-H5Location::H5Location( const H5Location& original ) : IdComponent( original ) {}
+// H5Location::H5Location(const H5Location& original) : IdComponent() {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -115,8 +126,9 @@ Attribute H5Location::createAttribute( const char* name, const DataType& data_ty
// If the attribute id is valid, create and return the Attribute object
if( attr_id > 0 )
{
- Attribute attr( attr_id );
- return( attr );
+ Attribute attr;
+ f_Attribute_setId(&attr, attr_id);
+ return( attr );
}
else
throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed");
@@ -147,8 +159,9 @@ Attribute H5Location::openAttribute( const char* name ) const
hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT);
if( attr_id > 0 )
{
- Attribute attr( attr_id );
- return( attr );
+ Attribute attr;
+ f_Attribute_setId(&attr, attr_id);
+ return( attr );
}
else
{
@@ -182,12 +195,13 @@ Attribute H5Location::openAttribute( const unsigned int idx ) const
H5_ITER_INC, (hsize_t)idx, H5P_DEFAULT, H5P_DEFAULT);
if( attr_id > 0 )
{
- Attribute attr( attr_id );
- return( attr );
+ Attribute attr;
+ f_Attribute_setId(&attr, attr_id);
+ return(attr);
}
else
{
- throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed");
+ throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed");
}
}
@@ -893,6 +907,12 @@ H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const
///\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
//--------------------------------------------------------------------------
DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const
{
@@ -902,8 +922,9 @@ DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const
throw ReferenceException(inMemFunc("getRegion"), "H5Rget_region failed");
}
try {
- DataSpace dataspace(space_id);
- return(dataspace);
+ DataSpace dataspace;
+ f_DataSpace_setId(&dataspace, space_id);
+ return(dataspace);
}
catch (DataSpaceIException E) {
throw ReferenceException(inMemFunc("getRegion"), E.getDetailMsg());
@@ -918,6 +939,36 @@ DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const
//--------------------------------------------------------------------------
H5Location::~H5Location() {}
+//--------------------------------------------------------------------------
+// Function: f_Attribute_setId - friend
+// Purpose: This function is friend to class H5::Attribute so that it
+// can set Attribute::id in order to work around a problem
+// described in the JIRA issue HDFFV-7947.
+// Applications shouldn't need to use it.
+// param attr - IN/OUT: Attribute object to be changed
+// param new_id - IN: New id to set
+// Programmer Binh-Minh Ribler - 2015
+//--------------------------------------------------------------------------
+void f_Attribute_setId(Attribute* attr, hid_t new_id)
+{
+ attr->id = new_id;
+}
+
+//--------------------------------------------------------------------------
+// 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)
+{
+ dspace->id = new_id;
+}
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
#ifndef H5_NO_NAMESPACE
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index e015825..79a8d5c 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -138,13 +138,21 @@ class H5_DLLCPP H5Location : public IdComponent {
// Default constructor
H5Location();
+#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.
+
// Creates a copy of an existing object giving the location id.
H5Location(const hid_t loc_id);
// Copy constructor.
- H5Location(const H5Location& original);
+ // H5Location(const H5Location& original);
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
// 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;
@@ -159,6 +167,10 @@ class H5_DLLCPP H5Location : public IdComponent {
// 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) = 0;
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
// Noop destructor.
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 94b03ab..df3f565 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -50,8 +50,26 @@ H5Object::H5Object() : H5Location() {}
// 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
+// removal does not raise any problems in 1.10, it will be removed from 1.8 in
+// subsequent releases.
//--------------------------------------------------------------------------
-H5Object::H5Object( const hid_t object_id ) : H5Location( object_id ) {}
+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
+// *** 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
+// a noop and it can be generated by the compiler if needed.
+//--------------------------------------------------------------------------
+// H5Object::H5Object(const H5Object& original) : H5Location() {}
//--------------------------------------------------------------------------
// Function: getObjName
@@ -165,15 +183,6 @@ ssize_t H5Object::getObjName(H5std_string& obj_name, size_t len) const
}
//--------------------------------------------------------------------------
-// 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
-//--------------------------------------------------------------------------
-H5Object::H5Object( const H5Object& original ) : H5Location( original ) {}
-
-//--------------------------------------------------------------------------
// Function: H5Object destructor
///\brief Noop destructor.
// Programmer Binh-Minh Ribler - 2000
diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h
index 5576d13..f8ac792 100644
--- a/c++/src/H5Object.h
+++ b/c++/src/H5Object.h
@@ -47,9 +47,6 @@ namespace H5 {
class H5_DLLCPP H5Object : public H5Location {
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Copy constructor: makes copy of an H5Object object.
- H5Object(const H5Object& original);
-
// Gets the name of this HDF5 object, i.e., Group, DataSet, or
// DataType.
ssize_t getObjName(char *obj_name, size_t buf_size = 0) const;
@@ -63,9 +60,19 @@ class H5_DLLCPP H5Object : public H5Location {
// 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.
+
// 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);
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
}; /* end class H5Object */
diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp
index 5afe80f..70ec629 100644
--- a/c++/src/H5PropList.cpp
+++ b/c++/src/H5PropList.cpp
@@ -54,7 +54,7 @@ PropList::PropList() : IdComponent(), id(H5P_DEFAULT) {}
///\param original - IN: The original property list to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
-PropList::PropList(const PropList& original) : IdComponent(original)
+PropList::PropList(const PropList& original) : IdComponent()
{
id = original.getId();
incRefCount(); // increment number of references to this id
@@ -258,6 +258,7 @@ void PropList::p_setId(const hid_t new_id)
// reset object's id to the given id
id = new_id;
}
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h
index 40c597f..672b3db 100644
--- a/c++/src/H5VarLenType.h
+++ b/c++/src/H5VarLenType.h
@@ -40,7 +40,6 @@ class H5_DLLCPP VarLenType : public DataType {
// Noop destructor
virtual ~VarLenType();
- protected:
// Default constructor
VarLenType();
};
diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config
index f2caed2..4072c1b 100644
--- a/c++/src/cpp_doc_config
+++ b/c++/src/cpp_doc_config
@@ -38,7 +38,7 @@ PROJECT_NAME = "HDF5 C++ API"
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = 1.8.13
+PROJECT_NUMBER = HDF5 version 1.9.218 currently under development
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a