summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2018-05-07 04:58:06 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2018-05-07 04:58:06 (GMT)
commit01b3b7bf479477c60f11dcbb101fcfd29becbdc1 (patch)
tree508729c465052bf56fb3ad4e752293bdba72aacf
parentc1e82e516fb6c8c7fe40be385ef09dd5502205f0 (diff)
downloadhdf5-01b3b7bf479477c60f11dcbb101fcfd29becbdc1.zip
hdf5-01b3b7bf479477c60f11dcbb101fcfd29becbdc1.tar.gz
hdf5-01b3b7bf479477c60f11dcbb101fcfd29becbdc1.tar.bz2
C++ API improvement
Description: - Added another argument, LinkCreatPropList& lcpl, to the CommonFG::createGroup() functions for the use of link creation property list. The new argument has a default value. Group createGroup(const char* name, size_t size_hint = 0, const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT) Group createGroup(const H5std_string& name, size_t size_hint = 0, const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT) - Removed memory leaks caused by accidentally invoking p_get_member_type (in H5CompType.cpp, user reported via email, maybe no jira issue) - Made H5Location::closeObjId static, so no object is needed to close an hdf5 id. - Added classes StrCreatPropList, LinkCreatPropList, AttrCreatPropList for the C property list classes H5P_STRING_CREATE, H5P_LINK_CREATE, and H5P_ATTRIBUTE_CREATE. Platforms tested: Linux/64 (jelly) Linux/64 (platypus) Darwin (osx1010test)
-rw-r--r--MANIFEST6
-rw-r--r--c++/src/CMakeLists.txt6
-rw-r--r--c++/src/H5AcreatProp.cpp113
-rw-r--r--c++/src/H5AcreatProp.h62
-rw-r--r--c++/src/H5ArrayType.cpp1
-rw-r--r--c++/src/H5CommonFG.cpp25
-rw-r--r--c++/src/H5CommonFG.h4
-rw-r--r--c++/src/H5CompType.cpp83
-rw-r--r--c++/src/H5Cpp.h4
-rw-r--r--c++/src/H5DxferProp.h2
-rw-r--r--c++/src/H5File.cpp4
-rw-r--r--c++/src/H5Group.cpp2
-rw-r--r--c++/src/H5LaccProp.h10
-rw-r--r--c++/src/H5LcreatProp.cpp113
-rw-r--r--c++/src/H5LcreatProp.h62
-rw-r--r--c++/src/H5Library.cpp11
-rw-r--r--c++/src/H5Location.cpp52
-rw-r--r--c++/src/H5Location.h4
-rw-r--r--c++/src/H5StrcreatProp.cpp58
-rw-r--r--c++/src/H5StrcreatProp.h57
-rw-r--r--c++/src/Makefile.am18
-rw-r--r--c++/src/Makefile.in24
-rw-r--r--c++/test/tfile.cpp27
-rw-r--r--c++/test/tobject.cpp6
24 files changed, 665 insertions, 89 deletions
diff --git a/MANIFEST b/MANIFEST
index 9ab8b46..76a40dc 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -345,6 +345,8 @@
./c++/src/H5AbstractDs.cpp
./c++/src/H5AbstractDs.h
+./c++/src/H5AcreatProp.cpp
+./c++/src/H5AcreatProp.h
./c++/src/H5Alltypes.h
./c++/src/H5ArrayType.cpp
./c++/src/H5ArrayType.h
@@ -392,6 +394,8 @@
./c++/src/H5Library.h
./c++/src/H5LaccProp.cpp
./c++/src/H5LaccProp.h
+./c++/src/H5LcreatProp.cpp
+./c++/src/H5LcreatProp.h
./c++/src/H5Location.cpp
./c++/src/H5Location.h
./c++/src/H5Object.cpp
@@ -402,6 +406,8 @@
./c++/src/H5PredType.h
./c++/src/H5PropList.cpp
./c++/src/H5PropList.h
+./c++/src/H5StrcreatProp.cpp
+./c++/src/H5StrcreatProp.h
./c++/src/H5StrType.cpp
./c++/src/H5StrType.h
./c++/src/H5VarLenType.cpp
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index 5b36137..9b9b745 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -13,6 +13,7 @@ configure_file (${HDF_RESOURCES_DIR}/H5cxx_config.h.in
#-----------------------------------------------------------------------------
set (CPP_SRCS
${HDF5_CPP_SRC_SOURCE_DIR}/H5AbstractDs.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5AcreatProp.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5ArrayType.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5AtomType.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5Attribute.cpp
@@ -33,18 +34,21 @@ set (CPP_SRCS
${HDF5_CPP_SRC_SOURCE_DIR}/H5IdComponent.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5LaccProp.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5LcreatProp.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5Location.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5OcreatProp.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.cpp
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5StrcreatProp.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5StrType.cpp
${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.cpp
)
set (CPP_HDRS
${HDF5_CPP_SRC_SOURCE_DIR}/H5AbstractDs.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5AcreatProp.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5Alltypes.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5ArrayType.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5AtomType.h
@@ -70,12 +74,14 @@ set (CPP_HDRS
${HDF5_CPP_SRC_SOURCE_DIR}/H5Include.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5LaccProp.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5LcreatProp.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5Location.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5OcreatProp.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.h
+ ${HDF5_CPP_SRC_SOURCE_DIR}/H5StrcreatProp.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5StrType.h
${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.h
)
diff --git a/c++/src/H5AcreatProp.cpp b/c++/src/H5AcreatProp.cpp
new file mode 100644
index 0000000..29886d8
--- /dev/null
+++ b/c++/src/H5AcreatProp.cpp
@@ -0,0 +1,113 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <string>
+
+#include "H5Include.h"
+#include "H5Exception.h"
+#include "H5IdComponent.h"
+#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5AcreatProp.h"
+
+namespace H5 {
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control
+// the order of creation and deletion of the global constants. See Design Notes
+// in "H5PredType.cpp" for information.
+
+// Initialize a pointer for the constant
+AttrCreatPropList* AttrCreatPropList::DEFAULT_ = 0;
+
+//--------------------------------------------------------------------------
+// Function: AttrCreatPropList::getConstant
+// Creates a AttrCreatPropList object representing the HDF5 constant
+// H5P_ATTRIBUTE_CREATE, pointed to by AttrCreatPropList::DEFAULT_
+// exception H5::PropListIException
+// Description
+// If AttrCreatPropList::DEFAULT_ already points to an allocated
+// object, throw a PropListIException. This scenario should not
+// happen.
+// May, 2018
+//--------------------------------------------------------------------------
+AttrCreatPropList* AttrCreatPropList::getConstant()
+{
+ // Tell the C library not to clean up, H5Library::termH5cpp will call
+ // H5close - more dependency if use H5Library::dontAtExit()
+ if (!IdComponent::H5dontAtexit_called)
+ {
+ (void) H5dont_atexit();
+ IdComponent::H5dontAtexit_called = true;
+ }
+
+ // If the constant pointer is not allocated, allocate it. Otherwise,
+ // throw because it shouldn't be.
+ if (DEFAULT_ == 0)
+ DEFAULT_ = new AttrCreatPropList(H5P_ATTRIBUTE_CREATE);
+ else
+ throw PropListIException("AttrCreatPropList::getConstant", "AttrCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return(DEFAULT_);
+}
+
+//--------------------------------------------------------------------------
+// Function: AttrCreatPropList::deleteConstants
+// Purpose: Deletes the constant object that AttrCreatPropList::DEFAULT_
+// points to.
+// exception H5::PropListIException
+// May, 2018
+//--------------------------------------------------------------------------
+void AttrCreatPropList::deleteConstants()
+{
+ if (DEFAULT_ != 0)
+ delete DEFAULT_;
+}
+
+//--------------------------------------------------------------------------
+// Purpose: Constant for default link creation property
+//--------------------------------------------------------------------------
+const AttrCreatPropList& AttrCreatPropList::DEFAULT = *getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+//--------------------------------------------------------------------------
+// Function: Default Constructor
+///\brief Creates a file access property list
+// May, 2018
+//--------------------------------------------------------------------------
+AttrCreatPropList::AttrCreatPropList() : StrCreatPropList(H5P_ATTRIBUTE_CREATE) {}
+
+//--------------------------------------------------------------------------
+// Function: AttrCreatPropList copy constructor
+///\brief Copy constructor: same HDF5 object as \a original
+///\param original - IN: AttrCreatPropList instance to copy
+// May, 2018
+//--------------------------------------------------------------------------
+AttrCreatPropList::AttrCreatPropList(const AttrCreatPropList& original) : StrCreatPropList(original) {}
+
+//--------------------------------------------------------------------------
+// Function: AttrCreatPropList overloaded constructor
+///\brief Creates a file access property list using the id of an
+/// existing one.
+// May, 2018
+//--------------------------------------------------------------------------
+AttrCreatPropList::AttrCreatPropList(const hid_t plist_id) : StrCreatPropList(plist_id) {}
+
+//--------------------------------------------------------------------------
+// Function: AttrCreatPropList destructor
+///\brief Noop destructor
+// May, 2018
+//--------------------------------------------------------------------------
+AttrCreatPropList::~AttrCreatPropList() {}
+
+} // end namespace
diff --git a/c++/src/H5AcreatProp.h b/c++/src/H5AcreatProp.h
new file mode 100644
index 0000000..9f81897
--- /dev/null
+++ b/c++/src/H5AcreatProp.h
@@ -0,0 +1,62 @@
+// C++ informative line for the emacs editor: -*- C++ -*-
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef __H5AttrCreatPropList_H
+#define __H5AttrCreatPropList_H
+
+namespace H5 {
+
+/*! \class AttrCreatPropList
+ \brief Class AttrCreatPropList inherits from StrCreatPropList and provides
+ wrappers for the HDF5 attribute creation property list.
+*/
+// Inheritance: StrCreatPropList -> PropList -> IdComponent
+class H5_DLLCPP AttrCreatPropList : public StrCreatPropList {
+ public:
+ ///\brief Default attribute creation property list.
+ static const AttrCreatPropList& DEFAULT;
+
+ // Creates a attribute creation property list.
+ AttrCreatPropList();
+
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("AttrCreatPropList"); }
+
+ // Copy constructor: same as the original AttrCreatPropList.
+ AttrCreatPropList(const AttrCreatPropList& original);
+
+ // Creates a copy of an existing attribute creation property list
+ // using the property list id.
+ AttrCreatPropList(const hid_t acpl_id);
+
+ // Noop destructor
+ virtual ~AttrCreatPropList();
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
+
+ private:
+ static AttrCreatPropList* DEFAULT_;
+
+ // Creates the global constant, should only be used by the library
+ static AttrCreatPropList* getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+}; // end of AttrCreatPropList
+
+} // namespace H5
+
+#endif // __H5AttrCreatPropList_H
diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp
index 6be1a1f..b0d65b0 100644
--- a/c++/src/H5ArrayType.cpp
+++ b/c++/src/H5ArrayType.cpp
@@ -117,7 +117,6 @@ ArrayType::ArrayType(const H5Location& loc, const H5std_string& type_name) : Dat
// Closes the id on the lhs object first with setId, then copies
// each data member from the rhs object. (Issue HDFFV-9562)
// Programmer Binh-Minh Ribler - Mar 2016
-// Modification
//--------------------------------------------------------------------------
ArrayType& ArrayType::operator=(const ArrayType& rhs)
{
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index 684090f..97900f6 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -24,6 +24,8 @@
#include "H5DxferProp.h"
#include "H5DcreatProp.h"
#include "H5LaccProp.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5Location.h"
#include "H5Object.h"
#include "H5CommonFG.h"
@@ -53,9 +55,11 @@ namespace H5 {
// Function: CommonFG::createGroup
///\brief Creates a new group at this location which can be a file
/// or another group.
-///\param name - IN: Name of the group to create
+///\param name - IN: Name of the group to create
///\param size_hint - IN: Indicates the number of bytes to reserve for
-/// the names that will appear in the group
+/// the names that will appear in the group - default to 0
+///\param lcpl - IN: Link creation property list - default to
+/// LinkCreatPropList::DEFAULT
///\return Group instance
///\exception H5::FileIException or H5::GroupIException
///\par Description
@@ -63,9 +67,12 @@ namespace H5 {
/// reserve for storing the names that will appear in this new
/// group. If a non-positive value is provided for the \a size_hint
/// then a default size is chosen.
-// Programmer Binh-Minh Ribler - 2000
+// 2000
+// Modification:
+// May 2018 - 1.8.21
+// - Added an argument with default value LinkCreatPropList::DEFAULT
//--------------------------------------------------------------------------
-Group CommonFG::createGroup(const char* name, size_t size_hint) const
+Group CommonFG::createGroup(const char* name, size_t size_hint, const LinkCreatPropList& lcpl) const
{
// Group creation property list for size hint
hid_t gcpl_id = 0;
@@ -85,7 +92,7 @@ Group CommonFG::createGroup(const char* name, size_t size_hint) const
// Call C routine H5Gcreate2 to create the named group, giving the
// location id which can be a file id or a group id
- hid_t group_id = H5Gcreate2(getLocId(), name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT);
+ hid_t group_id = H5Gcreate2(getLocId(), name, lcpl.getId(), gcpl_id, H5P_DEFAULT);
// Close the group creation property list, if necessary
if(gcpl_id > 0)
@@ -107,11 +114,13 @@ Group CommonFG::createGroup(const char* name, size_t size_hint) const
///\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
+// Modification:
+// May 2018 - 1.8.21
+// - Added LinkCreatPropList& with default value LinkCreatPropList::DEFAULT
//--------------------------------------------------------------------------
-Group CommonFG::createGroup(const H5std_string& name, size_t size_hint) const
+Group CommonFG::createGroup(const H5std_string& name, size_t size_hint, const LinkCreatPropList& lcpl) const
{
- return(createGroup(name.c_str(), size_hint));
+ return(createGroup(name.c_str(), size_hint, lcpl));
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h
index 81a9a29..5e43d8c 100644
--- a/c++/src/H5CommonFG.h
+++ b/c++/src/H5CommonFG.h
@@ -30,8 +30,8 @@ class H5_DLLCPP CommonFG {
public:
// Creates a new group at this location which can be a file
// or another group.
- Group createGroup(const char* name, size_t size_hint = 0) const;
- Group createGroup(const H5std_string& name, size_t size_hint = 0) const;
+ Group createGroup(const char* name, size_t size_hint = 0, const LinkCreatPropList& lc_plist = LinkCreatPropList::DEFAULT) const;
+ Group createGroup(const H5std_string& name, size_t size_hint = 0, const LinkCreatPropList& lc_plist = LinkCreatPropList::DEFAULT) const;
// Opens an existing group in a location which can be a file
// or another group.
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index 6d879bd..9527037 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -31,7 +31,7 @@ namespace H5 {
//--------------------------------------------------------------------------
// Function: CompType default constructor
///\brief Default constructor: Creates a stub compound datatype
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
CompType::CompType() : DataType() {}
@@ -39,7 +39,7 @@ CompType::CompType() : DataType() {}
// Function: CompType copy constructor
///\brief Copy constructor: makes copy of the original CompType object
///\param original - IN: Original CompType instance
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
CompType::CompType(const CompType& original) : DataType(original) {}
@@ -47,7 +47,7 @@ CompType::CompType(const CompType& original) : DataType(original) {}
// Function: CompType overloaded constructor
///\brief Creates a CompType object using the id of an existing datatype.
///\param existing_id - IN: Id of an existing compound datatype
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
CompType::CompType(const hid_t existing_id) : DataType(existing_id) {}
@@ -59,7 +59,7 @@ CompType::CompType(const hid_t existing_id) : DataType(existing_id) {}
// Description
// The DataType constructor calls the C API H5Tcreate to create
// the compound datatype.
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
CompType::CompType(size_t size) : DataType(H5T_COMPOUND, size) {}
@@ -69,7 +69,7 @@ CompType::CompType(size_t size) : DataType(H5T_COMPOUND, size) {}
///\param dataset - IN: Dataset that this enum datatype associates with
///\return CompType instance
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
CompType::CompType(const DataSet& dataset) : DataType()
{
@@ -90,7 +90,7 @@ CompType::CompType(const DataSet& dataset) : DataType()
///\param loc - IN: Location of the type
///\param type_name - IN: Compound type name
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Sept 2017
+// Sept 2017
// Description
// In 1.8.20, this constructor was introduced and may replace the
// existing function CommonFG::openCompType(const char*) to
@@ -109,7 +109,7 @@ CompType::CompType(const H5Location& loc, const char *type_name) : DataType()
///\param loc - IN: Location of the type
///\param type_name - IN: Compound type name
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Sept 2017
+// Sept 2017
// Description
// In 1.8.20, this constructor was introduced and may replace the
// existing function CommonFG::openCompType(const H5std_string&) to
@@ -126,7 +126,7 @@ CompType::CompType(const H5Location& loc, const H5std_string& type_name) : DataT
///\brief Returns a CompType object via DataType* by decoding the
/// binary object description of this datatype.
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Sept 2017
+// Sept 2017
//--------------------------------------------------------------------------
DataType* CompType::decode() const
{
@@ -147,7 +147,7 @@ DataType* CompType::decode() const
///\brief Returns the number of members in this compound datatype.
///\return Number of members
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
int CompType::getNmembers() const
{
@@ -166,7 +166,7 @@ int CompType::getNmembers() const
///\param member_num - IN: Zero-based index of the member
///\return Name of member
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
H5std_string CompType::getMemberName(unsigned member_num) const
{
@@ -184,14 +184,14 @@ H5std_string CompType::getMemberName(unsigned member_num) const
//--------------------------------------------------------------------------
// Function: CompType::getMemberIndex
///\brief Returns the index of a member in this compound datatype.
-///\param name - IN: Name of the member
+///\param name - IN: Name of the member - \c char*
///\return Index of member
///\exception H5::DataTypeIException
///\par Description
/// Members are stored in no particular order with numbers 0
/// through N-1, where N is the value returned by the member
/// function \c CompType::getNmembers.
-// Programmer Binh-Minh Ribler - May 16, 2002
+// May 16, 2002
//--------------------------------------------------------------------------
int CompType::getMemberIndex(const char* name) const
{
@@ -203,6 +203,21 @@ int CompType::getMemberIndex(const char* name) const
}
return(member_index);
}
+
+//--------------------------------------------------------------------------
+// Function: CompType::getMemberIndex
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+///\param name - IN: Name of the member - \c H5std_string
+///\return Index of member
+///\exception H5::DataTypeIException
+///\par Description
+/// Members are stored in no particular order with numbers 0
+/// through N-1, where N is the value returned by the member
+/// function \c CompType::getNmembers.
+// Apr 18, 2018
+//--------------------------------------------------------------------------
int CompType::getMemberIndex(const H5std_string& name) const
{
return(getMemberIndex(name.c_str()));
@@ -214,14 +229,14 @@ int CompType::getMemberIndex(const H5std_string& name) const
/// respect to the beginning of the compound data type datum.
///\param member_num - IN: Zero-based index of the member
///\return Byte offset
-// Programmer Binh-Minh Ribler - 2000
+// 2000
// Description
/// Members are stored in no particular order with numbers 0
/// through N-1, where N is the value returned by the member
/// function \c CompType::getNmembers.
//
// Note that byte offset being returned as 0 doesn't indicate
-// a failure. (According to Quincey)
+// a failure.
//--------------------------------------------------------------------------
size_t CompType::getMemberOffset(unsigned member_num) const
{
@@ -235,7 +250,7 @@ size_t CompType::getMemberOffset(unsigned member_num) const
///\param member_num - IN: Zero-based index of the member
///\return Type class of the member
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// 2000
// Modification
// Modified to use H5Tget_member_class instead. - Jul, 2005
//--------------------------------------------------------------------------
@@ -275,7 +290,7 @@ hid_t CompType::p_get_member_type(unsigned member_num) const
///\param member_num - IN: Zero-based index of the member
///\return DataType instance
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
DataType CompType::getMemberDataType(unsigned member_num) const
{
@@ -296,12 +311,12 @@ DataType CompType::getMemberDataType(unsigned member_num) const
///\param member_num - IN: Zero-based index of the member
///\return ArrayType instance
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Jul, 2005
+// Jul, 2005
//--------------------------------------------------------------------------
ArrayType CompType::getMemberArrayType(unsigned member_num) const
{
try {
- ArrayType arraytype(p_get_member_type(member_num));
+ ArrayType arraytype;
f_DataType_setId(&arraytype, p_get_member_type(member_num));
return(arraytype);
}
@@ -317,12 +332,12 @@ ArrayType CompType::getMemberArrayType(unsigned member_num) const
///\param member_num - IN: Zero-based index of the member
///\return CompType instance
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
CompType CompType::getMemberCompType(unsigned member_num) const
{
try {
- CompType comptype(p_get_member_type(member_num));
+ CompType comptype;
f_DataType_setId(&comptype, p_get_member_type(member_num));
return(comptype);
}
@@ -338,12 +353,12 @@ CompType CompType::getMemberCompType(unsigned member_num) const
///\param member_num - IN: Zero-based index of the member
///\return EnumType instance
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
EnumType CompType::getMemberEnumType(unsigned member_num) const
{
try {
- EnumType enumtype(p_get_member_type(member_num));
+ EnumType enumtype;
f_DataType_setId(&enumtype, p_get_member_type(member_num));
return(enumtype);
}
@@ -359,12 +374,12 @@ EnumType CompType::getMemberEnumType(unsigned member_num) const
///\param member_num - IN: Zero-based index of the member
///\return IntType instance
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
IntType CompType::getMemberIntType(unsigned member_num) const
{
try {
- IntType inttype(p_get_member_type(member_num));
+ IntType inttype;
f_DataType_setId(&inttype, p_get_member_type(member_num));
return(inttype);
}
@@ -380,12 +395,12 @@ IntType CompType::getMemberIntType(unsigned member_num) const
///\param member_num - IN: Zero-based index of the member
///\return FloatType instance
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
FloatType CompType::getMemberFloatType(unsigned member_num) const
{
try {
- FloatType floatype(p_get_member_type(member_num));
+ FloatType floatype;
f_DataType_setId(&floatype, p_get_member_type(member_num));
return(floatype);
}
@@ -401,12 +416,12 @@ FloatType CompType::getMemberFloatType(unsigned member_num) const
///\param member_num - IN: Zero-based index of the member
///\return StrType instance
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
StrType CompType::getMemberStrType(unsigned member_num) const
{
try {
- StrType strtype(p_get_member_type(member_num));
+ StrType strtype;
f_DataType_setId(&strtype, p_get_member_type(member_num));
return(strtype);
}
@@ -422,12 +437,12 @@ StrType CompType::getMemberStrType(unsigned member_num) const
///\param member_num - IN: Zero-based index of the member
///\return VarLenType instance
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - Jul, 2005
+// Jul, 2005
//--------------------------------------------------------------------------
VarLenType CompType::getMemberVarLenType(unsigned member_num) const
{
try {
- VarLenType varlentype(p_get_member_type(member_num));
+ VarLenType varlentype;
f_DataType_setId(&varlentype, p_get_member_type(member_num));
return(varlentype);
}
@@ -476,7 +491,7 @@ void CompType::getMemberType(unsigned member_num, StrType& strtype) const
///\param offset - IN: Offset in memory structure of the field to insert
///\param new_member - IN: New member to be inserted
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
void CompType::insertMember(const H5std_string& name, size_t offset, const DataType& new_member) const
{
@@ -499,7 +514,7 @@ void CompType::insertMember(const H5std_string& name, size_t offset, const DataT
///\brief Recursively removes padding from within a compound datatype.
///
///\exception H5::DataTypeIException
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
void CompType::pack() const
{
@@ -518,7 +533,7 @@ void CompType::pack() const
///\exception H5::DataTypeIException
// Note
// H5Tset_size works on atom datatypes and compound datatypes only
-// Programmer Binh-Minh Ribler - 2014
+// 2014
//--------------------------------------------------------------------------
void CompType::setSize(size_t size) const
{
@@ -533,7 +548,7 @@ void CompType::setSize(size_t size) const
//--------------------------------------------------------------------------
// Function: CompType destructor
///\brief Properly terminates access to this compound datatype.
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
CompType::~CompType() {}
diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h
index dcf3a17..af7d1e5fa 100644
--- a/c++/src/H5Cpp.h
+++ b/c++/src/H5Cpp.h
@@ -27,11 +27,15 @@
#include "H5Attribute.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
+#include "H5StrcreatProp.h"
+#include "H5AcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DxferProp.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
+#include "H5LaccProp.h"
#include "H5AtomType.h"
#include "H5PredType.h"
#include "H5EnumType.h"
diff --git a/c++/src/H5DxferProp.h b/c++/src/H5DxferProp.h
index 370b271..a8b1fa9 100644
--- a/c++/src/H5DxferProp.h
+++ b/c++/src/H5DxferProp.h
@@ -21,7 +21,7 @@ namespace H5 {
\brief Class DSetCreatPropList inherits from PropList and provides
wrappers for the HDF5 dataset memory and transfer property list.
*/
-// Inheritance: ObjCreatPropList -> PropList -> IdComponent
+// Inheritance: PropList -> IdComponent
class H5_DLLCPP DSetMemXferPropList : public PropList {
public:
///\brief Default dataset memory and transfer property list.
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 395077d..782831b 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -27,6 +27,8 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5LaccProp.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5Location.h"
#include "H5Object.h"
#include "H5CommonFG.h"
@@ -229,7 +231,7 @@ bool H5File::isHdf5(const H5std_string& name)
/// will be reopened. Absence of this flag
/// implies read-only access.
///
-/// H5F_ACC_RDONLY: Open with read only access. - default
+/// H5F_ACC_RDONLY: Open with read only access.
///
// Programmer Binh-Minh Ribler - Oct, 2005
//--------------------------------------------------------------------------
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index 00a69d6..c3f390c 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -25,6 +25,8 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5LaccProp.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5Location.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h
index 9772cde..39fe7b8 100644
--- a/c++/src/H5LaccProp.h
+++ b/c++/src/H5LaccProp.h
@@ -22,16 +22,16 @@ namespace H5 {
/*! \class LinkAccPropList
\brief Class LinkAccPropList inherits from PropList and provides
- wrappers for the HDF5 file access property list.
+ wrappers for the HDF5 link access property list.
Inheritance: PropList -> IdComponent
*/
class H5_DLLCPP LinkAccPropList : public PropList {
public:
- ///\brief Default file access property list.
+ ///\brief Default link access property list.
static const LinkAccPropList& DEFAULT;
- // Creates a file access property list.
+ // Creates a link access property list.
LinkAccPropList();
///\brief Returns this class name.
@@ -40,9 +40,9 @@ class H5_DLLCPP LinkAccPropList : public PropList {
// Copy constructor: creates a copy of a LinkAccPropList object.
LinkAccPropList(const LinkAccPropList& original);
- // Creates a copy of an existing file access property list
+ // Creates a copy of an existing link access property list
// using the property list id.
- LinkAccPropList (const hid_t plist_id);
+ LinkAccPropList(const hid_t lapl_id);
// Sets the number of soft or user-defined links that can be
// traversed before a failure occurs.
diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp
new file mode 100644
index 0000000..b6d6bd6
--- /dev/null
+++ b/c++/src/H5LcreatProp.cpp
@@ -0,0 +1,113 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <string>
+
+#include "H5Include.h"
+#include "H5Exception.h"
+#include "H5IdComponent.h"
+#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
+
+namespace H5 {
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control
+// the order of creation and deletion of the global constants. See Design Notes
+// in "H5PredType.cpp" for information.
+
+// Initialize a pointer for the constant
+LinkCreatPropList* LinkCreatPropList::DEFAULT_ = 0;
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList::getConstant
+// Creates a LinkCreatPropList object representing the HDF5 constant
+// H5P_LINK_CREATE, pointed to by LinkCreatPropList::DEFAULT_
+// exception H5::PropListIException
+// Description
+// If LinkCreatPropList::DEFAULT_ already points to an allocated
+// object, throw a PropListIException. This scenario should not
+// happen.
+// May, 2018
+//--------------------------------------------------------------------------
+LinkCreatPropList* LinkCreatPropList::getConstant()
+{
+ // Tell the C library not to clean up, H5Library::termH5cpp will call
+ // H5close - more dependency if use H5Library::dontAtExit()
+ if (!IdComponent::H5dontAtexit_called)
+ {
+ (void) H5dont_atexit();
+ IdComponent::H5dontAtexit_called = true;
+ }
+
+ // If the constant pointer is not allocated, allocate it. Otherwise,
+ // throw because it shouldn't be.
+ if (DEFAULT_ == 0)
+ DEFAULT_ = new LinkCreatPropList(H5P_LINK_CREATE);
+ else
+ throw PropListIException("LinkCreatPropList::getConstant", "LinkCreatPropList::getConstant is being invoked on an allocated DEFAULT_");
+ return(DEFAULT_);
+}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList::deleteConstants
+// Purpose: Deletes the constant object that LinkCreatPropList::DEFAULT_
+// points to.
+// exception H5::PropListIException
+// May, 2018
+//--------------------------------------------------------------------------
+void LinkCreatPropList::deleteConstants()
+{
+ if (DEFAULT_ != 0)
+ delete DEFAULT_;
+}
+
+//--------------------------------------------------------------------------
+// Purpose: Constant for default link creation property
+//--------------------------------------------------------------------------
+const LinkCreatPropList& LinkCreatPropList::DEFAULT = *getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+//--------------------------------------------------------------------------
+// Function: Default Constructor
+///\brief Creates a file access property list
+// May, 2018
+//--------------------------------------------------------------------------
+LinkCreatPropList::LinkCreatPropList() : StrCreatPropList(H5P_LINK_CREATE) {}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList copy constructor
+///\brief Copy constructor: same HDF5 object as \a original
+///\param original - IN: LinkCreatPropList instance to copy
+// May, 2018
+//--------------------------------------------------------------------------
+LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList& original) : StrCreatPropList(original) {}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList overloaded constructor
+///\brief Creates a file access property list using the id of an
+/// existing one.
+// May, 2018
+//--------------------------------------------------------------------------
+LinkCreatPropList::LinkCreatPropList(const hid_t plist_id) : StrCreatPropList(plist_id) {}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList destructor
+///\brief Noop destructor
+// May, 2018
+//--------------------------------------------------------------------------
+LinkCreatPropList::~LinkCreatPropList() {}
+
+} // end namespace
diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h
new file mode 100644
index 0000000..2a3b700
--- /dev/null
+++ b/c++/src/H5LcreatProp.h
@@ -0,0 +1,62 @@
+// C++ informative line for the emacs editor: -*- C++ -*-
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef __H5LinkCreatPropList_H
+#define __H5LinkCreatPropList_H
+
+namespace H5 {
+
+/*! \class LinkCreatPropList
+ \brief Class LinkCreatPropList inherits from StrCreatPropList and provides
+ wrappers for the HDF5 link creation property list.
+*/
+// Inheritance: StrCreatPropList -> PropList -> IdComponent
+class H5_DLLCPP LinkCreatPropList : public StrCreatPropList {
+ public:
+ ///\brief Default link creation property list.
+ static const LinkCreatPropList& DEFAULT;
+
+ // Creates a link creation property list.
+ LinkCreatPropList();
+
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("LinkCreatPropList"); }
+
+ // Copy constructor: same as the original LinkCreatPropList.
+ LinkCreatPropList(const LinkCreatPropList& original);
+
+ // Creates a copy of an existing link creation property list
+ // using the property list id.
+ LinkCreatPropList(const hid_t lcpl_id);
+
+ // Noop destructor
+ virtual ~LinkCreatPropList();
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+ // Deletes the global constant, should only be used by the library
+ static void deleteConstants();
+
+ private:
+ static LinkCreatPropList* DEFAULT_;
+
+ // Creates the global constant, should only be used by the library
+ static LinkCreatPropList* getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+}; // end of LinkCreatPropList
+
+} // namespace H5
+
+#endif // __H5LinkCreatPropList_H
diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp
index cedb74c..372fa14 100644
--- a/c++/src/H5Library.cpp
+++ b/c++/src/H5Library.cpp
@@ -25,6 +25,9 @@
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
#include "H5LaccProp.h"
+#include "H5StrcreatProp.h"
+#include "H5AcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5Location.h"
#include "H5Object.h"
#include "H5DataType.h"
@@ -188,6 +191,14 @@ void H5Library::initH5cpp()
if (ret_value != 0)
throw LibraryIException("H5Library::initH5cpp", "Registrating LinkAccPropList::deleteConstants failed");
+ ret_value = std::atexit(LinkCreatPropList::deleteConstants);
+ if (ret_value != 0)
+ throw LibraryIException("H5Library::initH5cpp", "Registrating LinkCreatPropList::deleteConstants failed");
+
+ ret_value = std::atexit(AttrCreatPropList::deleteConstants);
+ if (ret_value != 0)
+ throw LibraryIException("H5Library::initH5cpp", "Registrating AttrCreatPropList::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 afeaca7..319fa9e 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -95,7 +95,7 @@ May, 2017 (1.8.19)
//--------------------------------------------------------------------------
// Function: H5Location::createAttribute
-///\brief Deprecated - replaced by H5Object::createAttribute
+///\brief Deprecated - replaced by H5Object::createAttribute()
// brief Creates an attribute for a group, dataset, or named datatype.
///\param name - IN: Name of the attribute
///\param data_type - IN: Datatype for the attribute
@@ -114,6 +114,8 @@ May, 2017 (1.8.19)
/// delete the existing one with \c H5Location::removeAttr, then
/// recreate it with this function.
// Programmer Binh-Minh Ribler - 2000
+// Modification
+// - Moved to H5Object in 1.8.19. -BMR
//--------------------------------------------------------------------------
Attribute H5Location::createAttribute(const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist) const
{
@@ -135,11 +137,13 @@ Attribute H5Location::createAttribute(const char* name, const DataType& data_typ
//--------------------------------------------------------------------------
// Function: H5Location::createAttribute
-///\brief Deprecated - replaced by H5Object::createAttribute
+///\brief Deprecated - replaced by H5Object::createAttribute()
// brief This is an overloaded member function, provided for convenience.
/// It differs from the above function in that it takes
/// a reference to an \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
+// Modification
+// - Moved to H5Object in 1.8.19. -BMR
//--------------------------------------------------------------------------
Attribute H5Location::createAttribute(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist) const
{
@@ -148,12 +152,14 @@ Attribute H5Location::createAttribute(const H5std_string& name, const DataType&
//--------------------------------------------------------------------------
// Function: H5Location::openAttribute
-///\brief Deprecated - replaced by H5Object::openAttribute
+///\brief Deprecated - replaced by H5Object::openAttribute()
// brief Opens an attribute given its name.
///\param name - IN: Name of the attribute
///\return Attribute instance
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
+// Modification
+// - Moved to H5Object in 1.8.19. -BMR
//--------------------------------------------------------------------------
Attribute H5Location::openAttribute(const char* name) const
{
@@ -172,12 +178,14 @@ Attribute H5Location::openAttribute(const char* name) const
//--------------------------------------------------------------------------
// Function: H5Location::openAttribute
-///\brief Deprecated - replaced by H5Object::openAttribute
+///\brief Deprecated - replaced by H5Object::openAttribute()
// brief This is an overloaded member function, provided for convenience.
// It differs from the above function in that it takes
// a reference to an \c H5std_string for \a name.
///\param name - IN: Name of the attribute
// Programmer Binh-Minh Ribler - 2000
+// Modification
+// - Moved to H5Object in 1.8.19. -BMR
//--------------------------------------------------------------------------
Attribute H5Location::openAttribute(const H5std_string& name) const
{
@@ -186,12 +194,14 @@ Attribute H5Location::openAttribute(const H5std_string& name) const
//--------------------------------------------------------------------------
// Function: H5Location::openAttribute
-///\brief Deprecated - replaced by H5Object::openAttribute
+///\brief Deprecated - replaced by H5Object::openAttribute()
// brief Opens an attribute given its index.
///\param idx - IN: Index of the attribute, a 0-based, non-negative integer
///\return Attribute instance
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
+// Modification
+// - Moved to H5Object in 1.8.19. -BMR
//--------------------------------------------------------------------------
Attribute H5Location::openAttribute(const unsigned int idx) const
{
@@ -225,7 +235,6 @@ Attribute H5Location::openAttribute(const unsigned int idx) const
/// For information, please refer to the C layer Reference Manual
/// at:
/// https://support.hdfgroup.org/HDF5/doc/RM/RM_H5A.html#Annot-Iterate
-// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int H5Location::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_data)
{
@@ -261,6 +270,8 @@ int H5Location::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_d
///\param name - IN: Name of the attribute to be queried
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2013
+// Modification
+// - Moved to H5Object in 1.8.19. -BMR
//--------------------------------------------------------------------------
bool H5Location::attrExists(const char* name) const
{
@@ -284,6 +295,8 @@ bool H5Location::attrExists(const char* name) const
// a reference to an \c H5std_string for \a name.
///\param name - IN: Name of the attribute to be queried
// Programmer Binh-Minh Ribler - 2013
+// Modification
+// - Moved to H5Object in 1.8.19. -BMR
//--------------------------------------------------------------------------
bool H5Location::attrExists(const H5std_string& name) const
{
@@ -297,6 +310,8 @@ bool H5Location::attrExists(const H5std_string& name) const
///\param name - IN: Name of the attribute to be removed
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
+// Modification
+// - Moved to H5Object in 1.8.19. -BMR
//--------------------------------------------------------------------------
void H5Location::removeAttr(const char* name) const
{
@@ -313,6 +328,8 @@ void H5Location::removeAttr(const char* name) const
// a reference to an \c H5std_string for \a name.
///\param name - IN: Name of the attribute to be removed
// Programmer Binh-Minh Ribler - 2000
+// Modification
+// - Moved to H5Object in 1.8.19. -BMR
//--------------------------------------------------------------------------
void H5Location::removeAttr(const H5std_string& name) const
{
@@ -327,6 +344,8 @@ void H5Location::removeAttr(const H5std_string& name) const
///\param newname - IN: New name ame of the attribute
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - Mar, 2005
+// Modification
+// - Moved to H5Object in 1.8.19. -BMR
//--------------------------------------------------------------------------
void H5Location::renameAttr(const char* oldname, const char* newname) const
{
@@ -346,6 +365,8 @@ void H5Location::renameAttr(const char* oldname, const char* newname) const
///\param newname - IN: New name ame of the attribute
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - Mar, 2005
+// Modification
+// - Moved to H5Object in 1.8.19. -BMR
//--------------------------------------------------------------------------
void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& newname) const
{
@@ -358,9 +379,9 @@ void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& new
// brief Returns the number of attributes attached to this HDF5 object.
///\return Number of attributes
///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
+// 2000
// Modification
-// - Moved to H5Object in 1.8.20. -BMR
+// - Moved to H5Object in 1.8.19. -BMR
//--------------------------------------------------------------------------
int H5Location::getNumAttrs() const
{
@@ -378,8 +399,7 @@ int H5Location::getNumAttrs() const
///\param name - IN: Searched name - \c char*
///\param lapl - IN: Link access property list
///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - Nov, 2016
-// Modification
+// Nov, 2016
//--------------------------------------------------------------------------
bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const
{
@@ -452,6 +472,7 @@ H5std_string H5Location::getFileName() const
//--------------------------------------------------------------------------
// Function: H5Location::getObjectInfo
///\brief Retrieve information about an object, specified by location.
+///
///\exception H5::LocationException
// Programmer Binh-Minh Ribler - Aug, 2017
//--------------------------------------------------------------------------
@@ -467,6 +488,7 @@ void H5Location::getObjectInfo(H5O_info_t *objinfo) const
//--------------------------------------------------------------------------
// Function: H5Location::getObjectInfo
///\brief Retrieve information about an object, specified by name.
+///
///\exception H5::LocationException
// Programmer Binh-Minh Ribler - Aug, 2017
//--------------------------------------------------------------------------
@@ -483,6 +505,7 @@ void H5Location::getObjectInfo(const char *name, H5O_info_t *objinfo,
//--------------------------------------------------------------------------
// Function: H5Location::getObjectInfo
///\brief Retrieve information about an object, specified by name.
+///
///\exception H5::LocationException
// Programmer Binh-Minh Ribler - Aug, 2017
//--------------------------------------------------------------------------
@@ -507,6 +530,9 @@ void H5Location::getObjectInfo(const H5std_string& name, H5O_info_t *objinfo,
/// - an error returned by the C API
/// - version number is not one of the valid values above
// Programmer Binh-Minh Ribler - May, 2017
+// Developer's Note
+// Maybe, this should be moved to H5Object because H5Oget_info is
+// supposed to take an object ID, so it shouldn't be a location.
//--------------------------------------------------------------------------
unsigned H5Location::objVersion() const
{
@@ -773,14 +799,14 @@ hid_t H5Location::openObjId(const H5std_string& obj_name, const LinkAccPropList&
///\brief Closes an object, which was opened with H5Location::openObjId
///
///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - May, 2017
+// May, 2017
//--------------------------------------------------------------------------
-void H5Location::closeObjId(hid_t obj_id) const
+void H5Location::closeObjId(hid_t obj_id)
{
herr_t ret_value = H5Oclose(obj_id);
if (ret_value < 0)
{
- throw LocationException(inMemFunc("closeObjId"), "H5Oclose failed");
+ throw Exception("closeObjId", "H5Oclose failed");
}
}
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index 12c3e8a..0316a53 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -115,8 +115,8 @@ class H5_DLLCPP H5Location : public IdComponent {
hid_t openObjId(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
hid_t openObjId(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- // Closes an object opened by openObjId().
- void closeObjId(hid_t obj_id) const;
+ // Closes an object opened by openObjId()
+ static void closeObjId(hid_t obj_id);
///\brief Returns an identifier. (pure virtual)
virtual hid_t getId() const = 0;
diff --git a/c++/src/H5StrcreatProp.cpp b/c++/src/H5StrcreatProp.cpp
new file mode 100644
index 0000000..6237e2b
--- /dev/null
+++ b/c++/src/H5StrcreatProp.cpp
@@ -0,0 +1,58 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <string>
+
+#include "H5Include.h"
+#include "H5Exception.h"
+#include "H5IdComponent.h"
+#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+
+namespace H5 {
+
+//--------------------------------------------------------------------------
+// Function: StrCreatPropList::setCharEncoding
+///\brief Sets the character encoding of the string.
+///\exception H5::PropListIException
+// March, 2018
+//--------------------------------------------------------------------------
+void StrCreatPropList::setCharEncoding(H5T_cset_t encoding) const
+{
+ herr_t ret_value = H5Pset_char_encoding(id, encoding);
+ // Throw exception if H5Pset_char_encoding returns failure
+ if (ret_value < 0)
+ {
+ throw PropListIException("setCharEncoding", "H5Pset_char_encoding failed");
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: StrCreatPropList::getCharEncoding
+///\brief Gets the character encoding of the string.
+///\exception H5::PropListIException
+// March, 2018
+//--------------------------------------------------------------------------
+H5T_cset_t StrCreatPropList::getCharEncoding() const
+{
+ H5T_cset_t encoding;
+ herr_t ret_value = H5Pget_char_encoding(id, &encoding);
+ // Throw exception if H5Pget_char_encoding returns failure
+ if (ret_value < 0)
+ {
+ throw PropListIException("getCharEncoding", "H5Pget_char_encoding failed");
+ }
+ return(encoding);
+}
+
+} // end namespace
diff --git a/c++/src/H5StrcreatProp.h b/c++/src/H5StrcreatProp.h
new file mode 100644
index 0000000..7b07dd6
--- /dev/null
+++ b/c++/src/H5StrcreatProp.h
@@ -0,0 +1,57 @@
+// C++ informative line for the emacs editor: -*- C++ -*-
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef __H5StrCreatPropList_H
+#define __H5StrCreatPropList_H
+
+namespace H5 {
+
+// Class StrCreatPropList is not user-accessible. It provides
+// wrappers for the HDF5 string creation properties.
+
+// Inheritance: PropList -> IdComponent
+class H5_DLLCPP StrCreatPropList : public PropList {
+ public:
+ // There is no StrCreatPropList::DEFAULT;
+
+ // Returns this class name.
+ virtual H5std_string fromClass () const { return("StrCreatPropList"); }
+
+ // Sets the character encoding of the string.
+ void setCharEncoding(H5T_cset_t encoding) const;
+
+ // Gets the character encoding of the string.
+ H5T_cset_t getCharEncoding() const;
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+ protected:
+ // Creates a link creation property list.
+ StrCreatPropList() {};
+
+ // Copy constructor: same as the original StrCreatPropList.
+ StrCreatPropList(const StrCreatPropList& original) {};
+
+ // Creates a copy of an existing link creation property list
+ // using the property list id.
+ StrCreatPropList(const hid_t plist_id) {};
+
+ // Noop destructor
+ virtual ~StrCreatPropList() {};
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+}; // end of StrCreatPropList
+
+} // namespace H5
+
+#endif // __H5StrCreatPropList_H
diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am
index 976d503..416a3d3 100644
--- a/c++/src/Makefile.am
+++ b/c++/src/Makefile.am
@@ -32,14 +32,15 @@ bin_SCRIPTS=h5c++
# Source files for the library
libhdf5_cpp_la_SOURCES=H5Exception.cpp H5IdComponent.cpp \
- H5DataSpace.cpp H5PropList.cpp H5Library.cpp \
- H5FaccProp.cpp H5FcreatProp.cpp H5LaccProp.cpp \
- H5DxferProp.cpp H5DcreatProp.cpp H5Location.cpp \
- H5AbstractDs.cpp H5Attribute.cpp H5Object.cpp \
- H5OcreatProp.cpp H5DataType.cpp H5AtomType.cpp \
- H5PredType.cpp H5EnumType.cpp H5IntType.cpp \
- H5FloatType.cpp H5StrType.cpp H5ArrayType.cpp \
- H5VarLenType.cpp H5CompType.cpp H5DataSet.cpp \
+ H5DataSpace.cpp H5PropList.cpp H5Library.cpp \
+ H5FaccProp.cpp H5FcreatProp.cpp H5LaccProp.cpp \
+ H5StrcreatProp.cpp H5LcreatProp.cpp H5AcreatProp.cpp \
+ H5DxferProp.cpp H5DcreatProp.cpp H5Location.cpp \
+ H5AbstractDs.cpp H5Attribute.cpp H5Object.cpp \
+ H5OcreatProp.cpp H5DataType.cpp H5AtomType.cpp \
+ H5PredType.cpp H5EnumType.cpp H5IntType.cpp \
+ H5FloatType.cpp H5StrType.cpp H5ArrayType.cpp \
+ H5VarLenType.cpp H5CompType.cpp H5DataSet.cpp \
H5CommonFG.cpp H5Group.cpp H5File.cpp
# HDF5 C++ library depends on HDF5 Library.
@@ -51,6 +52,7 @@ include_HEADERS=H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h \
H5OcreatProp.h H5DcreatProp.h H5DxferProp.h H5EnumType.h \
H5Exception.h H5FaccProp.h H5FcreatProp.h H5File.h H5FloatType.h \
H5Group.h H5IdComponent.h H5Include.h H5IntType.h H5LaccProp.h \
+ H5StrcreatProp.h H5LcreatProp.h H5AcreatProp.h \
H5Library.h H5Location.h H5Object.h H5PredType.h H5PropList.h \
H5StrType.h H5CppDoc.h H5ArrayType.h H5VarLenType.h
diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in
index a566368..59ec075 100644
--- a/c++/src/Makefile.in
+++ b/c++/src/Makefile.in
@@ -151,7 +151,8 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
libhdf5_cpp_la_DEPENDENCIES = $(LIBHDF5)
am_libhdf5_cpp_la_OBJECTS = H5Exception.lo H5IdComponent.lo \
H5DataSpace.lo H5PropList.lo H5Library.lo H5FaccProp.lo \
- H5FcreatProp.lo H5LaccProp.lo H5DxferProp.lo H5DcreatProp.lo \
+ H5FcreatProp.lo H5LaccProp.lo H5StrcreatProp.lo \
+ H5LcreatProp.lo H5AcreatProp.lo H5DxferProp.lo H5DcreatProp.lo \
H5Location.lo H5AbstractDs.lo H5Attribute.lo H5Object.lo \
H5OcreatProp.lo H5DataType.lo H5AtomType.lo H5PredType.lo \
H5EnumType.lo H5IntType.lo H5FloatType.lo H5StrType.lo \
@@ -713,14 +714,15 @@ bin_SCRIPTS = h5c++
# Source files for the library
libhdf5_cpp_la_SOURCES = H5Exception.cpp H5IdComponent.cpp \
- H5DataSpace.cpp H5PropList.cpp H5Library.cpp \
- H5FaccProp.cpp H5FcreatProp.cpp H5LaccProp.cpp \
- H5DxferProp.cpp H5DcreatProp.cpp H5Location.cpp \
- H5AbstractDs.cpp H5Attribute.cpp H5Object.cpp \
- H5OcreatProp.cpp H5DataType.cpp H5AtomType.cpp \
- H5PredType.cpp H5EnumType.cpp H5IntType.cpp \
- H5FloatType.cpp H5StrType.cpp H5ArrayType.cpp \
- H5VarLenType.cpp H5CompType.cpp H5DataSet.cpp \
+ H5DataSpace.cpp H5PropList.cpp H5Library.cpp \
+ H5FaccProp.cpp H5FcreatProp.cpp H5LaccProp.cpp \
+ H5StrcreatProp.cpp H5LcreatProp.cpp H5AcreatProp.cpp \
+ H5DxferProp.cpp H5DcreatProp.cpp H5Location.cpp \
+ H5AbstractDs.cpp H5Attribute.cpp H5Object.cpp \
+ H5OcreatProp.cpp H5DataType.cpp H5AtomType.cpp \
+ H5PredType.cpp H5EnumType.cpp H5IntType.cpp \
+ H5FloatType.cpp H5StrType.cpp H5ArrayType.cpp \
+ H5VarLenType.cpp H5CompType.cpp H5DataSet.cpp \
H5CommonFG.cpp H5Group.cpp H5File.cpp
@@ -733,6 +735,7 @@ include_HEADERS = H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h
H5OcreatProp.h H5DcreatProp.h H5DxferProp.h H5EnumType.h \
H5Exception.h H5FaccProp.h H5FcreatProp.h H5File.h H5FloatType.h \
H5Group.h H5IdComponent.h H5Include.h H5IntType.h H5LaccProp.h \
+ H5StrcreatProp.h H5LcreatProp.h H5AcreatProp.h \
H5Library.h H5Location.h H5Object.h H5PredType.h H5PropList.h \
H5StrType.h H5CppDoc.h H5ArrayType.h H5VarLenType.h
@@ -881,6 +884,7 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5AbstractDs.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5AcreatProp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5ArrayType.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5AtomType.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Attribute.Plo@am__quote@
@@ -901,6 +905,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IdComponent.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IntType.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5LaccProp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5LcreatProp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Library.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Location.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Object.Plo@am__quote@
@@ -908,6 +913,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5PredType.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5PropList.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5StrType.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5StrcreatProp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VarLenType.Plo@am__quote@
.cpp.o:
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index 059c548..23cf280 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -336,9 +336,12 @@ static void test_file_open()
// Truncating should succeed now.
H5File file3(FILE2, H5F_ACC_TRUNC);
- // Opening another file to file3 object, FILE2 should be closed, so
- // the next attempt to truncate FILE2 should succeed.
+ // Opening another file to file3 object.
file3.openFile(FILE1, H5F_ACC_RDONLY);
+
+ // In the previous statement, openFile closes FILE2 first before
+ // opening FILE1, so when H5File constructs file4 with an
+ // attempt to truncate FILE2, it should succeed.
H5File file4(FILE2, H5F_ACC_TRUNC);
PASSED();
@@ -493,6 +496,17 @@ static void test_file_name()
// Get and verify file name via a committed datatype.
comp_type.getFileName();
verify_val(file_name, FILE4, "CompType::getFileName", __LINE__, __FILE__);
+
+ /* file4.close();
+file4.openFile(FILE4, H5F_ACC_RDWR);
+ */
+ // Get the file's version information.
+ H5F_info_t finfo;
+ file4.getFileInfo(finfo); // there's no C test for H5Fget_info
+ /* cerr << "file4: super_ext_size = " << finfo.super_ext_size << endl;
+ */
+ //verify_val(finfo.sohm.hdr_size, 0, "H5File::getFileInfo", __LINE__, __FILE__);
+
PASSED();
} // end of try block
@@ -503,6 +517,15 @@ static void test_file_name()
} // test_file_name()
+/*-------------------------------------------------------------------------
+ *
+ * Function: test_file_attribute
+ *
+ * Purpose Test file attributes
+ *
+ * Return None
+ *-------------------------------------------------------------------------
+ */
const int RANK1 = 1;
const int ATTR1_DIM1 = 3;
const H5std_string FILE5("tfattrs.h5");
diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp
index c053604..54d62f2 100644
--- a/c++/test/tobject.cpp
+++ b/c++/test/tobject.cpp
@@ -361,7 +361,7 @@ static void test_open_object_header()
// There should be one object, the datatype
// Close datatype object opened from the file
- file1.closeObjId(obj_dtype);
+ H5Location::closeObjId(obj_dtype);
dset.setId(obj_dset);
dspace = dset.getSpace();
@@ -377,10 +377,10 @@ static void test_open_object_header()
dtype.close();
// Close datatype object
- grp2.closeObjId(obj_dtype);
+ H5Location::closeObjId(obj_dtype);
// Close the group object
- file1.closeObjId(obj_grp);
+ H5Location::closeObjId(obj_grp);
// Try doing something with group, the ID should still work
num_objs = grp2.getNumObjs();