summaryrefslogtreecommitdiffstats
path: root/c++/src
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src')
-rw-r--r--c++/src/H5AbstractDs.cpp2
-rw-r--r--c++/src/H5ArrayType.cpp2
-rw-r--r--c++/src/H5AtomType.cpp2
-rw-r--r--c++/src/H5Attribute.cpp2
-rw-r--r--c++/src/H5Attribute.h4
-rw-r--r--c++/src/H5CommonFG.cpp64
-rw-r--r--c++/src/H5CommonFG.h16
-rw-r--r--c++/src/H5CompType.cpp2
-rw-r--r--c++/src/H5Cpp.h4
-rw-r--r--c++/src/H5DataSet.cpp2
-rw-r--r--c++/src/H5DataType.cpp2
-rw-r--r--c++/src/H5DcreatProp.cpp2
-rw-r--r--c++/src/H5EnumType.cpp2
-rw-r--r--c++/src/H5FloatType.cpp2
-rw-r--r--c++/src/H5Group.h9
-rw-r--r--c++/src/H5IntType.cpp2
-rw-r--r--c++/src/H5Location.cpp748
-rw-r--r--c++/src/H5Location.h113
-rw-r--r--c++/src/H5Object.cpp53
-rw-r--r--c++/src/H5PredType.cpp2
-rw-r--r--c++/src/H5StrType.cpp2
-rw-r--r--c++/src/H5StrcreatProp.cpp30
-rw-r--r--c++/src/H5StrcreatProp.h6
-rw-r--r--c++/src/H5VarLenType.cpp2
24 files changed, 704 insertions, 371 deletions
diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp
index 1391b44..92733ab 100644
--- a/c++/src/H5AbstractDs.cpp
+++ b/c++/src/H5AbstractDs.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp
index b0d65b0..857729c 100644
--- a/c++/src/H5ArrayType.cpp
+++ b/c++/src/H5ArrayType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5AtomType.cpp b/c++/src/H5AtomType.cpp
index 75180c5..bd46d7b 100644
--- a/c++/src/H5AtomType.cpp
+++ b/c++/src/H5AtomType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp
index 739cda7..207d73c 100644
--- a/c++/src/H5Attribute.cpp
+++ b/c++/src/H5Attribute.cpp
@@ -27,6 +27,8 @@
#include "H5FcreatProp.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h
index 9ac21b5..cb07ab7 100644
--- a/c++/src/H5Attribute.h
+++ b/c++/src/H5Attribute.h
@@ -47,8 +47,8 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location {
H5std_string getName() const;
ssize_t getName(H5std_string& attr_name, size_t len = 0) const;
// The overloaded function below is replaced by the one above and it
- // is kept for backward compatibility purpose.
- ssize_t getName(size_t buf_size, H5std_string& attr_name) const;
+ // is kept for backward compatibility purpose. Removed in 1.8.21.
+ // ssize_t getName(size_t buf_size, H5std_string& attr_name) const;
// Gets a copy of the dataspace for this attribute.
virtual DataSpace getSpace() const;
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index 97900f6..314a9fe 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -299,13 +299,16 @@ void CommonFG::link(H5L_type_t link_type, const H5std_string& curr_name, const H
link(link_type, curr_name.c_str(), new_name.c_str());
}
+#if 0
//--------------------------------------------------------------------------
// Function: CommonFG::unlink
-///\brief Removes the specified name at this location.
+///\brief Deprecated - replaced by H5Location::unlink
///\param name - IN: Name of the object to be removed
///\exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
// Modification
+// May 2018:
+// This function is deprecated immediately, in 1.8.21, because
+// its replacement has two arguments and one of them is a default.
// 2007: QAK modified to use H5L APIs - BMR
//--------------------------------------------------------------------------
void CommonFG::unlink(const char* name) const
@@ -317,15 +320,17 @@ void CommonFG::unlink(const char* name) const
//--------------------------------------------------------------------------
// Function: CommonFG::unlink
-///\brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes an
-/// \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
+///\brief Deprecated - replaced by H5Location::unlink
+// Modification
+// May 2018:
+// This function is deprecated immediately, in 1.8.21, because
+// its replacement has two arguments and one of them is a default.
//--------------------------------------------------------------------------
void CommonFG::unlink(const H5std_string& name) const
{
unlink(name.c_str());
}
+#endif
//--------------------------------------------------------------------------
// Function: CommonFG::move
@@ -338,9 +343,10 @@ void CommonFG::unlink(const H5std_string& name) const
/// data in a file inaccessible with Group::move. Please refer
/// to the Group Interface in the HDF5 User's Guide for details at:
/// https://support.hdfgroup.org/HDF5/doc/UG/HDF5_Users_Guide-Responsive%20HTML5/index.html#t=HDF5_Users_Guide%2FGroups%2FHDF5_Groups.htm
-// Programmer Binh-Minh Ribler - 2000
+// 2000
// Modification
// 2007: QAK modified to use H5L APIs - BMR
+// May 2018: Deprecated in favor of H5Location::moveLink (1.8.21)
//--------------------------------------------------------------------------
void CommonFG::move(const char* src, const char* dst) const
{
@@ -354,7 +360,9 @@ void CommonFG::move(const char* src, const char* dst) const
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function in that it takes an
/// \c H5std_string for \a src and \a dst.
-// Programmer Binh-Minh Ribler - 2000
+// 2000
+// Modification
+// May 2018: Deprecated in favor of H5Location::moveLink (1.8.21)
//--------------------------------------------------------------------------
void CommonFG::move(const H5std_string& src, const H5std_string& dst) const
{
@@ -422,6 +430,8 @@ void CommonFG::getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+#if 0
+// Moved to H5Location in 1.8.21
//--------------------------------------------------------------------------
// Function: CommonFG::getLinkval
///\brief Returns the name of the object that the symbolic link points to.
@@ -480,6 +490,8 @@ H5std_string CommonFG::getLinkval(const H5std_string& name, size_t size) const
return(getLinkval(name.c_str(), size));
}
+#endif
+
//--------------------------------------------------------------------------
// Function: CommonFG::mount
///\brief Mounts the file \a child onto this group.
@@ -507,26 +519,6 @@ void CommonFG::mount(const char* name, const H5File& child, const PropList& plis
//--------------------------------------------------------------------------
// Function: CommonFG::mount
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const's. This wrapper will be removed in future release.
-// Param name - IN: Name of the group
-// Param child - IN: File to mount
-// Param plist - IN: Property list to use
-// Exception H5::FileIException or H5::GroupIException
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
-// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
-//--------------------------------------------------------------------------
-//void CommonFG::mount(const char* name, H5File& child, PropList& plist) const
-//{
-// mount(name, child, plist);
-//}
-
-//--------------------------------------------------------------------------
-// Function: CommonFG::mount
///\brief This is an overloaded member function, provided for convenience.
/// It takes an \c H5std_string for \a name.
// Programmer Binh-Minh Ribler - 2000
@@ -539,22 +531,6 @@ void CommonFG::mount(const H5std_string& name, const H5File& child, const PropLi
}
//--------------------------------------------------------------------------
-// Function: CommonFG::mount
-// Purpose This is an overloaded member function, kept for backward
-// compatibility. It differs from the above function in that it
-// misses const's. This wrapper will be removed in future release.
-// Programmer Binh-Minh Ribler - 2014
-// Modification
-// Modified to call its replacement. -BMR, 2014/04/16
-// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0
-// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1
-//--------------------------------------------------------------------------
-//void CommonFG::mount(const H5std_string& name, H5File& child, PropList& plist) const
-//{
-// mount(name.c_str(), child, plist);
-//}
-
-//--------------------------------------------------------------------------
// Function: CommonFG::unmount
///\brief Unmounts the specified file.
///\param name - IN: Name of the file to unmount
diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h
index 5e43d8c..fa08263 100644
--- a/c++/src/H5CommonFG.h
+++ b/c++/src/H5CommonFG.h
@@ -47,8 +47,9 @@ class H5_DLLCPP CommonFG {
DataSet openDataSet(const H5std_string& name) const;
// Returns the value of a symbolic link.
- H5std_string getLinkval(const char* link_name, size_t size=0) const;
- H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
+ // Moved to H5Location in 1.8.21.
+ //H5std_string getLinkval(const char* link_name, size_t size=0) const;
+ //H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
// Returns the number of objects in this group.
hsize_t getNumObjs() const;
@@ -92,24 +93,27 @@ class H5_DLLCPP CommonFG {
// Creates a link of the specified type from new_name to current_name;
// both names are interpreted relative to the specified location id.
+ // Deprecated in favor of H5Location::link overloaded (1.8.21)
void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const;
void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const;
// Removes the specified name at this location.
- void unlink(const char* name) const;
- void unlink(const H5std_string& name) const;
+ // Deprecated in favor of H5Location::unlink overloaded (1.8.21)
+ // These functions can be removed immediately because their replacements
+ // have a default argument out of two.
+ //void unlink(const char* name) const;
+ //void unlink(const H5std_string& name) const;
// Mounts the file 'child' onto this location.
void mount(const char* name, const H5File& child, const PropList& plist) const;
- //void mount(const char* name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1
void mount(const H5std_string& name, const H5File& child, const PropList& plist) const;
- //void mount(const H5std_string& name, H5File& child, PropList& plist) const; // removed from 1.8.18 and 1.10.1
// Unmounts the file named 'name' from this parent location.
void unmount(const char* name) const;
void unmount(const H5std_string& name) const;
// Renames an object at this location.
+ // Deprecated in favor of H5Location::moveLink (1.8.21)
void move(const char* src, const char* dst) const;
void move(const H5std_string& src, const H5std_string& dst) const;
diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp
index 903a7c4..5ff610e 100644
--- a/c++/src/H5CompType.cpp
+++ b/c++/src/H5CompType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5Cpp.h b/c++/src/H5Cpp.h
index af7d1e5fa..4108831 100644
--- a/c++/src/H5Cpp.h
+++ b/c++/src/H5Cpp.h
@@ -20,6 +20,8 @@
#include "H5IdComponent.h"
#include "H5DataSpace.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
@@ -27,9 +29,7 @@
#include "H5Attribute.h"
#include "H5OcreatProp.h"
#include "H5DcreatProp.h"
-#include "H5StrcreatProp.h"
#include "H5AcreatProp.h"
-#include "H5LcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DxferProp.h"
diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp
index 1dce28e..f8277f9 100644
--- a/c++/src/H5DataSet.cpp
+++ b/c++/src/H5DataSet.cpp
@@ -23,6 +23,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp
index dc9b422..3ed8113 100644
--- a/c++/src/H5DataType.cpp
+++ b/c++/src/H5DataType.cpp
@@ -23,6 +23,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp
index 8e2468b..2e5b2e4 100644
--- a/c++/src/H5DcreatProp.cpp
+++ b/c++/src/H5DcreatProp.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp
index 4b06ca5..9bd359a 100644
--- a/c++/src/H5EnumType.cpp
+++ b/c++/src/H5EnumType.cpp
@@ -18,6 +18,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5FloatType.cpp b/c++/src/H5FloatType.cpp
index 05284f9..fb9fe58 100644
--- a/c++/src/H5FloatType.cpp
+++ b/c++/src/H5FloatType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h
index 20637b7..88c1a3b 100644
--- a/c++/src/H5Group.h
+++ b/c++/src/H5Group.h
@@ -55,6 +55,15 @@ class H5_DLLCPP Group : public H5Object, public CommonFG {
// Creates a copy of an existing group using its id.
Group(const hid_t group_id);
+ // The "using" lines below are to avoid the compilation error
+ // "error: request for member ‘link’ is ambiguous" when both CommonFG and
+ // H5Location have overloaded functions of the same name. CommonFG's
+ // member functions need to be kept for backward compatibility for a while.
+ // They can be removed after these functions are removed.
+ // -BMR, May 2018
+ using H5Location::link;
+ using CommonFG::link;
+
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Sets the group id.
diff --git a/c++/src/H5IntType.cpp b/c++/src/H5IntType.cpp
index 6af2dc2..8861434 100644
--- a/c++/src/H5IntType.cpp
+++ b/c++/src/H5IntType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp
index 43ba34c..6894fdd 100644
--- a/c++/src/H5Location.cpp
+++ b/c++/src/H5Location.cpp
@@ -18,13 +18,21 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5FaccProp.h"
+#include "H5FcreatProp.h"
+#include "H5OcreatProp.h"
+#include "H5DcreatProp.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
-#include "H5Attribute.h"
+#include "H5CommonFG.h"
+#include "H5Group.h"
+#include "H5File.h"
namespace H5 {
@@ -87,139 +95,15 @@ H5Location::H5Location() : IdComponent() {}
Notes for H5A wrappers
======================
May, 2017 (1.8.19)
- These H5A wrappers are copied to H5Object to prevent an attribute
+ The H5A wrappers are copied to H5Object to prevent an attribute
id being passed in to H5A APIs. The original H5A wrapper functions
here will be deprecated in future releases.
+May, 2018 (1.8.21)
+ They are removed from 1.8.21
***************************************************************************/
//--------------------------------------------------------------------------
-// Function: H5Location::createAttribute
-///\brief Deprecated - replaced by H5Object::createAttribute()
-// brief Creates an attribute for a group, dataset, or named datatype.
-///\param name - IN: Name of the attribute
-///\param data_type - IN: Datatype for the attribute
-///\param data_space - IN: Dataspace for the attribute - only simple
-/// dataspaces are allowed at this time
-///\param create_plist - IN: Creation property list - default to
-/// PropList::DEFAULT
-///\return Attribute instance
-///\exception H5::AttributeIException
-///\par Description
-/// The attribute name specified in \a name must be unique.
-/// Attempting to create an attribute with the same name as an
-/// existing attribute will raise an exception, leaving the
-/// pre-existing attribute intact. To overwrite an existing
-/// attribute with a new attribute of the same name, first
-/// delete the existing one with \c H5Location::removeAttr, then
-/// recreate it with this function.
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// - Moved to H5Object in 1.8.19. -BMR
-//--------------------------------------------------------------------------
-Attribute H5Location::createAttribute(const char* name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist) const
-{
- hid_t type_id = data_type.getId();
- hid_t space_id = data_space.getId();
- hid_t plist_id = create_plist.getId();
- hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT);
-
- // If the attribute id is valid, create and return the Attribute object
- if(attr_id > 0)
- {
- Attribute attr;
- f_Attribute_setId(&attr, attr_id);
- return(attr);
- }
- else
- throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::createAttribute
-///\brief Deprecated - replaced by H5Object::createAttribute()
-// brief This is an overloaded member function, provided for convenience.
-/// It differs from the above function in that it takes
-/// a reference to an \c H5std_string for \a name.
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// - Moved to H5Object in 1.8.19. -BMR
-//--------------------------------------------------------------------------
-Attribute H5Location::createAttribute(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const PropList& create_plist) const
-{
- return(createAttribute(name.c_str(), data_type, data_space, create_plist));
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::openAttribute
-///\brief Deprecated - replaced by H5Object::openAttribute()
-// brief Opens an attribute given its name.
-///\param name - IN: Name of the attribute
-///\return Attribute instance
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// - Moved to H5Object in 1.8.19. -BMR
-//--------------------------------------------------------------------------
-Attribute H5Location::openAttribute(const char* name) const
-{
- hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT);
- if(attr_id > 0)
- {
- Attribute attr;
- f_Attribute_setId(&attr, attr_id);
- return(attr);
- }
- else
- {
- throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed");
- }
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::openAttribute
-///\brief Deprecated - replaced by H5Object::openAttribute()
-// brief This is an overloaded member function, provided for convenience.
-// It differs from the above function in that it takes
-// a reference to an \c H5std_string for \a name.
-///\param name - IN: Name of the attribute
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// - Moved to H5Object in 1.8.19. -BMR
-//--------------------------------------------------------------------------
-Attribute H5Location::openAttribute(const H5std_string& name) const
-{
- return(openAttribute(name.c_str()));
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::openAttribute
-///\brief Deprecated - replaced by H5Object::openAttribute()
-// brief Opens an attribute given its index.
-///\param idx - IN: Index of the attribute, a 0-based, non-negative integer
-///\return Attribute instance
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// - Moved to H5Object in 1.8.19. -BMR
-//--------------------------------------------------------------------------
-Attribute H5Location::openAttribute(const unsigned int idx) const
-{
- hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER,
- H5_ITER_INC, static_cast<hsize_t>(idx), H5P_DEFAULT, H5P_DEFAULT);
- if(attr_id > 0)
- {
- Attribute attr;
- f_Attribute_setId(&attr, attr_id);
- return(attr);
- }
- else
- {
- throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed");
- }
-}
-
-//--------------------------------------------------------------------------
// Function: H5Location::iterateAttrs
///\brief Iterates a user's function over all the attributes of an H5
/// object, which may be a group, dataset or named datatype.
@@ -264,128 +148,17 @@ int H5Location::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_d
}
//--------------------------------------------------------------------------
-// Function: H5Location::attrExists
-///\brief Deprecated - replaced by H5Object::attrExists()
-// brief Checks whether the named attribute exists at this location.
-///\param name - IN: Name of the attribute to be queried
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2013
-// Modification
-// - Moved to H5Object in 1.8.19. -BMR
-//--------------------------------------------------------------------------
-bool H5Location::attrExists(const char* name) const
-{
- // Call C routine H5Aexists to determine whether an attribute exists
- // at this location, which could be specified by a file, group, dataset,
- // or named datatype.
- herr_t ret_value = H5Aexists(getId(), name);
- if(ret_value > 0)
- return true;
- else if(ret_value == 0)
- return false;
- else // Raise exception when H5Aexists returns a negative value
- throw AttributeIException(inMemFunc("attrExists"), "H5Aexists failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::attrExists
-///\brief Deprecated - replaced by H5Object::attrExists()
-// brief This is an overloaded member function, provided for convenience.
-// It differs from the above function in that it takes
-// a reference to an \c H5std_string for \a name.
-///\param name - IN: Name of the attribute to be queried
-// Programmer Binh-Minh Ribler - 2013
-// Modification
-// - Moved to H5Object in 1.8.19. -BMR
-//--------------------------------------------------------------------------
-bool H5Location::attrExists(const H5std_string& name) const
-{
- return(attrExists(name.c_str()));
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::removeAttr
-///\brief Deprecated - replaced by H5Object::removeAttr()
-// brief Removes the named attribute from this object.
-///\param name - IN: Name of the attribute to be removed
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// - Moved to H5Object in 1.8.19. -BMR
-//--------------------------------------------------------------------------
-void H5Location::removeAttr(const char* name) const
-{
- herr_t ret_value = H5Adelete(getId(), name);
- if(ret_value < 0)
- throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::removeAttr
-///\brief Deprecated - replaced by H5Object::removeAttr()
-// brief This is an overloaded member function, provided for convenience.
-// It differs from the above function in that it takes
-// a reference to an \c H5std_string for \a name.
-///\param name - IN: Name of the attribute to be removed
-// Programmer Binh-Minh Ribler - 2000
-// Modification
-// - Moved to H5Object in 1.8.19. -BMR
-//--------------------------------------------------------------------------
-void H5Location::removeAttr(const H5std_string& name) const
-{
- removeAttr(name.c_str());
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::renameAttr
-///\brief Deprecated - replaced by H5Object::renameAttr()
-// brief Renames the named attribute from this object.
-///\param oldname - IN: Name of the attribute to be renamed
-///\param newname - IN: New name ame of the attribute
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - Mar, 2005
-// Modification
-// - Moved to H5Object in 1.8.19. -BMR
-//--------------------------------------------------------------------------
-void H5Location::renameAttr(const char* oldname, const char* newname) const
-{
- herr_t ret_value = H5Arename(getId(), oldname, newname);
- if (ret_value < 0)
- throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed");
-}
-
-//--------------------------------------------------------------------------
-// Function: H5Location::renameAttr
-///\brief Deprecated - replaced by H5Object::renameAttr()
-// brief This is an overloaded member function, provided for convenience.
-// It differs from the above function in that it takes
-// a reference to an \c H5std_string for the names.
-//
-///\param oldname - IN: Name of the attribute to be renamed
-///\param newname - IN: New name ame of the attribute
-///\exception H5::AttributeIException
-// Programmer Binh-Minh Ribler - Mar, 2005
-// Modification
-// - Moved to H5Object in 1.8.19. -BMR
-//--------------------------------------------------------------------------
-void H5Location::renameAttr(const H5std_string& oldname, const H5std_string& newname) const
-{
- renameAttr (oldname.c_str(), newname.c_str());
-}
-
-//--------------------------------------------------------------------------
// Function: H5Location::getNumAttrs
-///\brief Deprecated - replaced by H5Object::getNumAttrs()
-// brief Returns the number of attributes attached to this HDF5 object.
+///\brief Returns the number of attributes attached to an HDF5 object.
///\return Number of attributes
///\exception H5::AttributeIException
-// 2000
// Modification
-// - Moved to H5Object in 1.8.19. -BMR
+// - Moved from H5Object to allow passing an attribute id to the
+// C API, in 1.8.20.
//--------------------------------------------------------------------------
int H5Location::getNumAttrs() const
{
- H5O_info_t objinfo; /* Object info */
+ H5O_info_t objinfo; /* Object info */
if(H5Oget_info(getId(), &objinfo) < 0)
throwException("getNumAttrs", "H5Oget_info failed");
@@ -404,7 +177,7 @@ int H5Location::getNumAttrs() const
/// H5::DataSetIException
/// H5::DataTypeIException
/// H5::AttributeIException
-// Nov 2016
+// December 2016
//--------------------------------------------------------------------------
bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const
{
@@ -424,9 +197,13 @@ bool H5Location::nameExists(const char* name, const LinkAccPropList& lapl) const
///\brief Checks if a link of a given name exists in a location.
///\param name - IN: Searched name - \c H5std_string
///\param lapl - IN: Link access property list
-///\exception H5::LocationException
-// Programmer Binh-Minh Ribler - Dec, 2016
-// Modification
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// December 2016
//--------------------------------------------------------------------------
bool H5Location::nameExists(const H5std_string& name, const LinkAccPropList& lapl) const
{
@@ -807,6 +584,12 @@ H5std_string H5Location::getComment(const char* name, size_t buf_size) const
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function in that it takes an
/// \c H5std_string for \a name.
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
// July 2004
// Modification
// Moved from CommonFG, Sep 2013
@@ -850,7 +633,12 @@ hid_t H5Location::openObjId(const char* obj_name, const LinkAccPropList& lapl) c
///\param obj_name - IN: Path to the object
///\param lapl - IN: Access property list for the link pointing to
/// the object
-///\exception H5::LocationException
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
// May 2017
//--------------------------------------------------------------------------
hid_t H5Location::openObjId(const H5std_string& obj_name, const LinkAccPropList& lapl) const
@@ -1040,15 +828,18 @@ void H5Location::dereference(const H5Location& loc, const void* ref, H5R_type_t
///\param ref - IN: Reference pointer
///\param ref_type - IN: Reference type
///\exception H5::ReferenceException
-// Programmer Binh-Minh Ribler - Oct, 2006
+// October 2006
// Modification
// May, 2008
// Corrected missing parameters. - BMR
+// May, 2018
+// Removed in 1.8.21 because H5Location is Attribute's baseclass
+// now. -BMR
//--------------------------------------------------------------------------
-void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type)
-{
- p_setId(p_dereference(attr.getId(), ref, ref_type, "dereference"));
-}
+//void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type)
+//{
+ //p_setId(p_dereference(attr.getId(), ref, ref_type, "dereference"));
+//}
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
@@ -1203,6 +994,443 @@ DataSpace H5Location::getRegion(void *ref, H5R_type_t ref_type) const
}
//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief Creates a soft link from \a link_name to \a target_name.
+///\param target_name - IN: Name of object, can be a non-existing object
+///\param link_name - IN: Link name for the target name
+///\param lcpl - IN: Link creation plist - default to LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default to LinkAccPropList::DEFAULT
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+///\par Description
+/// Note that both names are interpreted relative to the current
+/// location.
+/// For information on creating a soft link, please refer to the
+/// H5Lcreate_soft APIs in the HDF5 C Reference Manual.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const char *target_name, const char *link_name,
+ const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+{
+ herr_t ret_value = -1;
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lcreate_soft(target_name, getId(), link_name, lcpl_id, lapl_id);
+ if (ret_value < 0)
+ throwException("link", "creating soft link failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a target_name and \a link_name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const H5std_string& target_name,
+ const H5std_string& link_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ link(target_name.c_str(), link_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief Creates a hard link from \a new_name to \a curr_name.
+///\param curr_name - IN: Name of the existing object
+///\param new_loc - IN: New location
+///\param new_name - IN: New name for the object
+///\param lcpl - IN: Link creation plist - default to LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default to LinkAccPropList::DEFAULT
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+///\par Description
+/// Note that both names are interpreted relative to the
+/// specified location.
+/// For information on creating a hard link, please refer to the
+/// H5Lcreate_hard APIs in the HDF5 C Reference Manual.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const char *curr_name, const H5Location& new_loc,
+ const char *new_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ herr_t ret_value = -1;
+ hid_t new_loc_id = new_loc.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lcreate_hard(getId(), curr_name, new_loc.getId(), new_name, lcpl_id, lapl_id);
+ if (ret_value < 0)
+ throwException("link", "creating link failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a curr_name and \a new_name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const H5std_string& curr_name, const H5Location& new_loc,
+ const H5std_string& new_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ link(curr_name.c_str(), new_loc, new_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief Creates a hard link from \a new_name to \a curr_name - can be
+/// used to pass in H5L_SAME_LOC.
+///\param curr_name - IN: Name of the existing object
+///\param loc_id - IN: Location ID, or H5L_SAME_LOC
+///\param new_name - IN: New name for the link
+///\param lcpl - IN: Link creation plist - default to LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default to LinkAccPropList::DEFAULT
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+///\par Description
+/// Note that both names are interpreted relative to the
+/// specified location.
+/// For information on creating a hard link, please refer to the
+/// H5Lcreate_hard APIs in the HDF5 C Reference Manual.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const char *curr_name, const hid_t same_loc,
+ const char *new_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ herr_t ret_value = -1;
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lcreate_hard(getId(), curr_name, same_loc, new_name, lcpl_id, lapl_id);
+
+ if (ret_value < 0)
+ throwException("link", "creating link failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::link
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a curr_name and \a new_name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::link(const H5std_string& curr_name, const hid_t same_loc,
+ const H5std_string& new_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ link(curr_name.c_str(), same_loc, new_name.c_str(), lcpl, lapl);
+}
+
+
+//--------------------------------------------------------------------------
+// Function: H5Location::copyLink
+///\brief Copies a link from one location to another.
+///\param src_name - IN: Original name
+///\param dst - IN: Destination location
+///\param dst_name - IN: New name
+///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::copyLink(const char *src_name, const H5Location& dst,
+ const char *dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ herr_t ret_value;
+ hid_t dst_id = dst.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lcopy(getId(), src_name, dst_id, dst_name, lcpl_id, lapl_id);
+ if(ret_value < 0)
+ throwException("copyLink", "H5Lcopy failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::copyLink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a src_name and \a dst_name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::copyLink(const H5std_string& src_name, const H5Location& dst,
+ const H5std_string& dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ copyLink(src_name.c_str(), dst, dst_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::copyLink
+///\brief Copies a link from a location into the same location.
+///\param src_name - IN: Original name
+///\param dst_name - IN: New name
+///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::copyLink(const char *src_name,
+ const char *dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ herr_t ret_value;
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lcopy(getId(), src_name, H5L_SAME_LOC, dst_name, lcpl_id, lapl_id);
+ if(ret_value < 0)
+ throwException("copyLink", "H5Lcopy H5L_SAME_LOC failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::copyLink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a src_name and \a dst_name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::copyLink(const H5std_string& src_name,
+ const H5std_string& dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ copyLink(src_name.c_str(), dst_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::moveLink
+///\brief Renames a link in this location and moves it to a new location.
+///\param src_name - IN: Original name
+///\param dst - IN: Destination location
+///\param dst_name - IN: New name
+///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+///\note
+/// Exercise care in moving groups as it is possible to render
+/// data in a file inaccessible with H5Location::moveLink. Please refer
+/// to the Group Interface in the HDF5 User's Guide for details.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::moveLink(const char* src_name, const H5Location& dst,
+ const char* dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ herr_t ret_value;
+ hid_t dst_id = dst.getId();
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lmove(getId(), src_name, dst_id, dst_name, lcpl_id, lapl_id);
+ if (ret_value < 0)
+ throwException("moveLink", "H5Lmove failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::moveLink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a src_name and \a dst_name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::moveLink(const H5std_string& src_name, const H5Location& dst,
+ const H5std_string& dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ moveLink(src_name.c_str(), dst, dst_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::moveLink
+///\brief Renames a link in this location.
+///\param src_name - IN: Original name
+///\param dst_name - IN: New name
+///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT
+///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+///\note
+/// Exercise care in moving groups as it is possible to render
+/// data in a file inaccessible with H5Location::moveLink. Please refer
+/// to the Group Interface in the HDF5 User's Guide for details.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::moveLink(const char* src_name, const char* dst_name,
+ const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const
+{
+ herr_t ret_value;
+ hid_t lcpl_id = lcpl.getId();
+ hid_t lapl_id = lapl.getId();
+
+ ret_value = H5Lmove(getId(), src_name, H5L_SAME_LOC, dst_name, lcpl_id, lapl_id);
+ if (ret_value < 0)
+ throwException("moveLink", "H5Lmove H5L_SAME_LOC failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::moveLink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a src_name and \a dst_name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::moveLink(const H5std_string& src_name,
+ const H5std_string& dst_name, const LinkCreatPropList& lcpl,
+ const LinkAccPropList& lapl) const
+{
+ moveLink(src_name.c_str(), dst_name.c_str(), lcpl, lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::unlink
+///\brief Removes the specified link from this location.
+///\param name - IN: Name of the object to be removed
+///\exception One of the following:
+/// H5::GroupIException
+/// H5::FileIException
+/// H5::DataSetIException
+/// H5::DataTypeIException
+/// H5::AttributeIException
+// May 2018
+// Developer's Note
+// Originally, CommonFG::unlink was the wrapper of H5Gunlink,
+// which was replaced by H5Ldelete. The name "unlink" was kept
+// to help with backward compatibility.
+//--------------------------------------------------------------------------
+void H5Location::unlink(const char* name, const LinkAccPropList& lapl) const
+{
+ herr_t ret_value = H5Ldelete(getId(), name, lapl.getId());
+ if (ret_value < 0)
+ throwException("unlink", "H5Ldelete failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::unlink
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a name.
+// May 2018
+//--------------------------------------------------------------------------
+void H5Location::unlink(const H5std_string& name, const LinkAccPropList& lapl) const
+{
+ unlink(name.c_str(), lapl);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::getLinkInfo
+///\brief Returns the information of the named link.
+///\param link_name - IN: Symbolic link to the object
+///\param size - IN: Maximum number of characters of value to be returned
+///\return Name of the object
+///\exception H5::FileIException/H5::GroupIException/H5::LocationException
+// 2000
+//--------------------------------------------------------------------------
+H5L_info_t H5Location::getLinkInfo(const char* link_name, const LinkAccPropList& lapl) const
+{
+ H5L_info_t linkinfo; // link info structure
+
+ herr_t ret_value = H5Lget_info(getId(), link_name, &linkinfo, lapl.getId());
+ if (ret_value < 0)
+ throwException("getLinkInfo", "H5Lget_info to find buffer size failed");
+
+ return(linkinfo);
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::getLinkInfo
+///\brief This is an overloaded member function, provided for convenience.
+/// It differs from the above function in that it takes an
+/// \c H5std_string for \a link_name.
+//--------------------------------------------------------------------------
+H5L_info_t H5Location::getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl) const
+{
+ return(getLinkInfo(link_name.c_str(), lapl));
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Location::getLinkval
+///\brief Returns the name of the object that the symbolic link points to.
+///\param name - IN: Symbolic link to the object
+///\param size - IN: Maximum number of characters of value to be returned
+///\return Name of the object
+///\exception H5::FileIException/H5::GroupIException/H5::LocationException
+// 2000
+//--------------------------------------------------------------------------
+H5std_string H5Location::getLinkval(const char* name, size_t size) const
+{
+ H5L_info_t linkinfo;
+ char *value_C; // value in C string
+ size_t val_size = size;
+ H5std_string value = "";
+ herr_t ret_value;
+
+ // if user doesn't provide buffer size, determine it
+ if (size == 0)
+ {
+ ret_value = H5Lget_info(getId(), name, &linkinfo, H5P_DEFAULT);
+ if (ret_value < 0)
+ throwException("getLinkval", "H5Lget_info to find buffer size failed");
+
+ val_size = linkinfo.u.val_size;
+ }
+
+ // if link has value, retrieve the value, otherwise, return null string
+ if (val_size > 0)
+ {
+ value_C = new char[val_size+1]; // temporary C-string for C API
+ HDmemset(value_C, 0, val_size+1); // clear buffer
+
+ ret_value = H5Lget_val(getId(), name, value_C, val_size, H5P_DEFAULT);
+ if (ret_value < 0)
+ {
+ delete []value_C;
+ throwException("getLinkval", "H5Lget_val failed");
+ }
+
+ value = H5std_string(value_C);
+ delete []value_C;
+ }
+ return(value);
+}
+
+//--------------------------------------------------------------------------
// Function: H5Location destructor
///\brief Noop destructor.
// Programmer Binh-Minh Ribler - 2000
@@ -1211,18 +1439,10 @@ H5Location::~H5Location() {}
//--------------------------------------------------------------------------
// Function: f_Attribute_setId - friend
-// Purpose: This function is friend to class H5::Attribute so that it
-// can set Attribute::id in order to work around a problem
-// described in the JIRA issue HDFFV-7947.
-// Applications shouldn't need to use it.
-// param attr - IN/OUT: Attribute object to be changed
-// param new_id - IN: New id to set
-// Programmer Binh-Minh Ribler - 2015
+// Modification:
+// Moved to H5Object.cpp after the rearrangement of classes
+// -BMR, Dec 2016
//--------------------------------------------------------------------------
-void f_Attribute_setId(Attribute* attr, hid_t new_id)
-{
- attr->p_setId(new_id);
-}
//--------------------------------------------------------------------------
// Function: f_DataSpace_setId - friend
diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h
index 0316a53..e76a6fc 100644
--- a/c++/src/H5Location.h
+++ b/c++/src/H5Location.h
@@ -41,6 +41,9 @@ class UserData4Aiterate { // user data for attribute iteration
// Inheritance: IdComponent
class H5_DLLCPP H5Location : public IdComponent {
public:
+ // Determines the number of attributes belong to this object.
+ int getNumAttrs() const;
+
// Checks if a link of a given name exists in this location
bool nameExists(const char* name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
bool nameExists(const H5std_string& name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
@@ -60,10 +63,6 @@ class H5_DLLCPP H5Location : public IdComponent {
void getObjectInfo(const H5std_string& name, H5O_info_t *oinfo,
const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
- // Determines the number of attributes at this location.
- // - moved to H5Object (1.8.20)
- int getNumAttrs() const; // Deprecated
-
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Retrieves the type of object that an object reference points to.
H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const;
@@ -118,6 +117,87 @@ class H5_DLLCPP H5Location : public IdComponent {
// Closes an object opened by openObjId()
static void closeObjId(hid_t obj_id);
+ // Creates a soft link from link_name to target_name.
+ void link(const char *target_name, const char *link_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void link(const H5std_string& target_name,
+ const H5std_string& link_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Creates a hard link from new_name to curr_name.
+ void link(const char *curr_name,
+ const H5Location& new_loc, const char *new_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void link(const H5std_string& curr_name,
+ const H5Location& new_loc, const H5std_string& new_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Creates a hard link from new_name to curr_name in same location.
+ void link(const char *curr_name,
+ const hid_t same_loc, const char *new_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void link(const H5std_string& curr_name,
+ const hid_t same_loc, const H5std_string& new_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Removes the specified link from this location.
+ void unlink(const char *link_name,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void unlink(const H5std_string& link_name,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Copies a link from this location to another.
+ void copyLink(const char *src_name,
+ const H5Location& dst, const char *dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void copyLink(const H5std_string& src_name,
+ const H5Location& dst, const H5std_string& dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Makes a copy of a link in the same location.
+ void copyLink(const char *src_name, const char *dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void copyLink(const H5std_string& src_name,
+ const H5std_string& dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Renames a link in this location and moves to a new location.
+ void moveLink(const char* src_name,
+ const H5Location& dst, const char* dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void moveLink(const H5std_string& src_name,
+ const H5Location& dst, const H5std_string& dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Renames a link in this location.
+ void moveLink(const char* src_name, const char* dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void moveLink(const H5std_string& src_name,
+ const H5std_string& dst_name,
+ const LinkCreatPropList& lcpl = LinkCreatPropList::DEFAULT,
+ const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Returns the information of the named link.
+ H5L_info_t getLinkInfo(const char* link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ H5L_info_t getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
+ // Returns the value of a symbolic link.
+ H5std_string getLinkval(const char* link_name, size_t size=0) const;
+ H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
+
///\brief Returns an identifier. (pure virtual)
virtual hid_t getId() const = 0;
@@ -127,23 +207,24 @@ class H5_DLLCPP H5Location : public IdComponent {
These H5A wrappers are marked "deprecated" in 1.8.19.
They are moved to H5Object to prevent the object id from being
passed in to H5A APIs.
+ Updated: they are removed from source code in 1.8.21.
***************************************************************************/
// Creates an attribute for the specified object at this location
// PropList is currently not used, so always be default.
// Deprecated
- virtual Attribute createAttribute(const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
- virtual Attribute createAttribute(const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
+ //virtual Attribute createAttribute(const char* name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
+ //virtual Attribute createAttribute(const H5std_string& name, const DataType& type, const DataSpace& space, const PropList& create_plist = PropList::DEFAULT) const;
// Given its name, opens the attribute that belongs to an object at
// this location.
// Deprecated
- virtual Attribute openAttribute(const char* name) const;
- virtual Attribute openAttribute(const H5std_string& name) const;
+ //virtual Attribute openAttribute(const char* name) const;
+ //virtual Attribute openAttribute(const H5std_string& name) const;
// Given its index, opens the attribute that belongs to an object at
// this location.
- virtual Attribute openAttribute(const unsigned int idx) const; // Deprecated
+ //virtual Attribute openAttribute(const unsigned int idx) const; // Deprecated
// Iterate user's function over the attributes at this location.
virtual int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL,
@@ -151,24 +232,24 @@ class H5_DLLCPP H5Location : public IdComponent {
// Checks whether the named attribute exists at this location.
// Deprecated
- virtual bool attrExists(const char* name) const;
- virtual bool attrExists(const H5std_string& name) const;
+ //virtual bool attrExists(const char* name) const;
+ //virtual bool attrExists(const H5std_string& name) const;
// Renames the named attribute to a new name.
// Deprecated
- virtual void renameAttr(const char* oldname, const char* newname) const;
- virtual void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
+ //virtual void renameAttr(const char* oldname, const char* newname) const;
+ //virtual void renameAttr(const H5std_string& oldname, const H5std_string& newname) const;
// Removes the named attribute from this location.
// Deprecated
- virtual void removeAttr(const char* name) const;
- virtual void removeAttr(const H5std_string& name) const;
+ //virtual void removeAttr(const char* name) const;
+ //virtual void removeAttr(const H5std_string& name) const;
/**************************** End of H5A note *******************************/
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Default constructor,
+ // Default constructor
H5Location();
// *** Deprecation warning ***
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 4697d9c..868a5d3 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -25,6 +25,8 @@
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5DataSpace.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5AbstractDs.h"
#include "H5LaccProp.h"
#include "H5Location.h"
@@ -34,11 +36,6 @@
namespace H5 {
-#ifndef H5_NO_STD
- using std::cerr;
- using std::endl;
-#endif // H5_NO_STD
-
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// userAttrOpWrpr simply interfaces between the user's function and the
// C library function H5Aiterate2; used to resolve the different prototype
@@ -64,32 +61,19 @@ namespace H5 {
H5Object::H5Object() : H5Location() {}
//--------------------------------------------------------------------------
-// Function: H5Object overloaded constructor (protected)
-// Purpose Creates an H5Object object using the id of an existing HDF5
-// object.
-// Parameters object_id - IN: Id of an existing HDF5 object
-// Programmer Binh-Minh Ribler - 2000
-// *** Deprecation warning ***
-// This constructor is no longer appropriate because the data member "id" had
-// been moved to the sub-classes. It will be removed in 1.10 release. If its
-// removal does not raise any problems in 1.10, it will be removed from 1.8 in
-// subsequent releases.
-// Removed in 1.8.18 and 1.10.1 - Aug 2016
+// Function: f_Attribute_setId - friend
+// Purpose: This function is friend to class H5::Attribute so that it
+// can set Attribute::id in order to work around a problem
+// described in the JIRA issue HDFFV-7947.
+// Applications shouldn't need to use it.
+// param attr - IN/OUT: Attribute object to be changed
+// param new_id - IN: New id to set
+// Programmer Binh-Minh Ribler - 2015
//--------------------------------------------------------------------------
-//H5Object::H5Object(const hid_t object_id) : H5Location() {}
-
-//--------------------------------------------------------------------------
-// Function: H5Object copy constructor
-///\brief Copy constructor: makes a copy of the original H5Object
-/// instance.
-///\param original - IN: H5Object instance to copy
-// Programmer Binh-Minh Ribler - 2000
-// *** Deprecation warning ***
-// This constructor is no longer appropriate because the data member "id" had
-// been moved to the sub-classes. It is removed from 1.8.15 because it is
-// a noop and it can be generated by the compiler if needed.
-//--------------------------------------------------------------------------
-// H5Object::H5Object(const H5Object& original) : H5Location() {}
+void f_Attribute_setId(Attribute* attr, hid_t new_id)
+{
+ attr->p_setId(new_id);
+}
/***************************************************************************
Notes for H5A wrappers
@@ -301,12 +285,14 @@ void H5Object::renameAttr(const H5std_string& oldname, const H5std_string& newna
//--------------------------------------------------------------------------
// Function: H5Object::getNumAttrs
-///\brief Returns the number of attributes attached to this HDF5 object.
+///\brief Deprecated - replaced by H5Location::getNumAttrs()
+// brief Returns the number of attributes attached to this HDF5 object.
///\return Number of attributes
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
// Modification
-// - Moved from H5Location in 1.8.20. -BMR Oct, 2017
+// - Moved to H5Location to allow passing an attribute id to the
+// C API, in 1.8.20.
//--------------------------------------------------------------------------
int H5Object::getNumAttrs() const
{
@@ -314,8 +300,7 @@ int H5Object::getNumAttrs() const
if(H5Oget_info(getId(), &oinfo) < 0)
throwException("getNumAttrs", "H5Oget_info failed");
- else
- return(static_cast<int>(oinfo.num_attrs));
+ return(static_cast<int>(oinfo.num_attrs));
}
//--------------------------------------------------------------------------
diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp
index 63061f7..0838f1c 100644
--- a/c++/src/H5PredType.cpp
+++ b/c++/src/H5PredType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp
index 00fbe20..c2c5b92 100644
--- a/c++/src/H5StrType.cpp
+++ b/c++/src/H5StrType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"
diff --git a/c++/src/H5StrcreatProp.cpp b/c++/src/H5StrcreatProp.cpp
index 79749d8..eb8ae6f 100644
--- a/c++/src/H5StrcreatProp.cpp
+++ b/c++/src/H5StrcreatProp.cpp
@@ -13,6 +13,11 @@
#include <string>
+#include <iostream>
+ using std::cerr;
+ using std::endl;
+
+
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
@@ -22,6 +27,31 @@
namespace H5 {
//--------------------------------------------------------------------------
+// Function: StrCreatPropList default constructor
+///\brief Default constructor: Creates a string create property list
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+StrCreatPropList::StrCreatPropList() : PropList(H5P_STRING_CREATE) {}
+
+//--------------------------------------------------------------------------
+// Function: StrCreatPropList copy constructor
+///\brief Copy constructor: makes a copy of the original
+/// StrCreatPropList object.
+///\param original - IN: StrCreatPropList instance to copy
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+StrCreatPropList::StrCreatPropList(const StrCreatPropList& original) : PropList(original) {}
+
+//--------------------------------------------------------------------------
+// Function: StrCreatPropList overloaded constructor
+///\brief Creates a file creation property list using the id of an
+/// existing one.
+///\param plist_id - IN: StrCreatPropList id to use
+// Programmer Binh-Minh Ribler - 2000
+//--------------------------------------------------------------------------
+StrCreatPropList::StrCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
+
+//--------------------------------------------------------------------------
// Function: StrCreatPropList::setCharEncoding
///\brief Sets the character encoding of the string.
///\exception H5::PropListIException
diff --git a/c++/src/H5StrcreatProp.h b/c++/src/H5StrcreatProp.h
index 7b07dd6..9679a55 100644
--- a/c++/src/H5StrcreatProp.h
+++ b/c++/src/H5StrcreatProp.h
@@ -37,14 +37,14 @@ class H5_DLLCPP StrCreatPropList : public PropList {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
protected:
// Creates a link creation property list.
- StrCreatPropList() {};
+ StrCreatPropList();
// Copy constructor: same as the original StrCreatPropList.
- StrCreatPropList(const StrCreatPropList& original) {};
+ StrCreatPropList(const StrCreatPropList& original);
// Creates a copy of an existing link creation property list
// using the property list id.
- StrCreatPropList(const hid_t plist_id) {};
+ StrCreatPropList(const hid_t plist_id);
// Noop destructor
virtual ~StrCreatPropList() {};
diff --git a/c++/src/H5VarLenType.cpp b/c++/src/H5VarLenType.cpp
index 8d9e3a1..902de79 100644
--- a/c++/src/H5VarLenType.cpp
+++ b/c++/src/H5VarLenType.cpp
@@ -17,6 +17,8 @@
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
+#include "H5StrcreatProp.h"
+#include "H5LcreatProp.h"
#include "H5LaccProp.h"
#include "H5Location.h"
#include "H5Object.h"