diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-03-16 23:19:32 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-03-16 23:19:32 (GMT) |
commit | f7711df680f2ccd07f23223deccb217440ec3788 (patch) | |
tree | 4ad4633af3ce182c14aecd4430135298d0a95371 /c++/src/H5Group.cpp | |
parent | 368089572a079f0801ab7177aab2719d4cbd4e48 (diff) | |
parent | 98090fe3b08a0ff85ae9bc93218a14017a6f37fe (diff) | |
download | hdf5-f7711df680f2ccd07f23223deccb217440ec3788.zip hdf5-f7711df680f2ccd07f23223deccb217440ec3788.tar.gz hdf5-f7711df680f2ccd07f23223deccb217440ec3788.tar.bz2 |
Merge pull request #334 in HDFFV/hdf5 from ~BMRIBLER/hdf5_bmr_cpp2:develop to develop
* commit '98090fe3b08a0ff85ae9bc93218a14017a6f37fe':
Purpose: Add new C++ wrappers Description: Added wrappers for H5Iis_valid, H5Ps/get_nlinks, H5Tget_create_plist, H5Oopen, H5Oclose and H5Pset_virtual
Diffstat (limited to 'c++/src/H5Group.cpp')
-rw-r--r-- | c++/src/H5Group.cpp | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 6b143b5..6e5cdaa 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -64,8 +64,56 @@ Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id) } //-------------------------------------------------------------------------- +// Function: Group::getObjId +///\brief Opens an object via object header. +///\exception H5::FileIException or H5::GroupIException +///\par Description +/// This function opens an object in a group or file, using +/// H5Oopen. Thus, an object can be opened without knowing +/// the object's type. +// Programmer Binh-Minh Ribler - March, 2017 +//-------------------------------------------------------------------------- +hid_t Group::getObjId(const char* obj_name, const PropList& plist) const +{ + hid_t ret_value = H5Oopen(getId(), obj_name, plist.getId()); + if (ret_value < 0) + { + throwException("Group::getObjId", "H5Oopen failed"); + } + return(ret_value); +} + +//-------------------------------------------------------------------------- +// Function: Group::getObjId +///\brief This is an overloaded member function, provided for convenience. +/// It takes a reference to a \c H5std_string for the object's name. +///\param obj_name - IN: Path to the object +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - March, 2017 +//-------------------------------------------------------------------------- +hid_t Group::getObjId(const H5std_string& obj_name, const PropList& plist) const +{ + return(getObjId(obj_name.c_str(), plist)); +} + +//-------------------------------------------------------------------------- +// Function: Group::closeObjId +///\brief Closes an object, which was opened with Group::getObjId +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - March, 2017 +//-------------------------------------------------------------------------- +void Group::closeObjId(hid_t obj_id) const +{ + herr_t ret_value = H5Oclose(obj_id); + if (ret_value < 0) + { + throwException("Group::closeObjId", "H5Oclose failed"); + } +} + +//-------------------------------------------------------------------------- // Function: Group::getLocId -// Purpose: Get the id of this group +// Purpose: Get the id of this group // Programmer Binh-Minh Ribler - 2000 // Description // This function is a redefinition of CommonFG::getLocId. It |