diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2019-04-24 14:37:41 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2019-04-24 14:37:41 (GMT) |
commit | 4867de9631d9ffd8f4186df27b3c69283ca0fee5 (patch) | |
tree | 4b32cb15c1b0d881bef732d7cd5f5d836d299689 /c++/src | |
parent | 19ef25909e2215929d352377554913885d142f91 (diff) | |
download | hdf5-4867de9631d9ffd8f4186df27b3c69283ca0fee5.zip hdf5-4867de9631d9ffd8f4186df27b3c69283ca0fee5.tar.gz hdf5-4867de9631d9ffd8f4186df27b3c69283ca0fee5.tar.bz2 |
Added new C++ wrappers - HDFFV-10622
Description:
Added wrappers for H5Pset/get_create_intermediate_group:
// Specifies in property list whether to create missing
// intermediate groups
void setCreateIntermediateGroup(bool crt_intmd_group) const;
// Determines whether property is set to enable creating missing
// intermediate groups
bool getCreateIntermediateGroup() const;
Platforms tested:
Linux/64 (jelly)
Linux/64 (platypus)
Darwin (osx1011test)
Diffstat (limited to 'c++/src')
-rw-r--r-- | c++/src/H5LcreatProp.cpp | 40 | ||||
-rw-r--r-- | c++/src/H5LcreatProp.h | 8 | ||||
-rw-r--r-- | c++/src/H5Location.cpp | 7 |
3 files changed, 51 insertions, 4 deletions
diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp index 695c1fe..bde9339 100644 --- a/c++/src/H5LcreatProp.cpp +++ b/c++/src/H5LcreatProp.cpp @@ -103,6 +103,46 @@ LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList& original) : PropLi LinkCreatPropList::LinkCreatPropList(const hid_t plist_id) : PropList(plist_id) {} //-------------------------------------------------------------------------- +// Function: LinkCreatPropList::setCreateIntermediateGroup +///\brief Specifies in property list whether to create missing +/// intermediate groups. +///\param crt_intmd_group - IN: Flag specifying whether to create +/// intermediate groups upon the creation of an object +///\exception H5::PropListIException +// April, 2019 +//-------------------------------------------------------------------------- +void LinkCreatPropList::setCreateIntermediateGroup(bool crt_intmd_group) const +{ + herr_t ret_value = H5Pset_create_intermediate_group(id, (unsigned)crt_intmd_group); + // Throw exception if H5Pset_create_intermediate_group returns failure + if (ret_value < 0) + { + throw PropListIException("setCreateIntermediateGroup", "H5Pset_create_intermediate_group failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: LinkCreatPropList::getCreateIntermediateGroup +///\brief Determines whether property is set to enable creating missing +/// intermediate groups. +///\return true if creating intermediate groups is enabled, and false, otherwise +///\exception H5::PropListIException +// April, 2019 +//-------------------------------------------------------------------------- +bool LinkCreatPropList::getCreateIntermediateGroup() const +{ + unsigned crt_intmd_group; + herr_t ret_value = H5Pget_create_intermediate_group(id, &crt_intmd_group); + // Throw exception if H5Pget_create_intermediate_group returns failure + if (ret_value < 0) + { + throw PropListIException("getCreateIntermediateGroup", "H5Pget_create_intermediate_group failed"); + } + + return((bool)crt_intmd_group); +} + +//-------------------------------------------------------------------------- // Function: LinkCreatPropList::setCharEncoding ///\brief Sets the character encoding of the string. /// diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h index f6e10bf..908ef63 100644 --- a/c++/src/H5LcreatProp.h +++ b/c++/src/H5LcreatProp.h @@ -40,6 +40,14 @@ class H5_DLLCPP LinkCreatPropList : public PropList { // using the property list id. LinkCreatPropList (const hid_t plist_id); + // Specifies in property list whether to create missing + // intermediate groups + void setCreateIntermediateGroup(bool crt_intmd_group) const; + + // Determines whether property is set to enable creating missing + // intermediate groups + bool getCreateIntermediateGroup() const; + // Sets the character encoding of the string. void setCharEncoding(H5T_cset_t encoding) const; diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 2c49016..2641960 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -1066,7 +1066,7 @@ void H5Location::link(const char *curr_name, const Group& new_loc, 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); + ret_value = H5Lcreate_hard(getId(), curr_name, new_loc_id, new_name, lcpl_id, lapl_id); if (ret_value < 0) throwException("link", "creating link failed"); } @@ -1102,14 +1102,13 @@ void H5Location::link(const H5std_string& curr_name, const Group& new_loc, /// 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 +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); + ret_value = H5Lcreate_hard(getId(), curr_name, same_loc, new_name, lcpl_id, lapl_id); if (ret_value < 0) throwException("link", "creating link failed"); |