diff options
Diffstat (limited to 'c++/src/H5Group.cpp')
-rw-r--r-- | c++/src/H5Group.cpp | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 7132bdf..a1f7dcd 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -42,8 +42,8 @@ #include "H5Alltypes.h" namespace H5 { - using std::cerr; - using std::endl; +using std::cerr; +using std::endl; //-------------------------------------------------------------------------- // Function: Group default constructor @@ -58,7 +58,7 @@ Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) {} ///\param original - IN: Original group to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id) +Group::Group(const Group &original) : H5Object(), CommonFG(), id(original.id) { incRefCount(); // increment number of references to this id } @@ -70,11 +70,11 @@ Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id) ///\exception H5::FileIException or H5::GroupIException // Programmer Binh-Minh Ribler - March, 2017 //-------------------------------------------------------------------------- -void Group::closeObjId(hid_t obj_id) const +void +Group::closeObjId(hid_t obj_id) const { herr_t ret_value = H5Oclose(obj_id); - if (ret_value < 0) - { + if (ret_value < 0) { throwException("Group::closeObjId", "H5Oclose failed"); } } @@ -91,9 +91,10 @@ void Group::closeObjId(hid_t obj_id) const // After HDFFV-9920, the Group's methods can use getId() and // getLocId() is kept for backward compatibility. //-------------------------------------------------------------------------- -hid_t Group::getLocId() const +hid_t +Group::getLocId() const { - return(getId()); + return (getId()); } //-------------------------------------------------------------------------- @@ -120,7 +121,8 @@ Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id) /// is a datatype that has been named by DataType::commit. // Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- -Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), CommonFG(), id(H5I_INVALID_HID) +Group::Group(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist) + : H5Object(), CommonFG(), id(H5I_INVALID_HID) { id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference"); } @@ -132,12 +134,13 @@ Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const ///\exception H5::FileIException or H5::GroupIException // Programmer Binh-Minh Ribler - January, 2003 //-------------------------------------------------------------------------- -hsize_t Group::getNumObjs() const +hsize_t +Group::getNumObjs() const { - H5G_info_t ginfo; // Group information + H5G_info_t ginfo; // Group information herr_t ret_value = H5Gget_info(getId(), &ginfo); - if(ret_value < 0) + if (ret_value < 0) throwException("getNumObjs", "H5Gget_info failed"); return (ginfo.nlinks); } @@ -155,14 +158,14 @@ hsize_t Group::getNumObjs() const /// the object's type. // Programmer Binh-Minh Ribler - March, 2017 //-------------------------------------------------------------------------- -hid_t Group::getObjId(const char* obj_name, const PropList& plist) const +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) - { + if (ret_value < 0) { throwException("Group::getObjId", "H5Oopen failed"); } - return(ret_value); + return (ret_value); } //-------------------------------------------------------------------------- @@ -175,9 +178,10 @@ hid_t Group::getObjId(const char* obj_name, const PropList& plist) const ///\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 +hid_t +Group::getObjId(const H5std_string &obj_name, const PropList &plist) const { - return(getObjId(obj_name.c_str(), plist)); + return (getObjId(obj_name.c_str(), plist)); } //-------------------------------------------------------------------------- @@ -192,9 +196,10 @@ hid_t Group::getObjId(const H5std_string& obj_name, const PropList& plist) const // IdComponent::getId now becomes pure virtual function. // Programmer Binh-Minh Ribler - May, 2008 //-------------------------------------------------------------------------- -hid_t Group::getId() const +hid_t +Group::getId() const { - return(id); + return (id); } #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -210,13 +215,14 @@ hid_t Group::getId() const // Then the object's id is reset to the new id. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void Group::p_setId(const hid_t new_id) +void +Group::p_setId(const hid_t new_id) { // handling references to this old id try { close(); } - catch (Exception& close_error) { + catch (Exception &close_error) { throwException("Group::p_setId", close_error.getDetailMsg()); } // reset object's id to the given id @@ -231,13 +237,12 @@ void Group::p_setId(const hid_t new_id) ///\exception H5::GroupIException // Programmer Binh-Minh Ribler - Mar 9, 2005 //-------------------------------------------------------------------------- -void Group::close() +void +Group::close() { - if (p_valid_id(id)) - { + if (p_valid_id(id)) { herr_t ret_value = H5Gclose(id); - if (ret_value < 0) - { + if (ret_value < 0) { throwException("Group::close", "H5Gclose failed"); } // reset the id @@ -258,7 +263,8 @@ void Group::close() // an implementation of Group. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void Group::throwException(const H5std_string& func_name, const H5std_string& msg) const +void +Group::throwException(const H5std_string &func_name, const H5std_string &msg) const { H5std_string full_name = func_name; full_name.insert(0, "Group::"); @@ -280,9 +286,9 @@ Group::~Group() try { close(); } - catch (Exception& close_error) { + catch (Exception &close_error) { cerr << "Group::~Group - " << close_error.getDetailMsg() << endl; } } -} // end namespace +} // namespace H5 |