summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2018-03-12 04:36:48 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2018-03-12 04:36:48 (GMT)
commit3494282d42bf6147b32a10162353920f9e8b5a6a (patch)
tree843581557a75580be9a5387f7aaf92f574c42a6e /c++
parent43158f3bb352f374c31556a5d0dc463a09e0b32e (diff)
downloadhdf5-3494282d42bf6147b32a10162353920f9e8b5a6a.zip
hdf5-3494282d42bf6147b32a10162353920f9e8b5a6a.tar.gz
hdf5-3494282d42bf6147b32a10162353920f9e8b5a6a.tar.bz2
HDFFV-10149 continued
Description: - Moved the new wrappers committed on Mar 9: 43158f3bb352f374c31556a5d0dc463a09e0b32e to H5Location and renamed some of them for overloading. This is because the loc_id in the C APIs can be file, group, dataset, named datatype, and attribute. Previous implementation was wrong following some inaccurate C API reference manual. - Only the following wrappers are modified or added: + 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,...) + H5Lcreate_hard: changed name from newLink to link // 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 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,...) + H5Ldelete: modified existing functions to add 2nd argument // 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) - copyLink and moveLink were only moved from Group to H5Location, no change - Added class LinkCreatPropList - Added overloaded functions H5Location::createGroup to take a link creation property list Group createGroup(const char* name, const LinkCreatPropList& lcpl) Group createGroup(const H5std_string& name, const LinkCreatPropList& lcpl) - Added wrapper for H5Lget_info() to H5Location H5L_info_t getLinkInfo(const H5std_string& link_name,...) Platforms tested: Linux/64 (jelly) Linux/ppc64 (ostrich) Darwin (osx1010test)
Diffstat (limited to 'c++')
-rw-r--r--c++/src/H5AbstractDs.cpp1
-rw-r--r--c++/src/H5ArrayType.cpp1
-rw-r--r--c++/src/H5AtomType.cpp1
-rw-r--r--c++/src/H5Attribute.cpp1
-rw-r--r--c++/src/H5CommonFG.cpp1
-rw-r--r--c++/src/H5CompType.cpp1
-rw-r--r--c++/src/H5Cpp.h1
-rw-r--r--c++/src/H5DataSet.cpp1
-rw-r--r--c++/src/H5DataType.cpp3
-rw-r--r--c++/src/H5DcreatProp.cpp1
-rw-r--r--c++/src/H5EnumType.cpp1
-rw-r--r--c++/src/H5File.cpp1
-rw-r--r--c++/src/H5FloatType.cpp1
-rw-r--r--c++/src/H5Group.cpp292
-rw-r--r--c++/src/H5Group.h69
-rw-r--r--c++/src/H5IntType.cpp1
-rw-r--r--c++/src/H5LcreatProp.cpp146
-rw-r--r--c++/src/H5LcreatProp.h71
-rw-r--r--c++/src/H5Library.cpp1
-rw-r--r--c++/src/H5Location.cpp451
-rw-r--r--c++/src/H5Location.h86
-rw-r--r--c++/src/H5Object.cpp1
-rw-r--r--c++/src/H5PredType.cpp1
-rw-r--r--c++/src/H5StrType.cpp1
-rw-r--r--c++/src/H5VarLenType.cpp1
-rw-r--r--c++/src/Makefile.am34
-rw-r--r--c++/test/tlinks.cpp127
27 files changed, 875 insertions, 422 deletions
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp
index b900b90..823e873 100644
--- a/c++/src/H5AbstractDs.cpp
+++ b/c++/src/H5AbstractDs.cpp
@@ -22,6 +22,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.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 76e7532..49c31d2 100644
--- a/c++/src/H5ArrayType.cpp
+++ b/c++/src/H5ArrayType.cpp
@@ -19,6 +19,7 @@
#include "H5PropList.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.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 4e19850..5c24cf9 100644
--- a/c++/src/H5AtomType.cpp
+++ b/c++/src/H5AtomType.cpp
@@ -19,6 +19,7 @@
#include "H5PropList.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.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 cbf3029..d90857f 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -27,6 +27,7 @@
#include "H5FcreatProp.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index af5ba0e..979816b 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -22,6 +22,7 @@
#include "H5DxferProp.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index d357fbc..28aa6cd 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -20,6 +20,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.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 09914e8..b9da80a 100644
--- a/c++/src/H5Cpp.h
+++ b/c++/src/H5Cpp.h
@@ -25,6 +25,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 9e0f9ff..fb9b57e 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -28,6 +28,7 @@
#include "H5OcreatProp.h"
#include "H5DxferProp.h"
#include "H5DcreatProp.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 4b06c0a..032937d 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -28,6 +28,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -244,6 +245,7 @@ void DataType::copy(const DataSet& dset)
throw DataTypeIException(inMemFunc("copy"), "H5Tcopy failed");
}
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: DataType::p_decode
// Purpose Returns an id of a type by decoding the binary object
@@ -272,6 +274,7 @@ hid_t DataType::p_decode() const
return(encoded_dtype_id);
}
}
+#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: DataType::decode
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp
index 2946730..6ed77e3 100644
--- a/c++/src/H5DcreatProp.cpp
+++ b/c++/src/H5DcreatProp.cpp
@@ -20,6 +20,7 @@
#include "H5PropList.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.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 02ae5a3..91866d7 100644
--- a/c++/src/H5EnumType.cpp
+++ b/c++/src/H5EnumType.cpp
@@ -22,6 +22,7 @@
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
#include "H5DataSpace.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp
index 57ee4d5..2c7ac51 100644
--- a/c++/src/H5File.cpp
+++ b/c++/src/H5File.cpp
@@ -27,6 +27,7 @@
#include "H5OcreatProp.h"
#include "H5DxferProp.h"
#include "H5DcreatProp.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 794c27d..9703149 100644
--- a/c++/src/H5FloatType.cpp
+++ b/c++/src/H5FloatType.cpp
@@ -20,6 +20,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp
index aa27a18..c4c7017 100644
--- a/c++/src/H5Group.cpp
+++ b/c++/src/H5Group.cpp
@@ -27,6 +27,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -76,297 +77,6 @@ void Group::closeObjId(hid_t obj_id) const
}
}
-/*** For H5L API ***/
-
-//--------------------------------------------------------------------------
-// Function: Group::newLink
-///\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 PropList::DEFAULT
-///\param lapl - IN: Link access plist - default to PropList::DEFAULT
-///\exception H5::FileIException or H5::GroupIException
-///\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.
-// March 2018
-//--------------------------------------------------------------------------
-void Group::newLink(const char *target_name, const char *link_name,
- const PropList& lcpl, const PropList& 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, id, link_name, lcpl_id, lapl_id);
- if (ret_value < 0)
- throwException("newLink", "creating soft link failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: Group::newLink
-///\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.
-///\exception H5::FileIException or H5::GroupIException
-// March, 2018
-//--------------------------------------------------------------------------
-void Group::newLink(const H5std_string& target_name, const H5std_string&
- link_name, const PropList& lcpl, const PropList& lapl) const
-{
- newLink(target_name.c_str(), link_name.c_str(), lcpl, lapl);
-}
-
-//--------------------------------------------------------------------------
-// Function: Group::newLink
-///\brief Creates a hard link from \a new_name to \a curr_name.
-///\param curr_name - IN: Name of the existing object
-///\param new_name - IN: New name for the object
-///\param lcpl - IN: Link creation plist - default to PropList::DEFAULT
-///\param lapl - IN: Link access plist - default to PropList::DEFAULT
-///\exception H5::FileIException or H5::GroupIException
-///\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.
-// March 2018
-//--------------------------------------------------------------------------
-void Group::newLink(const char *curr_name, const Group& new_loc,
- const char *new_name, const PropList& lcpl, const PropList& 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, H5P_DEFAULT, H5P_DEFAULT);
- if (ret_value < 0)
- throwException("newLink", "creating link failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: Group::newLink
-///\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.
-///\exception H5::FileIException or H5::GroupIException
-// March, 2018
-//--------------------------------------------------------------------------
-void Group::newLink(const H5std_string& curr_name, const Group& new_loc,
- const H5std_string& new_name, const PropList& lcpl, const PropList& lapl) const
-{
- newLink(curr_name.c_str(), new_loc, new_name.c_str(), lcpl, lapl);
-}
-
-//--------------------------------------------------------------------------
-// Function: Group::newLink
-///\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 new_name - IN: New name for the object
-///\param lcpl - IN: Link creation plist - default to PropList::DEFAULT
-///\param lapl - IN: Link access plist - default to PropList::DEFAULT
-///\exception H5::FileIException or H5::GroupIException
-///\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.
-// March 2018
-//--------------------------------------------------------------------------
-void Group::newLink(const char *curr_name, const hid_t same_loc,
- const char *new_name, const PropList& lcpl, const PropList& 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, H5P_DEFAULT, H5P_DEFAULT);
-
- if (ret_value < 0)
- throwException("newLink", "creating link failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: Group::newLink
-///\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.
-///\exception H5::FileIException or H5::GroupIException
-// March, 2018
-//--------------------------------------------------------------------------
-void Group::newLink(const H5std_string& curr_name, const hid_t same_loc,
- const H5std_string& new_name, const PropList& lcpl, const PropList& lapl) const
-{
- newLink(curr_name.c_str(), same_loc, new_name.c_str(), lcpl, lapl);
-}
-
-
-//--------------------------------------------------------------------------
-// Function: Group::copyLink
-///\brief Copies a link from one location to another.
-///\param src - IN: Source 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 PropList::DEFAULT
-///\param lapl - IN: Link access plist - default PropList::DEFAULT
-///\exception H5::FileIException or H5::GroupIException
-// March, 2018
-//--------------------------------------------------------------------------
-void Group::copyLink(const char *src_name,
- const Group& dst, const char *dst_name, const PropList& lcpl,
- const PropList& 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: Group::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.
-///\exception H5::FileIException or H5::GroupIException
-// March, 2018
-//--------------------------------------------------------------------------
-void Group::copyLink(const H5std_string& src_name,
- const Group& dst, const H5std_string& dst_name, const PropList& lcpl,
- const PropList& lapl) const
-{
- copyLink(src_name.c_str(), dst, dst_name.c_str(), lcpl, lapl);
-}
-
-//--------------------------------------------------------------------------
-// Function: Group::copyLink
-///\brief Copies a link to the same location.
-///\param src - IN: Source location
-///\param src_name - IN: Original name
-///\param dst_name - IN: New name
-///\param lcpl - IN: Link creation plist - default PropList::DEFAULT
-///\param lapl - IN: Link access plist - default PropList::DEFAULT
-///\exception H5::FileIException or H5::GroupIException
-// March, 2018
-//--------------------------------------------------------------------------
-void Group::copyLink(const char *src_name,
- const char *dst_name, const PropList& lcpl,
- const PropList& 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: Group::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.
-///\exception H5::FileIException or H5::GroupIException
-// March, 2018
-//--------------------------------------------------------------------------
-void Group::copyLink(const H5std_string& src_name,
- const H5std_string& dst_name, const PropList& lcpl,
- const PropList& lapl) const
-{
- copyLink(src_name.c_str(), dst_name.c_str(), lcpl, lapl);
-}
-
-//--------------------------------------------------------------------------
-// Function: Group::moveLink
-///\brief Renames an object in a group/file and moves it to a new location.
-///\param src - IN: Source 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 PropList::DEFAULT
-///\param lapl - IN: Link access plist - default PropList::DEFAULT
-///\exception H5::FileIException or H5::GroupIException
-///\note
-/// Exercise care in moving groups as it is possible to render
-/// data in a file inaccessible with Group::moveLink. Please refer
-/// to the Group Interface in the HDF5 User's Guide for details.
-// March, 2018
-//--------------------------------------------------------------------------
-void Group::moveLink(const char* src_name, const Group& dst, const char* dst_name, const PropList& lcpl, const PropList& 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: Group::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.
-///\exception H5::FileIException or H5::GroupIException
-// March, 2018
-//--------------------------------------------------------------------------
-void Group::moveLink(const H5std_string& src_name, const Group& dst, const H5std_string& dst_name, const PropList& lcpl, const PropList& lapl) const
-{
- moveLink(src_name.c_str(), dst, dst_name.c_str(), lcpl, lapl);
-}
-
-//--------------------------------------------------------------------------
-// Function: Group::moveLink
-///\brief Renames an object in a group or file to the same location.
-///\param src - IN: Source location
-///\param src_name - IN: Original name
-///\param dst_name - IN: New name
-///\param lcpl - IN: Link creation plist - default PropList::DEFAULT
-///\param lapl - IN: Link access plist - default PropList::DEFAULT
-///\exception H5::FileIException or H5::GroupIException
-///\note
-/// Exercise care in moving groups as it is possible to render
-/// data in a file inaccessible with Group::moveLink. Please refer
-/// to the Group Interface in the HDF5 User's Guide for details.
-// March, 2018
-//--------------------------------------------------------------------------
-void Group::moveLink(const char* src_name, const char* dst_name, const PropList& lcpl, const PropList& 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: Group::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.
-///\exception H5::FileIException or H5::GroupIException
-// March, 2018
-//--------------------------------------------------------------------------
-void Group::moveLink(const H5std_string& src_name, const H5std_string& dst_name, const PropList& lcpl, const PropList& lapl) const
-{
- moveLink(src_name.c_str(), H5L_SAME_LOC, dst_name.c_str(), lcpl, lapl);
-}
-
-/*** End of H5L API section ***/
-
//--------------------------------------------------------------------------
// Function: Group::getLocId
// Purpose: Get the id of this group
diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h
index d95d996..b3a9007 100644
--- a/c++/src/H5Group.h
+++ b/c++/src/H5Group.h
@@ -50,75 +50,6 @@ class H5_DLLCPP Group : public H5Object, public CommonFG {
// Closes an object opened by getObjId().
void closeObjId(hid_t obj_id) const;
- /*** For H5L API ***/
-
- // Creates a soft link from link_name to target_name.
- void newLink(const char *target_name, const char *link_name,
- const PropList& lcpl = PropList::DEFAULT,
- const PropList& lapl = PropList::DEFAULT) const;
- void newLink(const H5std_string& target_name,
- const H5std_string& link_name,
- const PropList& lcpl = PropList::DEFAULT,
- const PropList& lapl = PropList::DEFAULT) const;
-
- // Creates a hard link from new_name to curr_name.
- void newLink(const char *curr_name,
- const Group& new_loc, const char *new_name,
- const PropList& lcpl = PropList::DEFAULT,
- const PropList& lapl = PropList::DEFAULT) const;
- void newLink(const H5std_string& curr_name,
- const Group& new_loc, const H5std_string& new_name,
- const PropList& lcpl = PropList::DEFAULT,
- const PropList& lapl = PropList::DEFAULT) const;
-
- // Creates a hard link from new_name to curr_name in same location.
- void newLink(const char *curr_name,
- const hid_t same_loc, const char *new_name,
- const PropList& lcpl = PropList::DEFAULT,
- const PropList& lapl = PropList::DEFAULT) const;
- void newLink(const H5std_string& curr_name,
- const hid_t same_loc, const H5std_string& new_name,
- const PropList& lcpl = PropList::DEFAULT,
- const PropList& lapl = PropList::DEFAULT) const;
-
- // Copy an object from a group of file to another.
- void copyLink(const char *src_name,
- const Group& dst, const char *dst_name,
- const PropList& lcpl = PropList::DEFAULT,
- const PropList& lapl = PropList::DEFAULT) const;
- void copyLink(const H5std_string& src_name,
- const Group& dst, const H5std_string& dst_name,
- const PropList& lcpl = PropList::DEFAULT,
- const PropList& lapl = PropList::DEFAULT) const;
-
- // Copy an object from a group of file to the same location.
- void copyLink(const char *src_name, const char *dst_name,
- const PropList& lcpl = PropList::DEFAULT,
- const PropList& lapl = PropList::DEFAULT) const;
- void copyLink(const H5std_string& src_name,
- const H5std_string& dst_name,
- const PropList& lcpl = PropList::DEFAULT,
- const PropList& lapl = PropList::DEFAULT) const;
-
- // Rename an object in a group or file to a new location.
- void moveLink(const char* src_name,
- const Group& dst, const char* dst_name,
- const PropList& lcpl = PropList::DEFAULT,
- const PropList& lapl = PropList::DEFAULT) const;
- void moveLink(const H5std_string& src_name,
- const Group& dst, const H5std_string& dst_name,
- const PropList& lcpl = PropList::DEFAULT,
- const PropList& lapl = PropList::DEFAULT) const;
-
- // Rename an object in a group or file to the same location.
- void moveLink(const char* src_name, const char* dst_name,
- const PropList& lcpl = PropList::DEFAULT,
- const PropList& lapl = PropList::DEFAULT) const;
- void moveLink(const H5std_string& src_name,
- const H5std_string& dst_name,
- const PropList& lcpl = PropList::DEFAULT,
- const PropList& lapl = PropList::DEFAULT) const;
-
// default constructor
Group();
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp
index f68e858..38191bc 100644
--- a/c++/src/H5IntType.cpp
+++ b/c++/src/H5IntType.cpp
@@ -20,6 +20,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp
new file mode 100644
index 0000000..4f8bffc
--- /dev/null
+++ b/c++/src/H5LcreatProp.cpp
@@ -0,0 +1,146 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 "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.
+// December, 2016
+//--------------------------------------------------------------------------
+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
+// December, 2016
+//--------------------------------------------------------------------------
+void LinkCreatPropList::deleteConstants()
+{
+ if (DEFAULT_ != 0)
+ delete DEFAULT_;
+}
+
+//--------------------------------------------------------------------------
+// Purpose: Constant for default property
+//--------------------------------------------------------------------------
+const LinkCreatPropList& LinkCreatPropList::DEFAULT = *getConstant();
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+//--------------------------------------------------------------------------
+// Function: Default Constructor
+///\brief Creates a file access property list
+// December, 2016
+//--------------------------------------------------------------------------
+LinkCreatPropList::LinkCreatPropList() : PropList(H5P_LINK_CREATE) {}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList copy constructor
+///\brief Copy Constructor: makes a copy of the original
+///\param original - IN: LinkCreatPropList instance to copy
+// December, 2016
+//--------------------------------------------------------------------------
+LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList& original) : PropList(original) {}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList overloaded constructor
+///\brief Creates a file access property list using the id of an
+/// existing one.
+// December, 2016
+//--------------------------------------------------------------------------
+LinkCreatPropList::LinkCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList::setCharEncoding
+///\brief Sets the character encoding of the string.
+///\exception H5::PropListIException
+// March, 2018
+//--------------------------------------------------------------------------
+void LinkCreatPropList::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: LinkCreatPropList::getCharEncoding
+///\brief Gets the character encoding of the string.
+///\exception H5::PropListIException
+// March, 2018
+//--------------------------------------------------------------------------
+H5T_cset_t LinkCreatPropList::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);
+}
+
+//--------------------------------------------------------------------------
+// Function: LinkCreatPropList destructor
+///\brief Noop destructor
+// December, 2016
+//--------------------------------------------------------------------------
+LinkCreatPropList::~LinkCreatPropList() {}
+
+} // end namespace
diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h
new file mode 100644
index 0000000..4ac2191
--- /dev/null
+++ b/c++/src/H5LcreatProp.h
@@ -0,0 +1,71 @@
+// 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+// Class LinkCreatPropList represents the HDF5 file access property list and
+// inherits from DataType.
+
+#ifndef __H5LinkCreatPropList_H
+#define __H5LinkCreatPropList_H
+
+namespace H5 {
+
+/*! \class LinkCreatPropList
+ \brief Class LinkCreatPropList inherits from PropList and provides
+ wrappers for the HDF5 file access property list.
+*/
+// Inheritance: PropList -> IdComponent
+class H5_DLLCPP LinkCreatPropList : public PropList {
+ public:
+ ///\brief Default file access property list.
+ static const LinkCreatPropList& DEFAULT;
+
+ // Creates a file access property list.
+ LinkCreatPropList();
+
+ ///\brief Returns this class name.
+ virtual H5std_string fromClass () const { return("LinkCreatPropList"); }
+
+ // Copy constructor: creates a copy of a LinkCreatPropList object.
+ LinkCreatPropList(const LinkCreatPropList& original);
+
+ // Creates a copy of an existing file access property list
+ // using the property list id.
+ LinkCreatPropList (const hid_t plist_id);
+
+ // 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;
+
+ // 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 214c5b2..55f82f5 100644
--- a/c++/src/H5Library.cpp
+++ b/c++/src/H5Library.cpp
@@ -24,6 +24,7 @@
#include "H5OcreatProp.h"
#include "H5DxferProp.h"
#include "H5DcreatProp.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 3ca080e..c82df2c 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -12,6 +12,8 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <string>
+#include <iostream>
+using namespace std;
#include "H5private.h" // for HDmemset
#include "H5Include.h"
@@ -24,6 +26,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -750,7 +753,53 @@ DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const
//--------------------------------------------------------------------------
// Function: H5Location::createGroup
-///\brief Creates a new group at this location.
+///\brief Creates a new group at this location, which can be a file,
+/// group, dataset, attribute, or named datatype.
+///\param name - IN: Name of the group to create
+///\param size_hint - IN: Indicates the number of bytes to reserve for
+/// the names that will appear in the group
+///\return Group instance
+///\exception H5::FileIException/H5::GroupIException/H5::LocationException
+///\par Description
+/// The optional \a size_hint specifies how much file space to
+/// reserve for storing the names that will appear in this new
+/// group. If a non-positive value is provided for the \a size_hint
+/// then a default size is chosen.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Group H5Location::createGroup(const char* name, const LinkCreatPropList& lcpl) const
+{
+ // Call C routine H5Gcreate2 to create the named group, giving the
+ // location id which can be a file id or a group id
+ hid_t group_id = H5Gcreate2(getId(), name, lcpl.getId(), H5P_DEFAULT, H5P_DEFAULT);
+
+ // If the creation of the group failed, throw an exception
+ if (group_id < 0)
+ throwException("createGroup", "H5Gcreate2 failed");
+
+ // No failure, create and return the Group object
+ Group group;
+ H5Location *ptr = &group;
+ ptr->p_setId(group_id);
+ return(group);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::createGroup
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+Group H5Location::createGroup(const H5std_string& name, const LinkCreatPropList& lcpl) const
+{
+ return(createGroup( name.c_str(), lcpl));
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::createGroup
+///\brief Creates a new group at this location, which can be a file,
+/// group, dataset, attribute, or named datatype.
///\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
@@ -795,7 +844,6 @@ Group H5Location::createGroup(const char* name, size_t size_hint) const
// No failure, create and return the Group object
Group group;
- //group.p_setId(group_id);
H5Location *ptr = &group;
ptr->p_setId(group_id);
return(group);
@@ -933,6 +981,134 @@ DataSet H5Location::openDataSet(const H5std_string& name) 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 H5::FileIException or H5::GroupIException
+///\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.
+// March 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.
+///\exception H5::FileIException or H5::GroupIException
+// March, 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 group or root group
+///\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 H5::FileIException or H5::GroupIException
+///\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.
+// March 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const char *curr_name, const Group& 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, H5P_DEFAULT, H5P_DEFAULT);
+ 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.
+///\exception H5::FileIException or H5::GroupIException
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const H5std_string& curr_name, const Group& 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: Group or root group 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 H5::FileIException or H5::GroupIException
+///\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.
+// March 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, H5P_DEFAULT, H5P_DEFAULT);
+
+ 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.
+///\exception H5::FileIException or H5::GroupIException
+// March, 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::link
///\brief Creates a link of the specified type from \a new_name to
/// \a curr_name.
///\param link_type - IN: Link type; possible values are
@@ -953,7 +1129,7 @@ DataSet H5Location::openDataSet(const H5std_string& name) const
// 2007: QAK modified to use H5L APIs - BMR
// Mar 2018: Inadequate functionality, new hard link is only in
// H5L_SAME_LOC. This function will be retired in favor of
-// its replacement, Group::newLink(). - BMR
+// its replacement. - BMR
//--------------------------------------------------------------------------
void H5Location::link(H5L_type_t link_type, const char* curr_name, const char* new_name) const
{
@@ -993,36 +1169,164 @@ void H5Location::link(H5L_type_t link_type, const H5std_string& curr_name, const
}
//--------------------------------------------------------------------------
-// Function: H5Location::unlink
-///\brief Removes the specified name at this location.
-///\param name - IN: Name of the object to be removed
-///\exception H5::FileIException/H5::GroupIException/H5::LocationException
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// 2007: QAK modified to use H5L APIs - BMR
+// Function: H5Location::copyLink
+///\brief Copies a link from one group 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 H5::FileIException or H5::GroupIException
+// March, 2018
//--------------------------------------------------------------------------
-void H5Location::unlink(const char* name) const
+void H5Location::copyLink(const char *src_name,
+ const Group& dst, const char *dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
{
- herr_t ret_value = H5Ldelete(getId(), name, H5P_DEFAULT);
+ 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.
+///\exception H5::FileIException or H5::GroupIException
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::copyLink(const H5std_string& src_name,
+ const Group& 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 group in 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 H5::FileIException or H5::GroupIException
+// March, 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.
+///\exception H5::FileIException or H5::GroupIException
+// March, 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 group 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 H5::FileIException or H5::GroupIException
+///\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.
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::moveLink(const char* src_name, const Group& 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("unlink", "H5Ldelete failed");
+ throwException("moveLink", "H5Lmove failed");
}
//--------------------------------------------------------------------------
-// Function: H5Location::unlink
+// 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 name.
-// Programmer Binh-Minh Ribler - 2000
+/// \c H5std_string for \a src_name and \a dst_name.
+///\exception H5::FileIException or H5::GroupIException
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::moveLink(const H5std_string& src_name, const Group& 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 group.
+///\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 H5::FileIException or H5::GroupIException
+///\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.
+// March, 2018
//--------------------------------------------------------------------------
-void H5Location::unlink(const H5std_string& name) const
+void H5Location::moveLink(const char* src_name, const char* dst_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
{
- unlink(name.c_str());
+ 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.
+///\exception H5::FileIException or H5::GroupIException
+// March, 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::move
-///\brief Renames an object at this location.
+///\brief Renames an object at this location. - Deprecated due to inadequate functionality
///\param src - IN: Object's original name
///\param dst - IN: Object's new name
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
@@ -1030,27 +1334,80 @@ void H5Location::unlink(const H5std_string& name) const
/// Exercise care in moving groups as it is possible to render
/// data in a file inaccessible with H5Location::move. Please refer
/// to the Group Interface in the HDF5 User's Guide for details.
-// Programmer Binh-Minh Ribler - 2000
// Modification
-// 2007: QAK modified to use H5L APIs - BMR
+// 2007: QAK modified to use H5L APIs - BMR
+// 2018: Will be replaced by H5Location::moveLink() -BMR
//--------------------------------------------------------------------------
void H5Location::move(const char* src, const char* dst) const
{
- herr_t ret_value = H5Lmove(getId(), src, H5L_SAME_LOC, dst, H5P_DEFAULT, H5P_DEFAULT);
- if (ret_value < 0)
- throwException("move", "H5Lmove failed");
+ moveLink(src, dst, LinkCreatPropList::DEFAULT, LinkAccPropList::DEFAULT);
}
//--------------------------------------------------------------------------
// Function: H5Location::move
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function in that it takes an
-/// \c H5std_string for \a src and \a dst.
-// Programmer Binh-Minh Ribler - 2000
+/// \c H5std_string for \a src and \a dst. - Deprecated due to inadequate functionality
+// Modification
+// 2018: Will be replaced by H5Location::moveLink() -BMR
//--------------------------------------------------------------------------
void H5Location::move(const H5std_string& src, const H5std_string& dst) const
{
- move(src.c_str(), dst.c_str());
+ moveLink(src.c_str(), dst.c_str(), LinkCreatPropList::DEFAULT, LinkAccPropList::DEFAULT);
+}
+
+#if 0
+//--------------------------------------------------------------------------
+// Function: H5Location::deleteLink
+///\brief Removes the specified link from this group.
+///\param name - IN: Name of the object to be removed
+///\exception H5::FileIException/H5::GroupIException/H5::LocationException
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::deleteLink(const char* name, const LinkAccPropList& lapl) const
+{
+ herr_t ret_value = H5Ldelete(getId(), name, H5P_DEFAULT);
+ if (ret_value < 0)
+ throwException("deleteLink", "H5Ldelete failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::deleteLink
+///\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.
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::deleteLink(const H5std_string& name, const LinkAccPropList& lapl) const
+{
+ deleteLink(name.c_str());
+}
+
+#endif
+//--------------------------------------------------------------------------
+// Function: H5Location::unlink
+///\brief Removes the specified link from this group.
+///\param name - IN: Name of the object to be removed
+///\exception H5::FileIException/H5::GroupIException/H5::LocationException
+// March, 2018
+//--------------------------------------------------------------------------
+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.
+// March, 2018
+//--------------------------------------------------------------------------
+void H5Location::unlink(const H5std_string& name, const LinkAccPropList& lapl) const
+{
+ unlink(name.c_str(), lapl);
}
#ifndef H5_NO_DEPRECATED_SYMBOLS
@@ -1064,7 +1421,7 @@ void H5Location::move(const H5std_string& src, const H5std_string& dst) const
///\par Description
/// For information, please refer to the H5Gget_objinfo API in
/// the HDF5 C Reference Manual.
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
void H5Location::getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const
{
@@ -1090,8 +1447,7 @@ void H5Location::getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_s
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above functions in that it doesn't have
/// the paramemter \a follow_link.
-// Programmer Binh-Minh Ribler - Nov, 2005
-// Note: need to modify to use H5Oget_info and H5Lget_info - BMR
+// Nov, 2005
//--------------------------------------------------------------------------
void H5Location::getObjinfo(const char* name, H5G_stat_t& statbuf) const
{
@@ -1114,13 +1470,44 @@ void H5Location::getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const
#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
+// Function: H5Location::getLinkInfo
+///\brief Returns the name of the object that the symbolic link points to.
+///\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
-// Programmer Binh-Minh Ribler - 2000
+// 2000
//--------------------------------------------------------------------------
H5std_string H5Location::getLinkval(const char* name, size_t size) const
{
@@ -1670,7 +2057,7 @@ H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) cons
// Programmer Binh-Minh Ribler - 2000
// Modification
// August 2017 - BMR
-// Keep Group::throwException and H5File::throwException to
+// Keep H5Location::throwException and H5File::throwException to
// maintain backward compatibility. For other subclasses, throw
// LocationException.
//--------------------------------------------------------------------------
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index e5fbc84..19c49ea 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -90,6 +90,10 @@ class H5_DLLCPP H5Location : public IdComponent {
// Retrieves a dataspace with the region pointed to selected.
DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const;
+ // Create a new group with using link create property list.
+ Group createGroup(const char* name, const LinkCreatPropList& lcpl) const;
+ Group createGroup(const H5std_string& name, const LinkCreatPropList& lcpl) const;
+
// From CommonFG
// Creates a new group at this location which can be a file
// or another group.
@@ -109,6 +113,9 @@ class H5_DLLCPP H5Location : public IdComponent {
DataSet openDataSet(const char* name) const;
DataSet openDataSet(const H5std_string& name) const;
+ 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;
@@ -154,26 +161,95 @@ class H5_DLLCPP H5Location : public IdComponent {
int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ // 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 Group& 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 Group& 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;
+
// Creates a link of the specified type from new_name to current_name;
// both names are interpreted relative to the specified location id.
+ // Deprecated due to inadequate functionality.
void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const;
void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const;
- // Removes the specified name at this location.
- void unlink(const char* name) const;
- void unlink(const H5std_string& name) const;
+ // Removes the specified 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;
// 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;
+ // Copies a link from a group to another.
+ void copyLink(const char *src_name,
+ const Group& dst, const char *dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void copyLink(const H5std_string& src_name,
+ const Group& 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 group.
+ 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 group and moves to a new location.
+ void moveLink(const char* src_name,
+ const Group& dst, const char* dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void moveLink(const H5std_string& src_name,
+ const Group& dst, const H5std_string& dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Renames a link in this group.
+ 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;
+
// Renames an object at this location.
+ // Deprecated due to inadequate functionality.
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/H5Object.cpp b/c++/src/H5Object.cpp
index fcdfd59..27881c4 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -23,6 +23,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp
index 53d525c..704a617 100644
--- a/c++/src/H5PredType.cpp
+++ b/c++/src/H5PredType.cpp
@@ -19,6 +19,7 @@
#include "H5PropList.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.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 7125676..4c0b3d2 100644
--- a/c++/src/H5StrType.cpp
+++ b/c++/src/H5StrType.cpp
@@ -20,6 +20,7 @@
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp
index 5b29682..188ee41 100644
--- a/c++/src/H5VarLenType.cpp
+++ b/c++/src/H5VarLenType.cpp
@@ -19,6 +19,7 @@
#include "H5PropList.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am
index efe17dc..c02a9e7 100644
--- a/c++/src/Makefile.am
+++ b/c++/src/Makefile.am
@@ -32,27 +32,29 @@ 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 \
- H5CommonFG.cpp H5Group.cpp H5File.cpp
+ H5DataSpace.cpp H5PropList.cpp H5Library.cpp \
+ H5FaccProp.cpp H5FcreatProp.cpp H5LcreatProp.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 H5CommonFG.cpp H5Group.cpp H5File.cpp
# HDF5 C++ library depends on HDF5 Library.
libhdf5_cpp_la_LIBADD=$(LIBHDF5)
# Public headers
-include_HEADERS=H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h \
- H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.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 \
- H5Library.h H5Location.h H5Object.h H5PredType.h H5PropList.h \
- H5StrType.h H5CppDoc.h H5ArrayType.h H5VarLenType.h
+include_HEADERS=H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h \
+ H5Classes.h H5CommonFG.h H5CompType.h H5DataSet.h \
+ H5DataSpace.h H5DataType.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 H5LcreatProp.h \
+ H5LaccProp.h H5Library.h H5Location.h H5Object.h \
+ H5PredType.h H5PropList.h H5StrType.h H5CppDoc.h \
+ H5ArrayType.h H5VarLenType.h
# h5c++ and libhdf5.settings are generated during configure. Remove only when
# distclean.
diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp
index 93bd0266..87fffc4 100644
--- a/c++/test/tlinks.cpp
+++ b/c++/test/tlinks.cpp
@@ -432,7 +432,92 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
{
issue_fail_msg("test_basic_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
-}
+} // test_basic_links
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_lcpl
+ *
+ * Purpose: Tests link creation property lists, specifically, the
+ * character encoding property.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ * March, 2018
+ *-------------------------------------------------------------------------
+ */
+const H5std_string GROUP1NAME("First_group");
+const H5std_string GROUP2NAME("Second_group");
+static int
+test_lcpl(hid_t fapl_id, hbool_t new_format)
+{
+ H5L_info_t linfo;
+ char filename[1024];
+ hsize_t dims[2];
+
+ if(new_format)
+ TESTING("link creation property lists (w/new group format)")
+ else
+ TESTING("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_id);
+
+ // 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;
+ 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, 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_num_links()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+} // end test_lcpl()
/*-------------------------------------------------------------------------
@@ -445,8 +530,6 @@ static void test_basic_links(hid_t fapl_id, hbool_t new_format)
* March, 2018
*-------------------------------------------------------------------------
*/
-const H5std_string GROUP1NAME("First_group");
-const H5std_string GROUP2NAME("Second_group");
static void
test_move(hid_t fapl_id, hbool_t new_format)
{
@@ -459,11 +542,13 @@ test_move(hid_t fapl_id, hbool_t new_format)
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_id);
+ 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_id);
+ H5File file_b(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
// Create groups in first file
Group grp_1(file_a.createGroup(GROUP1NAME));
@@ -574,7 +659,7 @@ test_move(hid_t fapl_id, hbool_t new_format)
{
issue_fail_msg("test_num_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
-}
+} // test_move
/*-------------------------------------------------------------------------
* Function: test_copy
@@ -609,8 +694,8 @@ static void test_copy(hid_t fapl_id, hbool_t new_format)
Group grp_move(grp_1.createGroup("group_copy"));
// Create hard and soft links
- grp_1.newLink("group_copy", H5L_SAME_LOC, "hard");
- grp_2.newLink("/First_group/group_copy", "soft");
+ 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 {
@@ -679,13 +764,37 @@ static void test_copy(hid_t fapl_id, hbool_t new_format)
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_num_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
-}
+} // test_copy
/*-------------------------------------------------------------------------