summaryrefslogtreecommitdiffstats
path: root/c++/src
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2018-07-17 06:09:45 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2018-07-17 06:09:45 (GMT)
commit14bf28780aa850928c0ffeae838f6dd6140bd615 (patch)
tree13515fcdfea82e30d1d3009359d973b3bfe9548c /c++/src
parentfe916ada370f33b48b3c39dbf9e3ff73df00fdb7 (diff)
downloadhdf5-14bf28780aa850928c0ffeae838f6dd6140bd615.zip
hdf5-14bf28780aa850928c0ffeae838f6dd6140bd615.tar.gz
hdf5-14bf28780aa850928c0ffeae838f6dd6140bd615.tar.bz2
Fixed HDFFV-10458 partially
Description: Added wrappers for H5Oget_info2 and H5Oget_info_by_name2. // Returns information about an HDF5 object. void getInfo(H5O_info_t& objinfo, unsigned fields = H5O_INFO_BASIC) // Returns information about an HDF5 object, given its name. void getInfo(const char* name, H5O_info_t& objinfo, unsigned fields = H5O_INFO_BASIC, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) void getInfo(const H5std_string& name, H5O_info_t& objinfo, unsigned fields = H5O_INFO_BASIC, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) Platforms tested: Linux/64 (jelly) Linux/32 (jam) Darwin (osx1010test)
Diffstat (limited to 'c++/src')
-rw-r--r--c++/src/H5Object.cpp54
-rw-r--r--c++/src/H5Object.h5
2 files changed, 59 insertions, 0 deletions
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index b95e222..940a7c6 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -227,6 +227,60 @@ int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_dat
}
//--------------------------------------------------------------------------
+// Function: H5Object::getInfo
+///\brief Returns information about an HDF5 object.
+///\return Struct containing the object info
+///\exception
+// July, 2018
+//--------------------------------------------------------------------------
+void H5Object::getInfo(H5O_info_t& objinfo, unsigned fields) const
+{
+
+ // Use C API to get information of the object
+ herr_t ret_value = H5Oget_info2(getId(), &objinfo, fields);
+
+ // Throw exception if C API returns failure
+ if (ret_value < 0)
+ throwException(inMemFunc("getObjinfo"), "H5Oget_info2 failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::getInfo
+///\brief Returns information about an HDF5 object given its name.
+///\return Struct containing the object info
+///\exception
+// July, 2018
+//--------------------------------------------------------------------------
+void H5Object::getInfo(const char* name, H5O_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const
+{
+ // Use C API to get information of the object
+ herr_t ret_value = H5Oget_info_by_name2(getId(), name, &objinfo, fields, lapl.getId());
+
+ // Throw exception if C API returns failure
+ if (ret_value < 0)
+ throwException(inMemFunc("getObjinfo"), "H5Oget_info_by_name2 failed");
+}
+
+//--------------------------------------------------------------------------
+// Function: H5Object::getInfo
+///\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.
+///\return Struct containing the object info
+///\exception
+// July, 2018
+//--------------------------------------------------------------------------
+void H5Object::getInfo(const H5std_string& name, H5O_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const
+{
+ // Use C API to get information of the object
+ herr_t ret_value = H5Oget_info_by_name2(getId(), name.c_str(), &objinfo, fields, lapl.getId());
+
+ // Throw exception if C API returns failure
+ if (ret_value < 0)
+ throwException(inMemFunc("getObjinfo"), "H5Oget_info_by_name2 failed");
+}
+
+//--------------------------------------------------------------------------
// Function: H5Object::objVersion
///\brief Returns the header version of this HDF5 object.
///\return Object version, which can have the following values:
diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h
index 10b3865..606b0ce 100644
--- a/c++/src/H5Object.h
+++ b/c++/src/H5Object.h
@@ -92,6 +92,11 @@ class H5_DLLCPP H5Object : public H5Location {
// Returns an identifier.
virtual hid_t getId() const = 0;
+ // Returns information about an HDF5 object.
+ void getInfo(H5O_info_t& objinfo, unsigned fields = H5O_INFO_BASIC) const;
+ void getInfo(const char* name, H5O_info_t& objinfo, unsigned fields = H5O_INFO_BASIC, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+ void getInfo(const H5std_string& name, H5O_info_t& objinfo, unsigned fields = H5O_INFO_BASIC, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const;
+
// Gets the name of this HDF5 object, i.e., Group, DataSet, or
// DataType.
ssize_t getObjName(char *obj_name, size_t buf_size = 0) const;