summaryrefslogtreecommitdiffstats
path: root/c++/src/H5CommonFG.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2015-03-29 04:37:28 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2015-03-29 04:37:28 (GMT)
commit39fb0401a089a3c3f9e9e2105eaaa69c9a4ab8a9 (patch)
tree243391a9261a95dc32a86ebf78f74796875b3745 /c++/src/H5CommonFG.cpp
parent8e5a71c716c4d88b273137a81376f1a63ba54900 (diff)
downloadhdf5-39fb0401a089a3c3f9e9e2105eaaa69c9a4ab8a9.zip
hdf5-39fb0401a089a3c3f9e9e2105eaaa69c9a4ab8a9.tar.gz
hdf5-39fb0401a089a3c3f9e9e2105eaaa69c9a4ab8a9.tar.bz2
[svn-r26643] Purpose: Adding new wrappers (HDFFR-9167 partially)
Description: Added wrappers for C functions H5P[s/g]et_libver_bounds and wrappers for getting object header version // Sets bounds on versions of library format to be used when creating // or writing objects. void setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const; // Gets the current settings for the library version format bounds. void getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& libver_high) const; // Returns the object header version of an object in a file or group, // given the object's name. unsigned childObjVersion(const char* objname) const; unsigned childObjVersion(const H5std_string& objname) const; Platforms tested: Linux/64 (platypus) Linux/32 2.6 SunOS 5.11
Diffstat (limited to 'c++/src/H5CommonFG.cpp')
-rw-r--r--c++/src/H5CommonFG.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index 3aa0386..1ef36eb 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -1100,6 +1100,58 @@ H5O_type_t CommonFG::childObjType(hsize_t index, H5_index_t index_type, H5_iter_
return(objtype);
}
+//--------------------------------------------------------------------------
+// Function: CommonFG::childObjVersion
+///\brief Returns the object header version of an object in this file/group,
+/// given the object's name.
+///\param objname - IN: Name of the object
+///\return Object version, which can have the following values:
+/// \li \c H5O_VERSION_1
+/// \li \c H5O_VERSION_2
+///\exception H5::FileIException or H5::GroupIException
+/// Exception will be thrown when:
+/// - an error returned by the C API
+/// - version number is not one of the valid values above
+// Programmer Binh-Minh Ribler - April, 2014
+//--------------------------------------------------------------------------
+unsigned CommonFG::childObjVersion(const char* objname) const
+{
+ H5O_info_t objinfo;
+
+ // Use C API to get information of the object
+ herr_t ret_value = H5Oget_info_by_name(getLocId(), objname, &objinfo, H5P_DEFAULT);
+
+ // Throw exception if C API returns failure
+ if (ret_value < 0)
+ throwException("childObjVersion", "H5Oget_info_by_name failed");
+ // Return a valid version or throw an exception for invalid value
+ else
+ {
+ unsigned version = objinfo.hdr.version;
+ if (version != H5O_VERSION_1 && version != H5O_VERSION_2)
+ throwException("childObjVersion", "Invalid version for object");
+ else
+ return(version);
+ }
+}
+
+//--------------------------------------------------------------------------
+// Function: CommonFG::childObjVersion
+///\brief This is an overloaded member function, provided for convenience.
+/// It takes an \a H5std_string for the object's name.
+///\brief Returns the type of an object in this group, given the
+/// object's name.
+///\param objname - IN: Name of the object (H5std_string&)
+///\exception H5::FileIException or H5::GroupIException
+// Programmer Binh-Minh Ribler - April, 2014
+//--------------------------------------------------------------------------
+unsigned CommonFG::childObjVersion(const H5std_string& objname) const
+{
+ // Use overloaded function
+ unsigned version = childObjVersion(objname.c_str());
+ return(version);
+}
+
#ifndef H5_NO_DEPRECATED_SYMBOLS
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------