diff options
Diffstat (limited to 'c++/src/H5Group.cpp')
-rw-r--r-- | c++/src/H5Group.cpp | 124 |
1 files changed, 52 insertions, 72 deletions
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 97bedee..25e67d3 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -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" @@ -52,7 +53,7 @@ Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) {} //-------------------------------------------------------------------------- // Function: Group copy constructor -///\brief Copy constructor: makes a copy of the original Group object. +///\brief Copy constructor: same HDF5 object as \a original ///\param original - IN: Original group to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- @@ -62,47 +63,8 @@ Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id) } //-------------------------------------------------------------------------- -// Function: Group::getObjId -///\brief Opens an object via object header. -///\param obj_name - IN: Path to the object -///\param plist - IN: Access property list for the link pointing to -/// the object -///\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 -///\param plist - IN: Access property list for the link pointing 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 //-------------------------------------------------------------------------- @@ -116,23 +78,6 @@ void Group::closeObjId(hid_t obj_id) const } //-------------------------------------------------------------------------- -// Function: Group::getNumObjs -///\brief Returns the number of objects in this group. -///\return Number of objects -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - January, 2003 -//-------------------------------------------------------------------------- -hsize_t Group::getNumObjs() const -{ - H5G_info_t ginfo; // Group information - - herr_t ret_value = H5Gget_info(getId(), &ginfo); - if(ret_value < 0) - throwException("getNumObjs", "H5Gget_info failed"); - return (ginfo.nlinks); -} - -//-------------------------------------------------------------------------- // Function: Group::getLocId // Purpose: Get the id of this group // Programmer Binh-Minh Ribler - 2000 @@ -179,24 +124,59 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const } //-------------------------------------------------------------------------- -// Function: Group overload constructor - dereference -// brief Given a reference, ref, to an hdf5 group, creates a Group objec -// param attr - IN: Specifying location where the referenced object is i -// param ref - IN: Reference pointer -// param ref_type - IN: Reference type - default to H5R_OBJECT -// param plist - IN: Property list - default to PropList::DEFAULT -// exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// Mar, 2017 -// Removed in 1.10.1 because H5Location is Attribute's baseclass -// now. -BMR +// Function: Group::getNumObjs +///\brief Returns the number of objects in this group. +///\return Number of objects +///\exception H5::FileIException or H5::GroupIException +// Programmer Binh-Minh Ribler - January, 2003 +//-------------------------------------------------------------------------- +hsize_t Group::getNumObjs() const +{ + H5G_info_t ginfo; // Group information + + herr_t ret_value = H5Gget_info(getId(), &ginfo); + if(ret_value < 0) + throwException("getNumObjs", "H5Gget_info failed"); + return (ginfo.nlinks); +} + +//-------------------------------------------------------------------------- +// Function: Group::getObjId +///\brief Opens an object via object header. +///\param obj_name - IN: Path to the object +///\param plist - IN: Access property list for the link pointing to +/// the object +///\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 //-------------------------------------------------------------------------- -/* Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID) +hid_t Group::getObjId(const char* obj_name, const PropList& plist) const { - id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference"); + 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 +///\param plist - IN: Access property list for the link pointing 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::getId |