mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-30 15:32:37 +08:00
HDFFV-10149 continued
Description:
- Moved the new wrappers committed on Mar 9:
43158f3bb3
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)
This commit is contained in:
parent
43158f3bb3
commit
3494282d42
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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"
|
||||
|
146
c++/src/H5LcreatProp.cpp
Normal file
146
c++/src/H5LcreatProp.cpp
Normal file
@ -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
|
71
c++/src/H5LcreatProp.h
Normal file
71
c++/src/H5LcreatProp.h
Normal file
@ -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
|
@ -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"
|
||||
|
@ -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);
|
||||
@ -931,6 +979,134 @@ DataSet H5Location::openDataSet(const H5std_string& name) const
|
||||
return(openDataSet( name.c_str()));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// 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
|
||||
@ -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,17 +1169,231 @@ 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
|
||||
// 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::copyLink(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 = 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("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.
|
||||
///\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::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.
|
||||
///\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. - 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
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
///\note
|
||||
/// 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.
|
||||
// Modification
|
||||
// 2007: QAK modified to use H5L APIs - BMR
|
||||
// 2018: Will be replaced by H5Location::moveLink() -BMR
|
||||
//--------------------------------------------------------------------------
|
||||
void H5Location::unlink(const char* name) const
|
||||
void H5Location::move(const char* src, const char* dst) const
|
||||
{
|
||||
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. - 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
|
||||
{
|
||||
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");
|
||||
}
|
||||
@ -1013,44 +1403,11 @@ void H5Location::unlink(const char* name) const
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function in that it takes an
|
||||
/// \c H5std_string for \a name.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// March, 2018
|
||||
//--------------------------------------------------------------------------
|
||||
void H5Location::unlink(const H5std_string& name) const
|
||||
void H5Location::unlink(const H5std_string& name, const LinkAccPropList& lapl) const
|
||||
{
|
||||
unlink(name.c_str());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5Location::move
|
||||
///\brief Renames an object at this location.
|
||||
///\param src - IN: Object's original name
|
||||
///\param dst - IN: Object's new name
|
||||
///\exception H5::FileIException/H5::GroupIException/H5::LocationException
|
||||
///\note
|
||||
/// 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
|
||||
//--------------------------------------------------------------------------
|
||||
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");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// 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
|
||||
//--------------------------------------------------------------------------
|
||||
void H5Location::move(const H5std_string& src, const H5std_string& dst) const
|
||||
{
|
||||
move(src.c_str(), dst.c_str());
|
||||
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
|
||||
{
|
||||
@ -1113,6 +1469,37 @@ 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.
|
||||
@ -1120,7 +1507,7 @@ void H5Location::getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const
|
||||
///\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.
|
||||
//--------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user