summaryrefslogtreecommitdiffstats
path: root/c++/src
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2016-12-27 03:53:47 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2016-12-27 03:53:47 (GMT)
commitb00962ac8694b14b74382f77d1cf849b93383fb5 (patch)
tree6833353ed1959b51e94a0228498bf3ce519670f9 /c++/src
parent96c28287935c50693e19d473537b4f58692a30f8 (diff)
parente05da1b533d5eb9527a5b67ba2683379f8e1e7ac (diff)
downloadhdf5-b00962ac8694b14b74382f77d1cf849b93383fb5.zip
hdf5-b00962ac8694b14b74382f77d1cf849b93383fb5.tar.gz
hdf5-b00962ac8694b14b74382f77d1cf849b93383fb5.tar.bz2
Merge pull request #209 in HDFFV/hdf5 from ~BMRIBLER/hdf5_bmr_cpp:develop to develop
- Replacing openXxxType with individual type constructors - Put back CommonFG - Removed overloaded constructors that take an Attribute where there is one that takes an H5Location * commit 'e05da1b533d5eb9527a5b67ba2683379f8e1e7ac': Description: Removed commented out code and fixed miscellaneous typos. Platforms tested: Linux/32 2.6 (jam) (very minor) Purpose: Improvement for HDFFV-10004 Description: When adding wrappers for H5Lexists, a new class, LinkAccPropList, was added to the C++ API, triggered complicated circular dependencies. Thus, some improvement was made to resolve the problems. - Replaced existing functions openXxxType with individual type constructors + Added individual XxxType constructors to replace the existing functions openXxxType because it's rather awkward to use these functions. + Moved openXxxType from H5Location back to CommonFG + Put back CommonFG as a baseclass of Group for openXxxType functions. + This replacement should improve usability and prevent the problem of circular dependencies. - Removed overloaded constructor that takes an Attribute when there is already one that takes H5Location because Attribute inherits from H5Location now. Platforms tested: Linux/32 2.6 (jam) Darwin (osx1010test) Linux/64 (platypus)
Diffstat (limited to 'c++/src')
-rw-r--r--c++/src/H5ArrayType.cpp36
-rw-r--r--c++/src/H5ArrayType.h4
-rw-r--r--c++/src/H5Attribute.cpp4
-rw-r--r--c++/src/H5CommonFG.cpp346
-rw-r--r--c++/src/H5CommonFG.h55
-rw-r--r--c++/src/H5CompType.cpp37
-rw-r--r--c++/src/H5CompType.h4
-rw-r--r--c++/src/H5Cpp.h1
-rw-r--r--c++/src/H5DataSet.cpp4
-rw-r--r--c++/src/H5DataType.cpp66
-rw-r--r--c++/src/H5DataType.h17
-rw-r--r--c++/src/H5DcreatProp.h3
-rw-r--r--c++/src/H5DxferProp.cpp2
-rw-r--r--c++/src/H5DxferProp.h3
-rw-r--r--c++/src/H5EnumType.cpp38
-rw-r--r--c++/src/H5EnumType.h4
-rw-r--r--c++/src/H5Exception.cpp24
-rw-r--r--c++/src/H5Exception.h8
-rw-r--r--c++/src/H5FaccProp.h3
-rw-r--r--c++/src/H5File.cpp1
-rw-r--r--c++/src/H5FloatType.cpp36
-rw-r--r--c++/src/H5FloatType.h4
-rw-r--r--c++/src/H5Group.cpp13
-rw-r--r--c++/src/H5Group.h4
-rw-r--r--c++/src/H5IdComponent.cpp2
-rw-r--r--c++/src/H5IntType.cpp36
-rw-r--r--c++/src/H5IntType.h4
-rw-r--r--c++/src/H5Library.cpp5
-rw-r--r--c++/src/H5Location.cpp383
-rw-r--r--c++/src/H5Location.h43
-rw-r--r--c++/src/H5Object.cpp18
-rw-r--r--c++/src/H5OcreatProp.cpp1
-rw-r--r--c++/src/H5PropList.cpp2
-rw-r--r--c++/src/H5StrType.cpp36
-rw-r--r--c++/src/H5StrType.h4
-rw-r--r--c++/src/H5VarLenType.cpp36
-rw-r--r--c++/src/H5VarLenType.h4
37 files changed, 867 insertions, 424 deletions
diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp
index 0bdd09c..46ac021 100644
--- a/c++/src/H5ArrayType.cpp
+++ b/c++/src/H5ArrayType.cpp
@@ -73,6 +73,42 @@ ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims)
}
//--------------------------------------------------------------------------
+// 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
+//--------------------------------------------------------------------------
+ArrayType::ArrayType(const H5Location& loc, const char *dtype_name) : DataType()
+{
+ 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
+// 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
+//--------------------------------------------------------------------------
+ArrayType::ArrayType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
+{
+ id = p_opentype(loc, dtype_name.c_str());
+}
+
+//--------------------------------------------------------------------------
// Function: ArrayType::operator=
///\brief Assignment operator
///\param rhs - IN: Reference to the existing array datatype
diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h
index 0e9ef46..65917ae 100644
--- a/c++/src/H5ArrayType.h
+++ b/c++/src/H5ArrayType.h
@@ -34,6 +34,10 @@ class H5_DLLCPP ArrayType : public DataType {
// 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);
+
// Returns the number of dimensions of this array datatype.
int getArrayNDims() const;
//int getArrayNDims(); // removed 1.8.18 and 1.10.1
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index 4daf174..c71c035 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -20,6 +20,7 @@
#endif
#include <string>
+#include "H5private.h" // for HDfree
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -33,10 +34,7 @@
#include "H5AbstractDs.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
-#include "H5Group.h"
-#include "H5File.h"
#include "H5Attribute.h"
-#include "H5private.h" // for HDfree
namespace H5 {
using std::cerr;
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index a1e0c3f..018d3a2 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -16,24 +16,20 @@
#include <string>
#include "H5Include.h"
+#include "H5private.h" // for HDstrcpy
#include "H5Exception.h"
#include "H5IdComponent.h"
+#include "H5DataSpace.h"
#include "H5PropList.h"
-#include "H5FaccProp.h"
-#include "H5FcreatProp.h"
-#include "H5OcreatProp.h"
#include "H5DxferProp.h"
+#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5Location.h"
#include "H5Object.h"
-#include "H5CommonFG.h"
-#include "H5Group.h"
+#include "H5Alltypes.h"
#include "H5AbstractDs.h"
-#include "H5DataSpace.h"
#include "H5DataSet.h"
-#include "H5File.h"
-#include "H5Alltypes.h"
-#include "H5private.h" // for HDstrcpy
+#include "H5CommonFG.h"
// There are a few comments that are common to most of the functions
// defined in this file so they are listed here.
@@ -43,28 +39,346 @@
// to call the right getId() - although, as the structure of the
// library at this time, getId() is basically the IdComponent::getId()
// - when a failure returned by the C API, the functions will call
-// throwwException, which is a pure virtual function and is implemented
+// throwException, which is a pure virtual function and is implemented
// by H5File to throw a FileIException and by Group to throw a
// GroupIException.
// December 2000
namespace H5 {
+using namespace std;
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
-// Function: CommonFG default constructor
-///\brief Default constructor.
+// 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
//--------------------------------------------------------------------------
-CommonFG::CommonFG() {}
+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);
+
+ // 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);
+}
+
+//--------------------------------------------------------------------------
+// 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
+{
+ 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
+//--------------------------------------------------------------------------
+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);
+}
+
+//--------------------------------------------------------------------------
+// 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
+{
+ 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
+//--------------------------------------------------------------------------
+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);
+}
+
+//--------------------------------------------------------------------------
+// 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
+{
+ 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
+//--------------------------------------------------------------------------
+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);
+}
+
+//--------------------------------------------------------------------------
+// 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
+{
+ 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
+//--------------------------------------------------------------------------
+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);
+}
+
+//--------------------------------------------------------------------------
+// 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
+{
+ 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
+//--------------------------------------------------------------------------
+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);
+}
+
+//--------------------------------------------------------------------------
+// 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
+{
+ 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
+//--------------------------------------------------------------------------
+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);
+}
//--------------------------------------------------------------------------
-// Function: CommonFG destructor
-///\brief Noop destructor.
+// 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
+{
+ 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
+//--------------------------------------------------------------------------
+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);
+}
+
+//--------------------------------------------------------------------------
+// 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
+{
+ return( openVarLenType( name.c_str()) );
+}
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+//--------------------------------------------------------------------------
+// Function: CommonFG default constructor
+///\brief Default constructor.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+CommonFG::CommonFG() {}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG destructor
+///\brief Noop destructor.
+// 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->p_setId(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->p_setId(new_id);
+}
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
}
diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h
index a68d586..59f425c 100644
--- a/c++/src/H5CommonFG.h
+++ b/c++/src/H5CommonFG.h
@@ -19,16 +19,60 @@
namespace H5 {
+// Class forwarding
+class Group;
+class H5File;
+class ArrayType;
+class VarLenType;
+
/*! \class CommonFG
- \brief \a CommonFG was an abstract base class of H5File and H5Group.
+ \brief \a CommonFG is an abstract base class of H5File and H5Group.
- It provided common operations of H5File and H5Group.
- In release 1.10.1, the class structure is modified.
- As a result, member functions of CommonFG are moved to Group.
+ It provides common operations of H5File and H5Group.
*/
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 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 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 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 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 throw appropriate exception.
+ virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0;
+
// Default constructor.
CommonFG();
@@ -41,6 +85,9 @@ class H5_DLLCPP CommonFG {
#endif // DOXYGEN_SHOULD_SKIP_THIS
}; // end of CommonFG declaration
+
+#ifndef H5_NO_NAMESPACE
}
+#endif
#endif // __CommonFG_H
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index 784d171..0562e75 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -28,7 +28,6 @@
#include "H5AbstractDs.h"
#include "H5DataSpace.h"
#include "H5DataSet.h"
-#include "H5private.h"
namespace H5 {
@@ -88,6 +87,42 @@ CompType::CompType( const DataSet& dataset ) : DataType()
}
//--------------------------------------------------------------------------
+// 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
+//--------------------------------------------------------------------------
+CompType::CompType(const H5Location& loc, const char *dtype_name) : DataType()
+{
+ 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
+// 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
+//--------------------------------------------------------------------------
+CompType::CompType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
+{
+ 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
diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h
index 6552f9e..3337df7 100644
--- a/c++/src/H5CompType.h
+++ b/c++/src/H5CompType.h
@@ -42,6 +42,10 @@ class H5_DLLCPP CompType : public DataType {
// 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);
+
// 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
diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h
index 800eb90..90f0a2a 100644
--- a/c++/src/H5Cpp.h
+++ b/c++/src/H5Cpp.h
@@ -42,6 +42,7 @@
#include "H5ArrayType.h"
#include "H5VarLenType.h"
#include "H5DataSet.h"
+#include "H5CommonFG.h"
#include "H5Group.h"
#include "H5File.h"
#include "H5Library.h"
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 749a933..d3bf017 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -20,6 +20,7 @@
#endif
#include <string>
+#include "H5private.h" // for HDfree
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -34,11 +35,8 @@
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
-#include "H5Group.h"
-#include "H5File.h"
#include "H5Attribute.h"
#include "H5DataSet.h"
-#include "H5private.h" // for HDfree
namespace H5 {
using std::cerr;
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index 7dcd343..3955ebf 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -23,13 +23,13 @@
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
+#include "H5DataSpace.h"
#include "H5PropList.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
-#include "H5DataSpace.h"
#include "H5Location.h"
#include "H5Object.h"
#include "H5DataType.h"
@@ -38,8 +38,6 @@
#include "H5private.h"
#include "H5AbstractDs.h"
#include "H5DataSet.h"
-#include "H5Group.h"
-#include "H5File.h"
#include "H5Attribute.h"
namespace H5 {
@@ -122,10 +120,11 @@ DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type,
// 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)
+ /* DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference");
}
+ */
//--------------------------------------------------------------------------
// Function: DataType copy constructor
@@ -152,13 +151,49 @@ DataType::DataType(const DataType& original) : H5Object(), id(original.id)
//--------------------------------------------------------------------------
DataType::DataType(const PredType& pred_type) : H5Object()
{
- // call C routine to copy the datatype
+ // Call C routine to copy the datatype
id = H5Tcopy( pred_type.getId() );
if (id < 0)
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*.
+///\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
+//--------------------------------------------------------------------------
+DataType::DataType(const H5Location& loc, const char *dtype_name) : H5Object()
+{
+ id = p_opentype(loc, dtype_name);
+}
+
+//--------------------------------------------------------------------------
+// Function: DataType overloaded constructor
+///\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
+//--------------------------------------------------------------------------
+DataType::DataType(const H5Location& loc, const H5std_string& dtype_name) : H5Object()
+{
+ id = p_opentype(loc, dtype_name.c_str());
+}
+
+//--------------------------------------------------------------------------
// Function: DataType::copy
///\brief Copies an existing datatype to this datatype object
///\param like_type - IN: Datatype to be copied
@@ -264,6 +299,27 @@ bool DataType::operator==(const DataType& compared_type ) const
}
//--------------------------------------------------------------------------
+// Function: DataType::p_opentype (private)
+///\brief Opens an HDF5 datatype given its name
+///\param dtype_name - IN: Datatype name
+///\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
+//--------------------------------------------------------------------------
+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");
+ return(ret_value);
+}
+
+//--------------------------------------------------------------------------
// Function: DataType::p_commit (private)
//\brief Commits a transient datatype to a file, creating a new
// named datatype
diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h
index 9ac6ecf..4e904a6 100644
--- a/c++/src/H5DataType.h
+++ b/c++/src/H5DataType.h
@@ -14,9 +14,6 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-// Class DataType inherits from H5Object and has several subclasses for
-// specific HDF5 data types.
-
#ifndef __H5DataType_H
#define __H5DataType_H
@@ -44,7 +41,7 @@ class H5_DLLCPP DataType : public H5Object {
// 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);
+// 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();
@@ -62,6 +59,7 @@ class H5_DLLCPP DataType : public H5Object {
// 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);
@@ -118,6 +116,13 @@ class H5_DLLCPP DataType : public H5Object {
///\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);
+
+// End of From CommonFG then H5Location
+
// Creates a copy of an existing DataType using its id
DataType( const hid_t type_id );
@@ -136,6 +141,10 @@ class H5_DLLCPP DataType : public H5Object {
// 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;
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
private:
diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h
index 787d3ec..60ce1d5 100644
--- a/c++/src/H5DcreatProp.h
+++ b/c++/src/H5DcreatProp.h
@@ -14,9 +14,6 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-// Class DSetCreatPropList represents the HDF5 dataset creation property list
-// and inherits from PropList.
-
#ifndef __H5DSCreatPropList_H
#define __H5DSCreatPropList_H
diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp
index 7d9b943..8746d35 100644
--- a/c++/src/H5DxferProp.cpp
+++ b/c++/src/H5DxferProp.cpp
@@ -15,12 +15,12 @@
#include <string>
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5DxferProp.h"
-#include "H5private.h" // for HDmemset
namespace H5 {
diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h
index 81361cf..42194fb 100644
--- a/c++/src/H5DxferProp.h
+++ b/c++/src/H5DxferProp.h
@@ -14,9 +14,6 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-// Class DSetMemXferPropList represents the HDF5 dataset transfer property list
-// and inherits from PropList.
-
#ifndef __H5DSetMemXferPropList_H
#define __H5DSetMemXferPropList_H
diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp
index 2b614a9..a9f0b41 100644
--- a/c++/src/H5EnumType.cpp
+++ b/c++/src/H5EnumType.cpp
@@ -15,6 +15,7 @@
#include <string>
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -31,7 +32,6 @@
#include "H5AtomType.h"
#include "H5IntType.h"
#include "H5EnumType.h"
-#include "H5private.h" // for HDmemset
namespace H5 {
@@ -109,6 +109,42 @@ EnumType::EnumType( const IntType& data_type ) : DataType()
}
//--------------------------------------------------------------------------
+// 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
+//--------------------------------------------------------------------------
+EnumType::EnumType(const H5Location& loc, const char *dtype_name) : DataType()
+{
+ 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
+// 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
+//--------------------------------------------------------------------------
+EnumType::EnumType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
+{
+ 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
diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h
index 1f96552..054811b 100644
--- a/c++/src/H5EnumType.h
+++ b/c++/src/H5EnumType.h
@@ -38,6 +38,10 @@ class H5_DLLCPP EnumType : public DataType {
// 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);
+
// Returns the number of members in this enumeration datatype.
int getNmembers () const;
diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp
index 2e23587..9c383a2 100644
--- a/c++/src/H5Exception.cpp
+++ b/c++/src/H5Exception.cpp
@@ -424,6 +424,30 @@ DataTypeIException::DataTypeIException(const H5std_string& func, const H5std_str
//--------------------------------------------------------------------------
DataTypeIException::~DataTypeIException() throw() {}
+ /* //--------------------------------------------------------------------------
+// Subclass: ObjHeaderIException
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+// 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
+//--------------------------------------------------------------------------
+ObjHeaderIException::ObjHeaderIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
+//--------------------------------------------------------------------------
+// Function: ObjHeaderIException destructor
+///\brief Noop destructor.
+//--------------------------------------------------------------------------
+ObjHeaderIException::~ObjHeaderIException() throw() {}
+ */
+
//--------------------------------------------------------------------------
// Subclass: PropListIException
// Programmer Binh-Minh Ribler - 2000
diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h
index da9066a..81068f5 100644
--- a/c++/src/H5Exception.h
+++ b/c++/src/H5Exception.h
@@ -120,6 +120,14 @@ class H5_DLLCPP DataTypeIException : public Exception {
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();
+};
+ */
+
class H5_DLLCPP PropListIException : public Exception {
public:
PropListIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
diff --git a/c++/src/H5FaccProp.h b/c++/src/H5FaccProp.h
index a0605e0..aec5fcc 100644
--- a/c++/src/H5FaccProp.h
+++ b/c++/src/H5FaccProp.h
@@ -14,9 +14,6 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-// Class FileAccPropList represents the HDF5 file access property list and
-// inherits from DataType.
-
#ifndef __H5FileAccPropList_H
#define __H5FileAccPropList_H
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index ff897d7..79f5471 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -31,6 +31,7 @@
#include "H5DcreatProp.h"
#include "H5Location.h"
#include "H5Object.h"
+#include "H5CommonFG.h"
#include "H5Group.h"
#include "H5AbstractDs.h"
#include "H5DataSpace.h"
diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp
index 9ce06f7..abc382d 100644
--- a/c++/src/H5FloatType.cpp
+++ b/c++/src/H5FloatType.cpp
@@ -91,6 +91,42 @@ FloatType::FloatType( const DataSet& dataset ) : AtomType()
}
//--------------------------------------------------------------------------
+// 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
+//--------------------------------------------------------------------------
+FloatType::FloatType(const H5Location& loc, const char *dtype_name) : AtomType()
+{
+ id = p_opentype(loc, dtype_name);
+}
+
+//--------------------------------------------------------------------------
+// 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
+//--------------------------------------------------------------------------
+FloatType::FloatType(const H5Location& loc, const H5std_string& dtype_name) : AtomType()
+{
+ 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
diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h
index c0119eb..1f4b227 100644
--- a/c++/src/H5FloatType.h
+++ b/c++/src/H5FloatType.h
@@ -33,6 +33,10 @@ class H5_DLLCPP FloatType : public AtomType {
// 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);
+
// Retrieves the exponent bias of a floating-point type.
size_t getEbias() const;
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index 20f14a3..4325a68 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -34,11 +34,11 @@
#include "H5AbstractDs.h"
#include "H5DataSpace.h"
#include "H5DataSet.h"
+#include "H5CommonFG.h"
#include "H5Attribute.h"
#include "H5Group.h"
#include "H5File.h"
#include "H5Alltypes.h"
-#include "H5private.h" // for HDstrcpy
namespace H5 {
using std::cerr;
@@ -49,7 +49,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
@@ -57,7 +57,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(), id(original.id)
+Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id)
{
incRefCount(); // increment number of references to this id
}
@@ -84,7 +84,7 @@ 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(), id(existing_id)
+Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id)
{
incRefCount(); // increment number of references to this id
}
@@ -102,7 +102,7 @@ Group::Group(const hid_t existing_id) : H5Object(), id(existing_id)
/// 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");
}
@@ -117,10 +117,11 @@ 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(), id(H5I_INVALID_HID)
{
id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference");
}
+ */
//--------------------------------------------------------------------------
// Function: Group::getId
diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h
index 5f4b0f3..0a9e975 100644
--- a/c++/src/H5Group.h
+++ b/c++/src/H5Group.h
@@ -28,7 +28,7 @@ namespace H5 {
class ArrayType;
class VarLenType;
-class H5_DLLCPP Group : public H5Object {
+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);
@@ -52,7 +52,7 @@ class H5_DLLCPP Group : public H5Object {
// 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);
+// Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
// default constructor
Group();
diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp
index d869b07..f3d916a 100644
--- a/c++/src/H5IdComponent.cpp
+++ b/c++/src/H5IdComponent.cpp
@@ -15,12 +15,12 @@
#include <string>
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5Library.h"
#include "H5IdComponent.h"
#include "H5DataSpace.h"
-#include "H5private.h" // for HDmemset
namespace H5 {
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp
index 69fbedb..a60bcf3 100644
--- a/c++/src/H5IntType.cpp
+++ b/c++/src/H5IntType.cpp
@@ -90,6 +90,42 @@ IntType::IntType( const DataSet& dataset ) : AtomType()
}
//--------------------------------------------------------------------------
+// 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
+//--------------------------------------------------------------------------
+IntType::IntType(const H5Location& loc, const char *dtype_name) : AtomType()
+{
+ id = p_opentype(loc, dtype_name);
+}
+
+//--------------------------------------------------------------------------
+// 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
+//--------------------------------------------------------------------------
+IntType::IntType(const H5Location& loc, const H5std_string& dtype_name) : AtomType()
+{
+ id = p_opentype(loc, dtype_name.c_str());
+}
+
+//--------------------------------------------------------------------------
// Function: IntType::getSign
///\brief Retrieves the sign type for an integer type.
///\return Valid sign type
diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h
index 54c0d57..74786b9 100644
--- a/c++/src/H5IntType.h
+++ b/c++/src/H5IntType.h
@@ -33,6 +33,10 @@ class H5_DLLCPP IntType : public AtomType {
// 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);
+
// Retrieves the sign type for an integer type
H5T_sign_t getSign() const;
diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp
index 1726121..30be367 100644
--- a/c++/src/H5Library.cpp
+++ b/c++/src/H5Library.cpp
@@ -185,6 +185,11 @@ void H5Library::initH5cpp()
if (ret_value != 0)
throw LibraryIException("H5Library::initH5cpp", "Registrating PropList::deleteConstants failed");
+ /* ret_value = std::atexit(LinkAccPropList::deleteConstants);
+ if (ret_value != 0)
+ throw LibraryIException("H5Library::initH5cpp", "Registrating LinkAccPropList::deleteConstants failed");
+ */
+
ret_value = std::atexit(FileAccPropList::deleteConstants);
if (ret_value != 0)
throw LibraryIException("H5Library::initH5cpp", "Registrating FileAccPropList::deleteConstants failed");
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index cb4fd12..91de0f5 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -15,9 +15,11 @@
#include <string>
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
+#include "H5DataSpace.h"
#include "H5PropList.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
@@ -26,14 +28,12 @@
#include "H5DxferProp.h"
#include "H5Location.h"
#include "H5Object.h"
+#include "H5DataType.h"
#include "H5AbstractDs.h"
-#include "H5DataSpace.h"
#include "H5DataSet.h"
-#include "H5Attribute.h"
+#include "H5CommonFG.h"
#include "H5Group.h"
#include "H5File.h"
-#include "H5Alltypes.h"
-#include "H5private.h" // for HDmemset
namespace H5 {
@@ -76,6 +76,45 @@ 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
+// 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;
+ else if (ret_value == 0)
+ return false;
+ else // Raise exception when H5Lexists returns a negative value
+ {
+ throwException("exists", "H5Lexists failed");
+ }
+ return false; // warning: control reaches end of non-void function
+}
+ */
+
+ /* //--------------------------------------------------------------------------
+// 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
+{
+ return(exists(name.c_str(), lapl));
+}
+ */
+
//--------------------------------------------------------------------------
// Function: H5Location::flush
///\brief Flushes all buffers associated with a location to disk.
@@ -498,10 +537,11 @@ void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t
// May, 2008
// Corrected missing parameters. - BMR
//--------------------------------------------------------------------------
-void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist)
+ /* void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist)
{
p_setId(p_dereference(attr.getId(), ref, ref_type, plist, "dereference"));
}
+ */
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
@@ -1206,294 +1246,6 @@ void H5Location::unmount( const H5std_string& name ) const
unmount( name.c_str() );
}
-//--------------------------------------------------------------------------
-// Function: H5Location::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 H5Location::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(getId(), name, H5P_DEFAULT);
-
- // 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;
- f_DataType_setId(&data_type, type_id);
- return(data_type);
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::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 H5Location::openDataType( const H5std_string& name ) const
-{
- return( openDataType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::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 H5Location::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(getId(), 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: H5Location::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 H5Location::openArrayType( const H5std_string& name ) const
-{
- return( openArrayType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::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 H5Location::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(getId(), 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: H5Location::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 H5Location::openCompType( const H5std_string& name ) const
-{
- return( openCompType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::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 H5Location::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(getId(), 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: H5Location::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 H5Location::openEnumType( const H5std_string& name ) const
-{
- return( openEnumType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::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 H5Location::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(getId(), 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: H5Location::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 H5Location::openIntType( const H5std_string& name ) const
-{
- return( openIntType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::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 H5Location::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(getId(), 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: H5Location::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 H5Location::openFloatType( const H5std_string& name ) const
-{
- return( openFloatType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::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 H5Location::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(getId(), 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: H5Location::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 H5Location::openStrType( const H5std_string& name ) const
-{
- return( openStrType( name.c_str()) );
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::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 H5Location::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(getId(), 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: H5Location::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 H5Location::openVarLenType( const H5std_string& name ) const
-{
- return( openVarLenType( name.c_str()) );
-}
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
// Function: H5Location::iterateElems
@@ -1899,51 +1651,20 @@ void H5Location::throwException(const H5std_string& func_name, const H5std_strin
}
//--------------------------------------------------------------------------
-// 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
+// Function: f_DataSet_setId - friend
+// Modification:
+// Moved to H5CommonFG.cpp after the rearrangement of classes
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
-void f_DataType_setId(DataType* dtype, hid_t new_id)
-{
- dtype->p_setId(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->p_setId(new_id);
-}
// end of From H5CommonFG.cpp
//--------------------------------------------------------------------------
// 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
+// Modification:
+// Moved to H5Object.cpp after the rearrangement of classes
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
-void f_Attribute_setId(Attribute* attr, hid_t new_id)
-{
- attr->p_setId(new_id);
-}
//--------------------------------------------------------------------------
// Function: f_DataSpace_setId - friend
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index 647904b..795e7a7 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -33,9 +33,16 @@ namespace H5 {
*/
// Class forwarding
class H5_DLLCPP ArrayType;
+ /* class H5_DLLCPP LinkAccPropList; // remove when done
+ */
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;
+ */
+
// Flushes all buffers associated with this location to disk.
void flush( H5F_scope_t scope ) const;
@@ -81,7 +88,7 @@ class H5_DLLCPP H5Location : public IdComponent {
// 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);
+ //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;
@@ -172,38 +179,6 @@ class H5_DLLCPP H5Location : public IdComponent {
void move(const char* src, const char* dst) const;
void move(const H5std_string& src, const H5std_string& dst) 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 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 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 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;
-
// end From CommonFG
/// For subclasses, H5File and Group, to throw appropriate exception.
@@ -240,7 +215,7 @@ class H5_DLLCPP H5Location : public 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/H5Object.cpp b/c++/src/H5Object.cpp
index ab79d9d..d656ccf 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -15,6 +15,7 @@
#include <string>
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -29,11 +30,11 @@
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
+#include "H5CommonFG.h"
#include "H5Group.h"
#include "H5File.h"
#include "H5DataSet.h"
#include "H5Attribute.h"
-#include "H5private.h" // for HDmemset
namespace H5 {
@@ -86,6 +87,21 @@ H5Object::H5Object() : H5Location() {}
// H5Object::H5Object(const H5Object& original) : 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->p_setId(new_id);
+}
+
+//--------------------------------------------------------------------------
// Function: H5Object::createAttribute
///\brief Creates an attribute for a group, dataset, or named datatype.
///\param name - IN: Name of the attribute
diff --git a/c++/src/H5OcreatProp.cpp b/c++/src/H5OcreatProp.cpp
index 3cda945..397a96f 100644
--- a/c++/src/H5OcreatProp.cpp
+++ b/c++/src/H5OcreatProp.cpp
@@ -20,7 +20,6 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5OcreatProp.h"
-#include "H5FaccProp.h"
namespace H5 {
diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp
index b6f7c15..f0eb847 100644
--- a/c++/src/H5PropList.cpp
+++ b/c++/src/H5PropList.cpp
@@ -21,11 +21,11 @@
#include <string>
+#include "H5private.h" // for HDmemset
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
-#include "H5private.h" // for HDfree
namespace H5 {
diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp
index 962a5dc..ca0ad56 100644
--- a/c++/src/H5StrType.cpp
+++ b/c++/src/H5StrType.cpp
@@ -144,6 +144,42 @@ StrType::StrType( const DataSet& dataset ) : AtomType ()
}
//--------------------------------------------------------------------------
+// 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
+//--------------------------------------------------------------------------
+StrType::StrType(const H5Location& loc, const char *dtype_name) : AtomType()
+{
+ 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
+// 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
+//--------------------------------------------------------------------------
+StrType::StrType(const H5Location& loc, const H5std_string& dtype_name) : AtomType()
+{
+ 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:
diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h
index 5d223b3..b920a3b 100644
--- a/c++/src/H5StrType.h
+++ b/c++/src/H5StrType.h
@@ -39,6 +39,10 @@ class H5_DLLCPP StrType : public AtomType {
// Gets the string datatype of the specified 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);
+
// Retrieves the character set type of this string datatype.
H5T_cset_t getCset() const;
diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp
index fa3a18f..e14e1ce 100644
--- a/c++/src/H5VarLenType.cpp
+++ b/c++/src/H5VarLenType.cpp
@@ -72,6 +72,42 @@ VarLenType::VarLenType(const DataType* base_type) : DataType()
}
//--------------------------------------------------------------------------
+// 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
+//--------------------------------------------------------------------------
+VarLenType::VarLenType(const H5Location& loc, const char *dtype_name) : DataType()
+{
+ 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
+// 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
+//--------------------------------------------------------------------------
+VarLenType::VarLenType(const H5Location& loc, const H5std_string& dtype_name) : DataType()
+{
+ id = p_opentype(loc, dtype_name.c_str());
+}
+
+//--------------------------------------------------------------------------
// Function: VarLenType destructor
///\brief Properly terminates access to this datatype.
// Programmer Binh-Minh Ribler - May, 2004
diff --git a/c++/src/H5VarLenType.h b/c++/src/H5VarLenType.h
index d7141b0..af4f7b7 100644
--- a/c++/src/H5VarLenType.h
+++ b/c++/src/H5VarLenType.h
@@ -40,6 +40,10 @@ class H5_DLLCPP VarLenType : public DataType {
// 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);
+
// Noop destructor
virtual ~VarLenType();