summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2018-05-12 23:54:56 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2018-05-12 23:54:56 (GMT)
commit5a2bc3f0885b5e7a6e3f35b2373e56543d27c339 (patch)
tree3a8a0acbbb12c93a06abf36e77e8fcd05481a4fc
parent9b953884c57d89557df93af3e0145365acb5ea89 (diff)
parente5b337dd881b60a5300675f6b30ca3429020acbe (diff)
downloadhdf5-5a2bc3f0885b5e7a6e3f35b2373e56543d27c339.zip
hdf5-5a2bc3f0885b5e7a6e3f35b2373e56543d27c339.tar.gz
hdf5-5a2bc3f0885b5e7a6e3f35b2373e56543d27c339.tar.bz2
Merge pull request #1056 in HDFFV/hdf5 from ~BMRIBLER/hdf5_1_8_bmr:hdf5_1_8 to hdf5_1_8
* commit 'e5b337dd881b60a5300675f6b30ca3429020acbe': Code cleanup Description: The function getNumAttrs should be in H5Location so that when an attribute is the location, the function will get the number of attributes belong to the object, which the invoking attribute is attached to. Platforms tested: Linux/64 (jelly) Linux/64 (platypus) Darwin (osx1010test) Updated for 1.8.21 Added C++ wrappers Description: - Added the following wrappers to class H5::H5Location: + H5Lcreate_soft: changed name from newLink to link // Creates a soft link from link_name to target_name. void link(const char *target_name, const char *link_name,...) void link(const H5std_string& target_name,...)
-rw-r--r--c++/src/H5AbstractDs.cpp2
-rw-r--r--c++/src/H5ArrayType.cpp2
-rw-r--r--c++/src/H5AtomType.cpp2
-rw-r--r--c++/src/H5Attribute.cpp2
-rw-r--r--c++/src/H5Attribute.h4
-rw-r--r--c++/src/H5CommonFG.cpp64
-rw-r--r--c++/src/H5CommonFG.h16
-rw-r--r--c++/src/H5CompType.cpp2
-rw-r--r--c++/src/H5Cpp.h4
-rw-r--r--c++/src/H5DataSet.cpp2
-rw-r--r--c++/src/H5DataType.cpp2
-rw-r--r--c++/src/H5DcreatProp.cpp2
-rw-r--r--c++/src/H5EnumType.cpp2
-rw-r--r--c++/src/H5FloatType.cpp2
-rw-r--r--c++/src/H5Group.h9
-rw-r--r--c++/src/H5IntType.cpp2
-rw-r--r--c++/src/H5Location.cpp748
-rw-r--r--c++/src/H5Location.h113
-rw-r--r--c++/src/H5Object.cpp53
-rw-r--r--c++/src/H5PredType.cpp2
-rw-r--r--c++/src/H5StrType.cpp2
-rw-r--r--c++/src/H5StrcreatProp.cpp30
-rw-r--r--c++/src/H5StrcreatProp.h6
-rw-r--r--c++/src/H5VarLenType.cpp2
-rw-r--r--c++/test/tlinks.cpp366
-rw-r--r--release_docs/RELEASE.txt94
26 files changed, 1159 insertions, 376 deletions
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp
index 1391b44..92733ab 100644
--- a/c++/src/H5AbstractDs.cpp
+++ b/c++/src/H5AbstractDs.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp
index b0d65b0..857729c 100644
--- a/c++/src/H5ArrayType.cpp
+++ b/c++/src/H5ArrayType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp
index 75180c5..bd46d7b 100644
--- a/c++/src/H5AtomType.cpp
+++ b/c++/src/H5AtomType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index 739cda7..207d73c 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -27,6 +27,8 @@
#include "H5FcreatProp.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h
index 9ac21b5..cb07ab7 100644
--- a/c++/src/H5Attribute.h
+++ b/c++/src/H5Attribute.h
@@ -47,8 +47,8 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
H5std_string getName() const;
ssize_t getName(H5std_string& attr_name, size_t len = 0) const;
// The overloaded function below is replaced by the one above and it
- // is kept for backward compatibility purpose.
- ssize_t getName(size_t buf_size, H5std_string& attr_name) const;
+ // is kept for backward compatibility purpose. Removed in 1.8.21.
+ // ssize_t getName(size_t buf_size, H5std_string& attr_name) const;
// Gets a copy of the dataspace for this attribute.
virtual DataSpace getSpace() const;
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index 97900f6..314a9fe 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -299,13 +299,16 @@ void CommonFG::link(H5L_type_t link_type, const H5std_string& curr_name, const H
link(link_type, curr_name.c_str(), new_name.c_str());
}
+#if 0
//--------------------------------------------------------------------------
// Function: CommonFG::unlink
-///\brief Removes the specified name at this location.
+///\brief Deprecated - replaced by H5Location::unlink
///\param name - IN: Name of the object to be removed
///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
// Modification
+// May 2018:
+// This function is deprecated immediately, in 1.8.21, because
+// its replacement has two arguments and one of them is a default.
// 2007: QAK modified to use H5L APIs - BMR
//--------------------------------------------------------------------------
void CommonFG::unlink(const char* name) const
@@ -317,15 +320,17 @@ void CommonFG::unlink(const char* name) const
//--------------------------------------------------------------------------
// Function: CommonFG::unlink
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+///\brief Deprecated - replaced by H5Location::unlink
+// Modification
+// May 2018:
+// This function is deprecated immediately, in 1.8.21, because
+// its replacement has two arguments and one of them is a default.
//--------------------------------------------------------------------------
void CommonFG::unlink(const H5std_string& name) const
{
unlink(name.c_str());
}
+#endif
//--------------------------------------------------------------------------
// Function: CommonFG::move
@@ -338,9 +343,10 @@ void CommonFG::unlink(const H5std_string& name) const
/// data in a file inaccessible with Group::move. Please refer
/// to the Group Interface in the HDF5 User's Guide for details at:
/// https://support.hdfgroup.org/HDF5/doc/UG/HDF5_Users_Guide-Responsive%20HTML5/index.html#t=HDF5_Users_Guide%2FGroups%2FHDF5_Groups.htm
-// Programmer Binh-Minh Ribler - 2000
+// 2000
// Modification
// 2007: QAK modified to use H5L APIs - BMR
+// May 2018: Deprecated in favor of H5Location::moveLink (1.8.21)
//--------------------------------------------------------------------------
void CommonFG::move(const char* src, const char* dst) const
{
@@ -354,7 +360,9 @@ void CommonFG::move(const char* src, const char* dst) 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 src and \a dst.
-// Programmer Binh-Minh Ribler - 2000
+// 2000
+// Modification
+// May 2018: Deprecated in favor of H5Location::moveLink (1.8.21)
//--------------------------------------------------------------------------
void CommonFG::move(const H5std_string& src, const H5std_string& dst) const
{
@@ -422,6 +430,8 @@ void CommonFG::getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+#if 0
+// Moved to H5Location in 1.8.21
//--------------------------------------------------------------------------
// Function: CommonFG::getLinkval
///\brief Returns the name of the object that the symbolic link points to.
@@ -480,6 +490,8 @@ H5std_string CommonFG::getLinkval(const H5std_string& name, size_t size) const
return(getLinkval(name.c_str(), size));
}
+#endif
+
//--------------------------------------------------------------------------
// Function: CommonFG::mount
///\brief Mounts the file \a child onto this group.
@@ -507,26 +519,6 @@ void CommonFG::mount(const char* name, const H5File& child, const PropList& plis
//--------------------------------------------------------------------------
// Function: CommonFG::mount
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const's. This wrapper will be removed in future release.
-// Param name - IN: Name of the group
-// Param child - IN: File to mount
-// Param plist - IN: Property list to use
-// Exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
-// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
-//--------------------------------------------------------------------------
-//void CommonFG::mount(const char* name, H5File& child, PropList& plist) const
-//{
-// mount(name, child, plist);
-//}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::mount
///\brief This is an overloaded member function, provided for convenience.
/// It takes an \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
@@ -539,22 +531,6 @@ void CommonFG::mount(const H5std_string& name, const H5File& child, const PropLi
}
//--------------------------------------------------------------------------
-// Function: CommonFG::mount
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const's. This wrapper will be removed in future release.
-// Programmer Binh-Minh Ribler - 2014
-// Modification
-// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
-// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
-//--------------------------------------------------------------------------
-//void CommonFG::mount(const H5std_string& name, H5File& child, PropList& plist) const
-//{
-// mount(name.c_str(), child, plist);
-//}
-
-//--------------------------------------------------------------------------
// Function: CommonFG::unmount
///\brief Unmounts the specified file.
///\param name - IN: Name of the file to unmount
diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h
index 5e43d8c..fa08263 100644
--- a/c++/src/H5CommonFG.h
+++ b/c++/src/H5CommonFG.h
@@ -47,8 +47,9 @@ class H5_DLLCPP CommonFG {
DataSet openDataSet(const H5std_string& name) const;
// Returns the value of a symbolic link.
- H5std_string getLinkval(const char* link_name, size_t size=0) const;
- H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
+ // Moved to H5Location in 1.8.21.
+ //H5std_string getLinkval(const char* link_name, size_t size=0) const;
+ //H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
// Returns the number of objects in this group.
hsize_t getNumObjs() const;
@@ -92,24 +93,27 @@ class H5_DLLCPP CommonFG {
// Creates a link of the specified type from new_name to current_name;
// both names are interpreted relative to the specified location id.
+ // Deprecated in favor of H5Location::link overloaded (1.8.21)
void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const;
void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const;
// Removes the specified name at this location.
- void unlink(const char* name) const;
- void unlink(const H5std_string& name) const;
+ // Deprecated in favor of H5Location::unlink overloaded (1.8.21)
+ // These functions can be removed immediately because their replacements
+ // have a default argument out of two.
+ //void unlink(const char* name) const;
+ //void unlink(const H5std_string& name) const;
// Mounts the file 'child' onto this location.
void mount(const char* name, const H5File& child, const PropList& plist) const;
- //void mount(const char* name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1
void mount(const H5std_string& name, const H5File& child, const PropList& plist) const;
- //void mount(const H5std_string& name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1
// Unmounts the file named 'name' from this parent location.
void unmount(const char* name) const;
void unmount(const H5std_string& name) const;
// Renames an object at this location.
+ // Deprecated in favor of H5Location::moveLink (1.8.21)
void move(const char* src, const char* dst) const;
void move(const H5std_string& src, const H5std_string& dst) const;
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index 903a7c4..5ff610e 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h
index af7d1e5fa..4108831 100644
--- a/c++/src/H5Cpp.h
+++ b/c++/src/H5Cpp.h
@@ -20,6 +20,8 @@
#include "H5IdComponent.h"
#include "H5DataSpace.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -27,9 +29,7 @@
#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"
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 1dce28e..f8277f9 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -23,6 +23,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index dc9b422..3ed8113 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -23,6 +23,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp
index 8e2468b..2e5b2e4 100644
--- a/c++/src/H5DcreatProp.cpp
+++ b/c++/src/H5DcreatProp.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp
index 4b06ca5..9bd359a 100644
--- a/c++/src/H5EnumType.cpp
+++ b/c++/src/H5EnumType.cpp
@@ -18,6 +18,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp
index 05284f9..fb9fe58 100644
--- a/c++/src/H5FloatType.cpp
+++ b/c++/src/H5FloatType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h
index 20637b7..88c1a3b 100644
--- a/c++/src/H5Group.h
+++ b/c++/src/H5Group.h
@@ -55,6 +55,15 @@ class H5_DLLCPP Group : public H5Object, public CommonFG {
// Creates a copy of an existing group using its id.
Group(const hid_t group_id);
+ // The "using" lines below are to avoid the compilation error
+ // "error: request for member ‘link’ is ambiguous" when both CommonFG and
+ // H5Location have overloaded functions of the same name. CommonFG's
+ // member functions need to be kept for backward compatibility for a while.
+ // They can be removed after these functions are removed.
+ // -BMR, May 2018
+ using H5Location::link;
+ using CommonFG::link;
+
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Sets the group id.
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp
index 6af2dc2..8861434 100644
--- a/c++/src/H5IntType.cpp
+++ b/c++/src/H5IntType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index 43ba34c..6894fdd 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -18,13 +18,21 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5FaccProp.h"
+#include "H5FcreatProp.h"
+#include "H5OcreatProp.h"
+#include "H5DcreatProp.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
-#include "H5Attribute.h"
+#include "H5CommonFG.h"
+#include "H5Group.h"
+#include "H5File.h"
namespace H5 {
@@ -87,139 +95,15 @@ H5Location::H5Location() : IdComponent() {}
Notes for H5A wrappers
======================
May, 2017 (1.8.19)
- These H5A wrappers are copied to H5Object to prevent an attribute
+ The H5A wrappers are copied to H5Object to prevent an attribute
id being passed in to H5A APIs. The original H5A wrapper functions
here will be deprecated in future releases.
+May, 2018 (1.8.21)
+ They are removed from 1.8.21
***************************************************************************/
//--------------------------------------------------------------------------
-// Function: H5Location::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
-///\param data_space - IN: Dataspace for the attribute - only simple
-/// dataspaces are allowed at this time
-///\param create_plist - IN: Creation property list - default to
-/// PropList::DEFAULT
-///\return Attribute instance
-///\exception H5::AttributeIException
-///\par Description
-/// The attribute name specified in \a name must be unique.
-/// Attempting to create an attribute with the same name as an
-/// existing attribute will raise an exception, leaving the
-/// pre-existing attribute intact. To overwrite an existing
-/// attribute with a new attribute of the same name, first
-/// delete the existing one with \c 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
-{
- hid_t type_id = data_type.getId();
- hid_t space_id = data_space.getId();
- hid_t plist_id = create_plist.getId();
- hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT);
-
- // If the attribute id is valid, create and return the Attribute object
- if(attr_id > 0)
- {
- Attribute attr;
- f_Attribute_setId(&attr, attr_id);
- return(attr);
- }
- else
- throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::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
-{
- return(createAttribute(name.c_str(), data_type, data_space, create_plist));
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::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
-{
- hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT);
- if(attr_id > 0)
- {
- Attribute attr;
- f_Attribute_setId(&attr, attr_id);
- return(attr);
- }
- else
- {
- throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed");
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::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
-{
- return(openAttribute(name.c_str()));
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::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
-{
- hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER,
- H5_ITER_INC, static_cast<hsize_t>(idx), H5P_DEFAULT, H5P_DEFAULT);
- if(attr_id > 0)
- {
- Attribute attr;
- f_Attribute_setId(&attr, attr_id);
- return(attr);
- }
- else
- {
- throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed");
- }
-}
-
-//--------------------------------------------------------------------------
// Function: H5Location::iterateAttrs
///\brief Iterates a user's function over all the attributes of an H5
/// object, which may be a group, dataset or named datatype.
@@ -264,128 +148,17 @@ int H5Location::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_d
}
//--------------------------------------------------------------------------
-// Function: H5Location::attrExists
-///\brief Deprecated - replaced by H5Object::attrExists()
-// brief Checks whether the named attribute exists at this location.
-///\param name - IN: Name of the attribute to be queried
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2013
-// Modification
-// - Moved to H5Object in 1.8.19. -BMR
-//--------------------------------------------------------------------------
-bool H5Location::attrExists(const char* name) const
-{
- // Call C routine H5Aexists to determine whether an attribute exists
- // at this location, which could be specified by a file, group, dataset,
- // or named datatype.
- herr_t ret_value = H5Aexists(getId(), name);
- if(ret_value > 0)
- return true;
- else if(ret_value == 0)
- return false;
- else // Raise exception when H5Aexists returns a negative value
- throw AttributeIException(inMemFunc("attrExists"), "H5Aexists failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::attrExists
-///\brief Deprecated - replaced by H5Object::attrExists()
-// brief This is an overloaded member function, provided for convenience.
-// It differs from the above function in that it takes
-// a reference to an \c H5std_string for \a name.
-///\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
-{
- return(attrExists(name.c_str()));
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::removeAttr
-///\brief Deprecated - replaced by H5Object::removeAttr()
-// brief Removes the named attribute from this object.
-///\param name - IN: Name of the attribute to be removed
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// - Moved to H5Object in 1.8.19. -BMR
-//--------------------------------------------------------------------------
-void H5Location::removeAttr(const char* name) const
-{
- herr_t ret_value = H5Adelete(getId(), name);
- if(ret_value < 0)
- throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::removeAttr
-///\brief Deprecated - replaced by H5Object::removeAttr()
-// brief This is an overloaded member function, provided for convenience.
-// It differs from the above function in that it takes
-// a reference to an \c H5std_string for \a name.
-///\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
-{
- removeAttr(name.c_str());
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::renameAttr
-///\brief Deprecated - replaced by H5Object::renameAttr()
-// brief Renames the named attribute from this object.
-///\param oldname - IN: Name of the attribute to be renamed
-///\param newname - IN: New name ame of the attribute
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - Mar, 2005
-// Modification
-// - Moved to H5Object in 1.8.19. -BMR
-//--------------------------------------------------------------------------
-void H5Location::renameAttr(const char* oldname, const char* newname) const
-{
- herr_t ret_value = H5Arename(getId(), oldname, newname);
- if (ret_value < 0)
- throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::renameAttr
-///\brief Deprecated - replaced by H5Object::renameAttr()
-// brief This is an overloaded member function, provided for convenience.
-// It differs from the above function in that it takes
-// a reference to an \c H5std_string for the names.
-//
-///\param oldname - IN: Name of the attribute to be renamed
-///\param newname - IN: New name ame of the attribute
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - Mar, 2005
-// Modification
-// - Moved to H5Object in 1.8.19. -BMR
-//--------------------------------------------------------------------------
-void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& newname) const
-{
- renameAttr (oldname.c_str(), newname.c_str());
-}
-
-//--------------------------------------------------------------------------
// Function: H5Location::getNumAttrs
-///\brief Deprecated - replaced by H5Object::getNumAttrs()
-// brief Returns the number of attributes attached to this HDF5 object.
+///\brief Returns the number of attributes attached to an HDF5 object.
///\return Number of attributes
///\exception H5::AttributeIException
-// 2000
// Modification
-// - Moved to H5Object in 1.8.19. -BMR
+// - Moved from H5Object to allow passing an attribute id to the
+// C API, in 1.8.20.
//--------------------------------------------------------------------------
int H5Location::getNumAttrs() const
{
- H5O_info_t objinfo; /* Object info */
+ H5O_info_t objinfo; /* Object info */
if(H5Oget_info(getId(), &objinfo) < 0)
throwException("getNumAttrs", "H5Oget_info failed");
@@ -404,7 +177,7 @@ int H5Location::getNumAttrs() const
/// H5::DataSetIException
/// H5::DataTypeIException
/// H5::AttributeIException
-// Nov 2016
+// December 2016
//--------------------------------------------------------------------------
bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const
{
@@ -424,9 +197,13 @@ bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const
///\brief Checks if a link of a given name exists in a location.
///\param name - IN: Searched name - \c H5std_string
///\param lapl - IN: Link access property list
-///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - Dec, 2016
-// Modification
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// December 2016
//--------------------------------------------------------------------------
bool H5Location::nameExists(const H5std_string& name, const LinkAccPropList& lapl) const
{
@@ -807,6 +584,12 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) 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.
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
// July 2004
// Modification
// Moved from CommonFG, Sep 2013
@@ -850,7 +633,12 @@ hid_t H5Location::openObjId(const char* obj_name, const LinkAccPropList& lapl) c
///\param obj_name - IN: Path to the object
///\param lapl - IN: Access property list for the link pointing to
/// the object
-///\exception H5::LocationException
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
// May 2017
//--------------------------------------------------------------------------
hid_t H5Location::openObjId(const H5std_string& obj_name, const LinkAccPropList& lapl) const
@@ -1040,15 +828,18 @@ void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t
///\param ref - IN: Reference pointer
///\param ref_type - IN: Reference type
///\exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
+// October 2006
// Modification
// May, 2008
// Corrected missing parameters. - BMR
+// May, 2018
+// Removed in 1.8.21 because H5Location is Attribute's baseclass
+// now. -BMR
//--------------------------------------------------------------------------
-void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type)
-{
- p_setId(p_dereference(attr.getId(), ref, ref_type, "dereference"));
-}
+//void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type)
+//{
+ //p_setId(p_dereference(attr.getId(), ref, ref_type, "dereference"));
+//}
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
@@ -1203,6 +994,443 @@ DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const
}
//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief Creates a soft link from \a link_name to \a target_name.
+///\param target_name - IN: Name of object, can be a non-existing object
+///\param link_name - IN: Link name for the target name
+///\param lcpl - IN: Link creation plist - default to LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default to LinkAccPropList::DEFAULT
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+///\par Description
+/// Note that both names are interpreted relative to the current
+/// location.
+/// For information on creating a soft link, please refer to the
+/// H5Lcreate_soft APIs in the HDF5 C Reference Manual.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const char *target_name, const char *link_name,
+ const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+{
+ herr_t ret_value = -1;
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lcreate_soft(target_name, getId(), link_name, lcpl_id, lapl_id);
+ if (ret_value < 0)
+ throwException("link", "creating soft link failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a target_name and \a link_name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const H5std_string& target_name,
+ const H5std_string& link_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ link(target_name.c_str(), link_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief Creates a hard link from \a new_name to \a curr_name.
+///\param curr_name - IN: Name of the existing object
+///\param new_loc - IN: New location
+///\param new_name - IN: New name for the object
+///\param lcpl - IN: Link creation plist - default to LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default to LinkAccPropList::DEFAULT
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+///\par Description
+/// Note that both names are interpreted relative to the
+/// specified location.
+/// For information on creating a hard link, please refer to the
+/// H5Lcreate_hard APIs in the HDF5 C Reference Manual.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const char *curr_name, const H5Location& new_loc,
+ const char *new_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ herr_t ret_value = -1;
+ hid_t new_loc_id = new_loc.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lcreate_hard(getId(), curr_name, new_loc.getId(), new_name, lcpl_id, lapl_id);
+ if (ret_value < 0)
+ throwException("link", "creating link failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a curr_name and \a new_name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const H5std_string& curr_name, const H5Location& new_loc,
+ const H5std_string& new_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ link(curr_name.c_str(), new_loc, new_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief Creates a hard link from \a new_name to \a curr_name - can be
+/// used to pass in H5L_SAME_LOC.
+///\param curr_name - IN: Name of the existing object
+///\param loc_id - IN: Location ID, or H5L_SAME_LOC
+///\param new_name - IN: New name for the link
+///\param lcpl - IN: Link creation plist - default to LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default to LinkAccPropList::DEFAULT
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+///\par Description
+/// Note that both names are interpreted relative to the
+/// specified location.
+/// For information on creating a hard link, please refer to the
+/// H5Lcreate_hard APIs in the HDF5 C Reference Manual.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const char *curr_name, const hid_t same_loc,
+ const char *new_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ herr_t ret_value = -1;
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lcreate_hard(getId(), curr_name, same_loc, new_name, lcpl_id, lapl_id);
+
+ if (ret_value < 0)
+ throwException("link", "creating link failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a curr_name and \a new_name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const H5std_string& curr_name, const hid_t same_loc,
+ const H5std_string& new_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ link(curr_name.c_str(), same_loc, new_name.c_str(), lcpl, lapl);
+}
+
+
+//--------------------------------------------------------------------------
+// Function: H5Location::copyLink
+///\brief Copies a link from one location to another.
+///\param src_name - IN: Original name
+///\param dst - IN: Destination location
+///\param dst_name - IN: New name
+///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::copyLink(const char *src_name, const H5Location& dst,
+ const char *dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ herr_t ret_value;
+ hid_t dst_id = dst.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lcopy(getId(), src_name, dst_id, dst_name, lcpl_id, lapl_id);
+ if(ret_value < 0)
+ throwException("copyLink", "H5Lcopy failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::copyLink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a src_name and \a dst_name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::copyLink(const H5std_string& src_name, const H5Location& dst,
+ const H5std_string& dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ copyLink(src_name.c_str(), dst, dst_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::copyLink
+///\brief Copies a link from a location into the same location.
+///\param src_name - IN: Original name
+///\param dst_name - IN: New name
+///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::copyLink(const char *src_name,
+ const char *dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ herr_t ret_value;
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lcopy(getId(), src_name, H5L_SAME_LOC, dst_name, lcpl_id, lapl_id);
+ if(ret_value < 0)
+ throwException("copyLink", "H5Lcopy H5L_SAME_LOC failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::copyLink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a src_name and \a dst_name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::copyLink(const H5std_string& src_name,
+ const H5std_string& dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ copyLink(src_name.c_str(), dst_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::moveLink
+///\brief Renames a link in this location and moves it to a new location.
+///\param src_name - IN: Original name
+///\param dst - IN: Destination location
+///\param dst_name - IN: New name
+///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+///\note
+/// Exercise care in moving groups as it is possible to render
+/// data in a file inaccessible with H5Location::moveLink. Please refer
+/// to the Group Interface in the HDF5 User's Guide for details.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::moveLink(const char* src_name, const H5Location& dst,
+ const char* dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ herr_t ret_value;
+ hid_t dst_id = dst.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lmove(getId(), src_name, dst_id, dst_name, lcpl_id, lapl_id);
+ if (ret_value < 0)
+ throwException("moveLink", "H5Lmove failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::moveLink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a src_name and \a dst_name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::moveLink(const H5std_string& src_name, const H5Location& dst,
+ const H5std_string& dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ moveLink(src_name.c_str(), dst, dst_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::moveLink
+///\brief Renames a link in this location.
+///\param src_name - IN: Original name
+///\param dst_name - IN: New name
+///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+///\note
+/// Exercise care in moving groups as it is possible to render
+/// data in a file inaccessible with H5Location::moveLink. Please refer
+/// to the Group Interface in the HDF5 User's Guide for details.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::moveLink(const char* src_name, const char* dst_name,
+ const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+{
+ herr_t ret_value;
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lmove(getId(), src_name, H5L_SAME_LOC, dst_name, lcpl_id, lapl_id);
+ if (ret_value < 0)
+ throwException("moveLink", "H5Lmove H5L_SAME_LOC failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::moveLink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a src_name and \a dst_name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::moveLink(const H5std_string& src_name,
+ const H5std_string& dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ moveLink(src_name.c_str(), dst_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::unlink
+///\brief Removes the specified link from this location.
+///\param name - IN: Name of the object to be removed
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// May 2018
+// Developer's Note
+// Originally, CommonFG::unlink was the wrapper of H5Gunlink,
+// which was replaced by H5Ldelete. The name "unlink" was kept
+// to help with backward compatibility.
+//--------------------------------------------------------------------------
+void H5Location::unlink(const char* name, const LinkAccPropList& lapl) const
+{
+ herr_t ret_value = H5Ldelete(getId(), name, lapl.getId());
+ if (ret_value < 0)
+ throwException("unlink", "H5Ldelete failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::unlink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::unlink(const H5std_string& name, const LinkAccPropList& lapl) const
+{
+ unlink(name.c_str(), lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::getLinkInfo
+///\brief Returns the information of the named link.
+///\param link_name - IN: Symbolic link to the object
+///\param size - IN: Maximum number of characters of value to be returned
+///\return Name of the object
+///\exception H5::FileIException/H5::GroupIException/H5::LocationException
+// 2000
+//--------------------------------------------------------------------------
+H5L_info_t H5Location::getLinkInfo(const char* link_name, const LinkAccPropList& lapl) const
+{
+ H5L_info_t linkinfo; // link info structure
+
+ herr_t ret_value = H5Lget_info(getId(), link_name, &linkinfo, lapl.getId());
+ if (ret_value < 0)
+ throwException("getLinkInfo", "H5Lget_info to find buffer size failed");
+
+ return(linkinfo);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::getLinkInfo
+///\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 link_name.
+//--------------------------------------------------------------------------
+H5L_info_t H5Location::getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl) const
+{
+ return(getLinkInfo(link_name.c_str(), lapl));
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::getLinkval
+///\brief Returns the name of the object that the symbolic link points to.
+///\param name - IN: Symbolic link to the object
+///\param size - IN: Maximum number of characters of value to be returned
+///\return Name of the object
+///\exception H5::FileIException/H5::GroupIException/H5::LocationException
+// 2000
+//--------------------------------------------------------------------------
+H5std_string H5Location::getLinkval(const char* name, size_t size) const
+{
+ H5L_info_t linkinfo;
+ char *value_C; // value in C string
+ size_t val_size = size;
+ H5std_string value = "";
+ herr_t ret_value;
+
+ // if user doesn't provide buffer size, determine it
+ if (size == 0)
+ {
+ ret_value = H5Lget_info(getId(), name, &linkinfo, H5P_DEFAULT);
+ if (ret_value < 0)
+ throwException("getLinkval", "H5Lget_info to find buffer size failed");
+
+ val_size = linkinfo.u.val_size;
+ }
+
+ // if link has value, retrieve the value, otherwise, return null string
+ if (val_size > 0)
+ {
+ value_C = new char[val_size+1]; // temporary C-string for C API
+ HDmemset(value_C, 0, val_size+1); // clear buffer
+
+ ret_value = H5Lget_val(getId(), name, value_C, val_size, H5P_DEFAULT);
+ if (ret_value < 0)
+ {
+ delete []value_C;
+ throwException("getLinkval", "H5Lget_val failed");
+ }
+
+ value = H5std_string(value_C);
+ delete []value_C;
+ }
+ return(value);
+}
+
+//--------------------------------------------------------------------------
// Function: H5Location destructor
///\brief Noop destructor.
// Programmer Binh-Minh Ribler - 2000
@@ -1211,18 +1439,10 @@ H5Location::~H5Location() {}
//--------------------------------------------------------------------------
// Function: f_Attribute_setId - friend
-// Purpose: This function is friend to class H5::Attribute so that it
-// can set Attribute::id in order to work around a problem
-// described in the JIRA issue HDFFV-7947.
-// Applications shouldn't need to use it.
-// param attr - IN/OUT: Attribute object to be changed
-// param new_id - IN: New id to set
-// Programmer Binh-Minh Ribler - 2015
+// 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 0316a53..e76a6fc 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -41,6 +41,9 @@ class UserData4Aiterate { // user data for attribute iteration
// Inheritance: IdComponent
class H5_DLLCPP H5Location : public IdComponent {
public:
+ // Determines the number of attributes belong to this object.
+ int getNumAttrs() const;
+
// Checks if a link of a given name exists in this location
bool nameExists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
bool nameExists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
@@ -60,10 +63,6 @@ class H5_DLLCPP H5Location : public IdComponent {
void getObjectInfo(const H5std_string& name, H5O_info_t *oinfo,
const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- // Determines the number of attributes at this location.
- // - moved to H5Object (1.8.20)
- int getNumAttrs() const; // Deprecated
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Retrieves the type of object that an object reference points to.
H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
@@ -118,6 +117,87 @@ class H5_DLLCPP H5Location : public IdComponent {
// Closes an object opened by openObjId()
static void closeObjId(hid_t obj_id);
+ // Creates a soft link from link_name to target_name.
+ void link(const char *target_name, const char *link_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void link(const H5std_string& target_name,
+ const H5std_string& link_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Creates a hard link from new_name to curr_name.
+ void link(const char *curr_name,
+ const H5Location& new_loc, const char *new_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void link(const H5std_string& curr_name,
+ const H5Location& new_loc, const H5std_string& new_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Creates a hard link from new_name to curr_name in same location.
+ void link(const char *curr_name,
+ const hid_t same_loc, const char *new_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void link(const H5std_string& curr_name,
+ const hid_t same_loc, const H5std_string& new_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Removes the specified link from this location.
+ void unlink(const char *link_name,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void unlink(const H5std_string& link_name,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Copies a link from this location to another.
+ void copyLink(const char *src_name,
+ const H5Location& dst, const char *dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void copyLink(const H5std_string& src_name,
+ const H5Location& dst, const H5std_string& dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Makes a copy of a link in the same location.
+ void copyLink(const char *src_name, const char *dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void copyLink(const H5std_string& src_name,
+ const H5std_string& dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Renames a link in this location and moves to a new location.
+ void moveLink(const char* src_name,
+ const H5Location& dst, const char* dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void moveLink(const H5std_string& src_name,
+ const H5Location& dst, const H5std_string& dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Renames a link in this location.
+ void moveLink(const char* src_name, const char* dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void moveLink(const H5std_string& src_name,
+ const H5std_string& dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Returns the information of the named link.
+ H5L_info_t getLinkInfo(const char* link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ H5L_info_t getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Returns the value of a symbolic link.
+ H5std_string getLinkval(const char* link_name, size_t size=0) const;
+ H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
+
///\brief Returns an identifier. (pure virtual)
virtual hid_t getId() const = 0;
@@ -127,23 +207,24 @@ class H5_DLLCPP H5Location : public IdComponent {
These H5A wrappers are marked "deprecated" in 1.8.19.
They are moved to H5Object to prevent the object id from being
passed in to H5A APIs.
+ Updated: they are removed from source code in 1.8.21.
***************************************************************************/
// Creates an attribute for the specified object at this location
// PropList is currently not used, so always be default.
// Deprecated
- virtual Attribute createAttribute(const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
- virtual Attribute createAttribute(const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
+ //virtual Attribute createAttribute(const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
+ //virtual Attribute createAttribute(const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
// Given its name, opens the attribute that belongs to an object at
// this location.
// Deprecated
- virtual Attribute openAttribute(const char* name) const;
- virtual Attribute openAttribute(const H5std_string& name) const;
+ //virtual Attribute openAttribute(const char* name) const;
+ //virtual Attribute openAttribute(const H5std_string& name) const;
// Given its index, opens the attribute that belongs to an object at
// this location.
- virtual Attribute openAttribute(const unsigned int idx) const; // Deprecated
+ //virtual Attribute openAttribute(const unsigned int idx) const; // Deprecated
// Iterate user's function over the attributes at this location.
virtual int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL,
@@ -151,24 +232,24 @@ class H5_DLLCPP H5Location : public IdComponent {
// Checks whether the named attribute exists at this location.
// Deprecated
- virtual bool attrExists(const char* name) const;
- virtual bool attrExists(const H5std_string& name) const;
+ //virtual bool attrExists(const char* name) const;
+ //virtual bool attrExists(const H5std_string& name) const;
// Renames the named attribute to a new name.
// Deprecated
- virtual void renameAttr(const char* oldname, const char* newname) const;
- virtual void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
+ //virtual void renameAttr(const char* oldname, const char* newname) const;
+ //virtual void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
// Removes the named attribute from this location.
// Deprecated
- virtual void removeAttr(const char* name) const;
- virtual void removeAttr(const H5std_string& name) const;
+ //virtual void removeAttr(const char* name) const;
+ //virtual void removeAttr(const H5std_string& name) const;
/**************************** End of H5A note *******************************/
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Default constructor,
+ // Default constructor
H5Location();
// *** Deprecation warning ***
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 4697d9c..868a5d3 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -25,6 +25,8 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5DataSpace.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5AbstractDs.h"
#include "H5LaccProp.h"
#include "H5Location.h"
@@ -34,11 +36,6 @@
namespace H5 {
-#ifndef H5_NO_STD
- using std::cerr;
- using std::endl;
-#endif // H5_NO_STD
-
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// userAttrOpWrpr simply interfaces between the user's function and the
// C library function H5Aiterate2; used to resolve the different prototype
@@ -64,32 +61,19 @@ namespace H5 {
H5Object::H5Object() : H5Location() {}
//--------------------------------------------------------------------------
-// Function: H5Object overloaded constructor (protected)
-// Purpose Creates an H5Object object using the id of an existing HDF5
-// object.
-// Parameters object_id - IN: Id of an existing HDF5 object
-// Programmer Binh-Minh Ribler - 2000
-// *** Deprecation warning ***
-// This constructor is no longer appropriate because the data member "id" had
-// been moved to the sub-classes. It will be removed in 1.10 release. If its
-// removal does not raise any problems in 1.10, it will be removed from 1.8 in
-// subsequent releases.
-// Removed in 1.8.18 and 1.10.1 - Aug 2016
+// 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
//--------------------------------------------------------------------------
-//H5Object::H5Object(const hid_t object_id) : H5Location() {}
-
-//--------------------------------------------------------------------------
-// Function: H5Object copy constructor
-///\brief Copy constructor: makes a copy of the original H5Object
-/// instance.
-///\param original - IN: H5Object instance to copy
-// Programmer Binh-Minh Ribler - 2000
-// *** Deprecation warning ***
-// This constructor is no longer appropriate because the data member "id" had
-// been moved to the sub-classes. It is removed from 1.8.15 because it is
-// a noop and it can be generated by the compiler if needed.
-//--------------------------------------------------------------------------
-// H5Object::H5Object(const H5Object& original) : H5Location() {}
+void f_Attribute_setId(Attribute* attr, hid_t new_id)
+{
+ attr->p_setId(new_id);
+}
/***************************************************************************
Notes for H5A wrappers
@@ -301,12 +285,14 @@ void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newna
//--------------------------------------------------------------------------
// Function: H5Object::getNumAttrs
-///\brief Returns the number of attributes attached to this HDF5 object.
+///\brief Deprecated - replaced by H5Location::getNumAttrs()
+// brief Returns the number of attributes attached to this HDF5 object.
///\return Number of attributes
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
// Modification
-// - Moved from H5Location in 1.8.20. -BMR Oct, 2017
+// - Moved to H5Location to allow passing an attribute id to the
+// C API, in 1.8.20.
//--------------------------------------------------------------------------
int H5Object::getNumAttrs() const
{
@@ -314,8 +300,7 @@ int H5Object::getNumAttrs() const
if(H5Oget_info(getId(), &oinfo) < 0)
throwException("getNumAttrs", "H5Oget_info failed");
- else
- return(static_cast<int>(oinfo.num_attrs));
+ return(static_cast<int>(oinfo.num_attrs));
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp
index 63061f7..0838f1c 100644
--- a/c++/src/H5PredType.cpp
+++ b/c++/src/H5PredType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp
index 00fbe20..c2c5b92 100644
--- a/c++/src/H5StrType.cpp
+++ b/c++/src/H5StrType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5StrcreatProp.cpp b/c++/src/H5StrcreatProp.cpp
index 79749d8..eb8ae6f 100644
--- a/c++/src/H5StrcreatProp.cpp
+++ b/c++/src/H5StrcreatProp.cpp
@@ -13,6 +13,11 @@
#include <string>
+#include <iostream>
+ using std::cerr;
+ using std::endl;
+
+
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -22,6 +27,31 @@
namespace H5 {
//--------------------------------------------------------------------------
+// Function: StrCreatPropList default constructor
+///\brief Default constructor: Creates a string create property list
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+StrCreatPropList::StrCreatPropList() : PropList(H5P_STRING_CREATE) {}
+
+//--------------------------------------------------------------------------
+// Function: StrCreatPropList copy constructor
+///\brief Copy constructor: makes a copy of the original
+/// StrCreatPropList object.
+///\param original - IN: StrCreatPropList instance to copy
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+StrCreatPropList::StrCreatPropList(const StrCreatPropList& original) : PropList(original) {}
+
+//--------------------------------------------------------------------------
+// Function: StrCreatPropList overloaded constructor
+///\brief Creates a file creation property list using the id of an
+/// existing one.
+///\param plist_id - IN: StrCreatPropList id to use
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+StrCreatPropList::StrCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
+
+//--------------------------------------------------------------------------
// Function: StrCreatPropList::setCharEncoding
///\brief Sets the character encoding of the string.
///\exception H5::PropListIException
diff --git a/c++/src/H5StrcreatProp.h b/c++/src/H5StrcreatProp.h
index 7b07dd6..9679a55 100644
--- a/c++/src/H5StrcreatProp.h
+++ b/c++/src/H5StrcreatProp.h
@@ -37,14 +37,14 @@ class H5_DLLCPP StrCreatPropList : public PropList {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
protected:
// Creates a link creation property list.
- StrCreatPropList() {};
+ StrCreatPropList();
// Copy constructor: same as the original StrCreatPropList.
- StrCreatPropList(const StrCreatPropList& original) {};
+ 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) {};
+ StrCreatPropList(const hid_t plist_id);
// Noop destructor
virtual ~StrCreatPropList() {};
diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp
index 8d9e3a1..902de79 100644
--- a/c++/src/H5VarLenType.cpp
+++ b/c++/src/H5VarLenType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp
index 356bc1b..ae0d53a 100644
--- a/c++/test/tlinks.cpp
+++ b/c++/test/tlinks.cpp
@@ -433,6 +433,366 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
} // test_basic_links
/*-------------------------------------------------------------------------
+ * Function: test_lcpl
+ *
+ * Purpose: Tests link creation property lists, specifically, the
+ * character encoding property.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ * May 2018
+ *-------------------------------------------------------------------------
+ */
+const H5std_string GROUP1NAME("First_group");
+const H5std_string GROUP2NAME("Second_group");
+static void
+test_lcpl(hid_t fapl_id, hbool_t new_format)
+{
+ H5L_info_t linfo;
+ char filename[1024];
+ hsize_t dims[2];
+
+ if(new_format)
+ SUBTEST("Link creation property lists (w/new group format)")
+ else
+ SUBTEST("Link creation property lists")
+
+ try
+ {
+ FileAccPropList fapl(fapl_id);
+
+ // Create a new file.
+ h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
+ H5File file(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+
+ // Create and link a group with the default LCPL.
+ Group grp_1(file.createGroup(GROUP1NAME));
+ grp_1.close();
+
+ // Check that its character encoding is the default.
+ linfo = file.getLinkInfo(GROUP1NAME);
+ if(linfo.cset != H5T_CSET_ASCII)
+ throw InvalidActionException("H5Lget_info", "Character encoding is not default");
+
+ // Create and commit a datatype with the default LCPL.
+ IntType dtype(PredType::NATIVE_INT);
+ dtype.commit(file, "/type");
+ dtype.close();
+
+ // Check that its character encoding is the default.
+ linfo = file.getLinkInfo("/type");
+ verify_val(linfo.cset, H5T_CSET_ASCII, "Character encoding is not default", __LINE__, __FILE__);
+
+ // Create a simple dataspace.
+ dims[0] = H5L_DIM1;
+ dims[1] = H5L_DIM2;
+ DataSpace dspace(2 ,dims);
+
+ // Create a dataset using the default LCPL.
+ DataSet dset(file.createDataSet("/dataset", PredType::NATIVE_INT, dspace));
+ dset.close();
+
+ // Check that its character encoding is the default.
+ linfo = file.getLinkInfo("/dataset");
+ verify_val(linfo.cset, H5T_CSET_ASCII, "Character encoding is not default", __LINE__, __FILE__);
+
+ // Create a link creation property list with the UTF-8 character encoding.
+ LinkCreatPropList lcpl;
+ lcpl.setCharEncoding(H5T_CSET_UTF8);
+
+ // Create and link a group with the new LCPL.
+ Group grp_2(file.createGroup(GROUP2NAME, 0, lcpl));
+ grp_2.close();
+
+ // Check that its character encoding is UTF-8.
+ linfo = file.getLinkInfo(GROUP2NAME);
+ verify_val(linfo.cset, H5T_CSET_UTF8, "Character encoding is not UTF-8", __LINE__, __FILE__);
+
+ PASSED();
+ } // end of try block
+ catch (Exception& E)
+ {
+ issue_fail_msg("test_lcpl()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+} // end test_lcpl()
+
+/*-------------------------------------------------------------------------
+ * Function: test_move
+ *
+ * Purpose: Tests wrappers of H5Lmove()
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ * May 2018
+ *-------------------------------------------------------------------------
+ */
+static void
+test_move(hid_t fapl_id, hbool_t new_format)
+{
+ char filename[1024];
+
+ if(new_format)
+ SUBTEST("Group::moveLink (w/new group format)")
+ else
+ SUBTEST("Group::moveLink")
+
+ try
+ {
+ FileAccPropList fapl(fapl_id);
+
+ // Create two new files
+ h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
+ H5File file_a(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+ h5_fixname(FILENAME[1], fapl_id, filename, sizeof filename);
+ H5File file_b(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+
+ // Create groups in first file
+ Group grp_1(file_a.createGroup(GROUP1NAME));
+ Group grp_2(file_a.createGroup(GROUP2NAME));
+ Group grp_move(grp_1.createGroup("group_move"));
+
+ // Create hard and soft links
+ grp_1.link(H5L_TYPE_HARD, "group_move", "hard");
+ grp_2.link(H5L_TYPE_SOFT, "/First_group/group_copy", "soft");
+
+ // Move a group across files, should fail
+ try {
+ grp_1.moveLink("group_move", file_b, "group_new_name");
+
+ // Should throw an exception but didn't
+ H5_FAILED();
+ cerr << " Group group_move should not be moved across files" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+
+ // Move a soft link across files, should succeed
+ grp_2.moveLink("soft", file_b, "soft_new_name");
+ if(file_b.nameExists("soft_new_name") != TRUE)
+ throw InvalidActionException("H5File::nameExists", "grp1/soft doesn't exist");
+
+ // Move a group across groups in the same file while renaming it
+ grp_1.moveLink("group_move", grp_2, "group_new_name");
+
+ // Open the group just moved to the new location. */
+ Group moved_grp = grp_2.openGroup("group_new_name");
+ moved_grp.close();
+
+ // Verify that the group is no longer in the original location
+ try {
+ moved_grp = grp_1.openGroup("group_move");
+
+ // Should throw an exception but didn't
+ H5_FAILED();
+ cerr << " Group group_move should not be in original location" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+
+ // Use H5Lmove to rename a group without moving it
+ H5std_string new_name("group_new_name");
+ H5std_string newer_name("group_newer_name");
+ grp_2.moveLink(new_name, newer_name);
+
+ // Open the group
+ moved_grp = grp_2.openGroup("group_newer_name");
+ moved_grp.close();
+
+ // Use H5Lmove to move a group without renaming it
+ grp_2.moveLink(newer_name, grp_1, newer_name);
+
+ // Open the group
+ moved_grp = grp_1.openGroup("group_newer_name");
+ moved_grp.close();
+
+ // Move the group while giving long paths
+ file_a.moveLink("/First_group/group_newer_name", grp_2, "/Second_group/group_newest_name");
+
+ // Open the group just moved to the new location
+ moved_grp = grp_2.openGroup("group_newest_name");
+ moved_grp.close();
+
+ // Verify that the groups are not in previous locations
+ try {
+ moved_grp = grp_1.openGroup("group_newer_name");
+ moved_grp.close();
+
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_newer_name should not be in GROUP1NAME" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+ try {
+ moved_grp = grp_2.openGroup("group_newer_name");
+ moved_grp.close();
+
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_newer_name should not be in GROUP2NAME" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+ try {
+ moved_grp = grp_2.openGroup("group_new_name");
+ moved_grp.close();
+
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_new_name should not be in GROUP2NAME" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+ try {
+ moved_grp = grp_1.openGroup("group_copy");
+ moved_grp.close();
+
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_copy should not be in GROUP1NAME" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+ PASSED();
+ } // end of try block
+ catch (Exception& E)
+ {
+ issue_fail_msg("test_move()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+} // test_move
+
+/*-------------------------------------------------------------------------
+ * Function: test_copy
+ *
+ * Purpose: Tests wrappers of H5Lcopy() and H5Ldelete()
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ * May 2018
+ *-------------------------------------------------------------------------
+ */
+static void test_copy(hid_t fapl_id, hbool_t new_format)
+{
+ char filename[1024];
+
+ if(new_format)
+ SUBTEST("Group::copyLink (w/new group format)")
+ else
+ SUBTEST("Group::copyLink")
+
+ try
+ {
+ // Create two new files
+ h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
+ H5File file_a(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl_id);
+ h5_fixname(FILENAME[1], fapl_id, filename, sizeof filename);
+ H5File file_b(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl_id);
+
+ // Create groups in first file
+ Group grp_1(file_a.createGroup(GROUP1NAME));
+ Group grp_2(file_a.createGroup(GROUP2NAME));
+ Group grp_move(grp_1.createGroup("group_copy"));
+
+ // Create hard and soft links
+ grp_1.link("group_copy", H5L_SAME_LOC, "hard");
+ grp_2.link("/First_group/group_copy", "soft");
+
+ // Copy a group across files, should fail
+ try {
+ grp_1.copyLink("group_copy", file_b, "group_new_name");
+ } catch (Exception& E) {
+ // expected
+ }
+
+ // Copy a soft link across files, should succeed
+ grp_2.copyLink("soft", file_b, "soft_new_name");
+ if (file_b.nameExists("soft_new_name") != TRUE)
+ throw InvalidActionException("H5File::nameExists", "soft_new_name doesn't exist");
+
+ // Move a group across groups in the same file while renaming it
+ H5std_string copy_name("group_copy");
+ H5std_string new_name("group_new_name");
+ grp_1.copyLink(copy_name, grp_2, new_name);
+
+ // Open the group just moved to the new location.
+ Group moved_grp(grp_2.openGroup("group_new_name"));
+ moved_grp.close();
+
+ // Verify that the group is also in the original location
+ moved_grp = grp_1.openGroup("group_copy");
+ moved_grp.close();
+
+ // Create a group in the same location with a different name
+ grp_2.copyLink("group_new_name", "group_newer_name");
+
+ // Open the group
+ moved_grp = grp_2.openGroup("group_newer_name");
+ moved_grp.close();
+
+ // Verify that the group is also in the original location
+ moved_grp = grp_2.openGroup("group_new_name");
+ moved_grp.close();
+
+ // Use H5Lcopy to copy to a different location with the same name
+ grp_2.copyLink("group_newer_name", grp_1, "group_newer_name");
+
+ // Open the group
+ moved_grp = grp_1.openGroup("group_newer_name");
+ moved_grp.close();
+
+ // Verify that the group is still in the previous location
+ moved_grp = grp_2.openGroup("group_new_name");
+ moved_grp.close();
+
+ // Copy the group while giving long paths
+ file_a.copyLink("/First_group/group_newer_name", grp_2, "/Second_group/group_newest_name");
+
+ // Open the newest group just moved to the new location
+ moved_grp = grp_2.openGroup("group_newest_name");
+ moved_grp.close();
+
+ // Verify that the group is still in all previous original locations
+ moved_grp = grp_1.openGroup("group_newer_name");
+ moved_grp.close();
+
+ moved_grp = grp_2.openGroup("group_newer_name");
+ moved_grp.close();
+
+ moved_grp = grp_2.openGroup("group_new_name");
+ moved_grp.close();
+
+ moved_grp = grp_1.openGroup("group_copy");
+ moved_grp.close();
+
+ // Delete "group_newer_name" from group 2, then try to open it.
+ grp_2.unlink("group_newer_name");
+ try {
+ moved_grp = grp_2.openGroup("group_newer_name");
+ moved_grp.close();
+
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_newer_name should not be in GROUP2NAME" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+
+ // Delete "group_copy" from group 1, then try to open it.
+ grp_1.unlink("group_copy");
+ try {
+ moved_grp = grp_1.openGroup("group_copy");
+ moved_grp.close();
+
+ H5_FAILED(); // Should throw an exception but didn't
+ cerr << " Group group_copy should not be in GROUP1NAME" << endl;
+ } catch (Exception& E) {
+ // expected
+ }
+
+ PASSED();
+ } // end of try block
+ catch (Exception& E)
+ {
+ issue_fail_msg("test_copy()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+} // test_copy
+
+/*-------------------------------------------------------------------------
* Function: test_num_links
*
* Purpose: Test setting and getting limit of number of links
@@ -528,13 +888,13 @@ void test_links()
// FileAccPropList may be passed in instead of fapl id
test_basic_links(my_fapl_id, new_format);
test_num_links(my_fapl_id, new_format);
+ test_lcpl(my_fapl_id, new_format);
+ test_move(my_fapl_id, new_format);
+ test_copy(my_fapl_id, new_format);
#if 0
// these tests are from the C test links.c and left here for future
// implementation of H5L API
- test_move(my_fapl_id, new_format);
- test_copy(my_fapl_id, new_format);
- test_lcpl(my_fapl_id, new_format);
nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0;
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index ad06d40..422c9d2 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -117,7 +117,72 @@ New Features
C++ API
-------
- - None
+ - The following C++ API wrappers have been added to class H5Location
+ + H5Lcreate_soft:
+ // Creates a soft link from link_name to target_name.
+ void link(const char *target_name, const char *link_name,...)
+ void link(const H5std_string& target_name,...)
+
+ + H5Lcreate_hard:
+ // Creates a hard link from new_name to curr_name.
+ void link(const char *curr_name, const Group& new_loc,...)
+ void link(const H5std_string& curr_name, const Group& new_loc,...)
+
+ // Creates a hard link from new_name to curr_name in the same location.
+ void link(const char *curr_name, const hid_t same_loc,...)
+ void link(const H5std_string& curr_name, const hid_t same_loc,...)
+
+ Note: previous version CommonFG::link will be deprecated.
+
+ + H5Lcopy:
+ // Copy an object from a group of file to another.
+ void copyLink(const char *src_name, const Group& dst,...)
+ void copyLink(const H5std_string& src_name, const Group& dst,...)
+
+ // Copy an object from a group of file to the same location.
+ void copyLink(const char *src_name, const char *dst_name,...)
+ void copyLink(const H5std_string& src_name,...)
+
+ + H5Lmove:
+ // Rename an object in a group or file to a new location.
+ void moveLink(const char* src_name, const Group& dst,...)
+ void moveLink(const H5std_string& src_name, const Group& dst,...)
+
+ // Rename an object in a group or file to the same location.
+ void moveLink(const char* src_name, const char* dst_name,...)
+ void moveLink(const H5std_string& src_name,...)
+
+ Note: previous version CommonFG::move will be deprecated.
+
+ + H5Ldelete:
+ // Removes the specified link from this location.
+ void unlink(const char *link_name,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT)
+ void unlink(const H5std_string& link_name,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT)
+
+ Note: An additional parameter is added to CommonFG::unlink and it
+ is moved to H5Location.
+
+ (BMR - 2018/05/11 - HDFFV-10445)
+
+ - New property list subclasses
+
+ Property list subclasses StrCreatPropList, LinkCreatPropList, and
+ AttrCreatPropList are added for the C property list classes
+ H5P_STRING_CREATE, H5P_LINK_CREATE, and H5P_ATTRIBUTE_CREATE.
+
+ (BMR - 2018/05/11 - HDFFV-10445)
+
+ - Another argument, LinkCreatPropList& lcpl, is added to the following
+ functions for the use of link creation property list.
+ 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)
+
+ (BMR - 2018/05/11 - HDFFV-10445)
+
High-Level APIs
---------------
@@ -367,7 +432,32 @@ Bug Fixes since HDF5-1.8.20
C++ API
-------
- - None
+ - Removal of memory leaks
+
+ A private function was inadvertently called, causing memory leaks. This
+ is now fixed.
+
+ (BMR - 2018/04/12 - User reported in email)
+
+ - Changes in exception classes
+
+ Some exception classes are reorganized to reflect the HDF5 object
+ hierarchy and allow customization.
+ DataSetIException -> LocationException -> Exception
+ DataTypeIException -> LocationException -> Exception
+ GroupIException -> LocationException -> Exception
+ AttributeIException -> LocationException -> Exception
+ FileIException -> GroupIException -> LocationException -> Exception
+ Member functions in H5Location and H5Object now throw specific exceptions
+ associated with the invoking objects.
+
+ (BMR - 2018/05/11)
+
+ - H5Location::closeObjId is made static
+ (BMR - 2018/05/11)
+
+ - H5A wrappers in H5Location are removed as they have been in H5Object.
+ (BMR - 2018/05/11)
High-Level APIs: