diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2018-07-21 05:40:57 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2018-07-21 05:40:57 (GMT) |
commit | 4f37cdcd36adb1bafcdf9af49b611180a64d157b (patch) | |
tree | 9111eecc09e15c8b70dd830ce23797d0e5bf0abf | |
parent | dd0a040ec807912b80a9f1779fbf46c65d01cd57 (diff) | |
download | hdf5-4f37cdcd36adb1bafcdf9af49b611180a64d157b.zip hdf5-4f37cdcd36adb1bafcdf9af49b611180a64d157b.tar.gz hdf5-4f37cdcd36adb1bafcdf9af49b611180a64d157b.tar.bz2 |
Code improvement
Description:
Moved the new H5Object::getInfo member functions to H5Location and
made them overloaded with the existing H5Location::getObjinfo. This
way is cleaner than the previous approach.
Platforms tested:
Linux/64 (jelly)
Linux/32 (jam)
Darwin (osx1010test)
-rw-r--r-- | c++/src/H5Location.cpp | 143 | ||||
-rw-r--r-- | c++/src/H5Location.h | 23 | ||||
-rw-r--r-- | c++/src/H5Object.cpp | 124 | ||||
-rw-r--r-- | c++/src/H5Object.h | 20 | ||||
-rw-r--r-- | c++/test/dsets.cpp | 12 | ||||
-rw-r--r-- | c++/test/tattr.cpp | 12 | ||||
-rw-r--r-- | c++/test/tfile.cpp | 8 | ||||
-rw-r--r-- | c++/test/tobject.cpp | 18 | ||||
-rw-r--r-- | c++/test/trefer.cpp | 10 | ||||
-rw-r--r-- | c++/test/ttypes.cpp | 9 |
10 files changed, 176 insertions, 203 deletions
diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 8df7467..dd82a54 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -1356,58 +1356,154 @@ void H5Location::move(const H5std_string& src, const H5std_string& dst) const moveLink(src.c_str(), dst.c_str(), LinkCreatPropList::DEFAULT, LinkAccPropList::DEFAULT); } -#if 0 //-------------------------------------------------------------------------- -// Function: H5Location::deleteLink +// Function: H5Location::unlink ///\brief Removes the specified link from this group. ///\param name - IN: Name of the object to be removed ///\exception H5::FileIException/H5::GroupIException/H5::LocationException // March, 2018 //-------------------------------------------------------------------------- -void H5Location::deleteLink(const char* name, const LinkAccPropList& lapl) const +void H5Location::unlink(const char* name, const LinkAccPropList& lapl) const { - herr_t ret_value = H5Ldelete(getId(), name, H5P_DEFAULT); + herr_t ret_value = H5Ldelete(getId(), name, lapl.getId()); if (ret_value < 0) - throwException("deleteLink", "H5Ldelete failed"); + throwException("unlink", "H5Ldelete failed"); } //-------------------------------------------------------------------------- -// Function: H5Location::deleteLink +// Function: H5Location::unlink ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. // March, 2018 //-------------------------------------------------------------------------- -void H5Location::deleteLink(const H5std_string& name, const LinkAccPropList& lapl) const +void H5Location::unlink(const H5std_string& name, const LinkAccPropList& lapl) const { - deleteLink(name.c_str()); + unlink(name.c_str(), lapl); } -#endif //-------------------------------------------------------------------------- -// Function: H5Location::unlink -///\brief Removes the specified link from this group. -///\param name - IN: Name of the object to be removed -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// March, 2018 +// Function: H5Location::getObjinfo +///\brief Retrieves information about an HDF5 object. +///\param objinfo - OUT: Struct containing the object info +///\param fields - IN: Indicates the group of information to be retrieved +///\par Description +/// Valid values of \a fields are as follows: +/// \li \c H5O_INFO_BASIC (default) +/// \li \c H5O_INFO_TIME +/// \li \c H5O_INFO_NUM_ATTRS +/// \li \c H5O_INFO_HDR +/// \li \c H5O_INFO_META_SIZE +/// \li \c H5O_INFO_ALL +// July, 2018 //-------------------------------------------------------------------------- -void H5Location::unlink(const char* name, const LinkAccPropList& lapl) const +void H5Location::getObjinfo(H5O_info_t& objinfo, unsigned fields) const { - herr_t ret_value = H5Ldelete(getId(), name, lapl.getId()); + + // 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("unlink", "H5Ldelete failed"); + throwException(inMemFunc("getObjinfo"), "H5Oget_info2 failed"); } //-------------------------------------------------------------------------- -// Function: H5Location::unlink +// Function: H5Location::getObjinfo +///\brief Retrieves information about an HDF5 object given its name. +///\param name - IN: Name of the object to be queried - \c char * +///\param objinfo - OUT: Struct containing the object info +///\param fields - IN: Indicates the group of information to be retrieved +/// - default to H5O_INFO_BASIC +///\param lapl - IN: Link access property list +///\par Description +/// Valid values of \a fields are as follows: +/// \li \c H5O_INFO_BASIC (default) +/// \li \c H5O_INFO_TIME +/// \li \c H5O_INFO_NUM_ATTRS +/// \li \c H5O_INFO_HDR +/// \li \c H5O_INFO_META_SIZE +/// \li \c H5O_INFO_ALL +// July, 2018 +//-------------------------------------------------------------------------- +void H5Location::getObjinfo(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: H5Location::getObjinfo ///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// March, 2018 +/// It differs from the above function in that it takes +/// a reference to an \c H5std_string for \a name. +///\param name - IN: Name of the object to be queried - \c H5std_string +///\param objinfo - OUT: Struct containing the object info +///\param fields - IN: Indicates the group of information to be retrieved +/// - default to H5O_INFO_BASIC +///\param lapl - IN: Link access property list +// July, 2018 //-------------------------------------------------------------------------- -void H5Location::unlink(const H5std_string& name, const LinkAccPropList& lapl) const +void H5Location::getObjinfo(const H5std_string& name, H5O_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const { - unlink(name.c_str(), lapl); + getObjinfo(name.c_str(), objinfo, fields, lapl); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getObjinfo +///\brief Retrieves information about an HDF5 object given its index. +///\param grp_name - IN: Group name where the object belongs - \c char * +///\param idx_type - IN: Type of index +///\param order - IN: Order to traverse +///\param idx - IN: Object position +///\param objinfo - OUT: Struct containing the object info +///\param fields - IN: Indicates the group of information to be retrieved +/// - default to H5O_INFO_BASIC +///\param lapl - IN: Link access property list +///\par Description +/// Valid values of \a fields are as follows: +/// \li \c H5O_INFO_BASIC (default) +/// \li \c H5O_INFO_TIME +/// \li \c H5O_INFO_NUM_ATTRS +/// \li \c H5O_INFO_HDR +/// \li \c H5O_INFO_META_SIZE +/// \li \c H5O_INFO_ALL +// July, 2018 +//-------------------------------------------------------------------------- +void H5Location::getObjinfo(const char* grp_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t idx, 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_idx2(getId(), grp_name, idx_type, order, + idx, &objinfo, fields, lapl.getId()); + + // Throw exception if C API returns failure + if (ret_value < 0) + throwException(inMemFunc("getObjinfo"), "H5Oget_info_by_idx2 failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getObjinfo +///\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. +///\param name - IN: Name of the object to be queried - \c H5std_string +///\param objinfo - OUT: Struct containing the object info +///\param fields - IN: Indicates a group of information to be retrieved +/// - default to H5O_INFO_BASIC +///\param lapl - IN: Link access property list +// July, 2018 +//-------------------------------------------------------------------------- +void H5Location::getObjinfo(const H5std_string& grp_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo, unsigned fields, + const LinkAccPropList& lapl) const +{ + getObjinfo(grp_name.c_str(), idx_type, order, idx, objinfo, fields, lapl); } #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -1467,6 +1563,7 @@ void H5Location::getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const { getObjinfo(name.c_str(), statbuf); } + #endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index 19c49ea..0b41493 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -141,6 +141,27 @@ class H5_DLLCPP H5Location : public IdComponent { unsigned childObjVersion(const char* objname) const; unsigned childObjVersion(const H5std_string& objname) const; + // Retrieves information about an HDF5 object. + void getObjinfo(H5O_info_t& objinfo, unsigned fields = H5O_INFO_BASIC) const; + + // Retrieves information about an HDF5 object, given its name. + void getObjinfo(const char* name, H5O_info_t& objinfo, + unsigned fields = H5O_INFO_BASIC, + const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + void getObjinfo(const H5std_string& name, H5O_info_t& objinfo, + unsigned fields = H5O_INFO_BASIC, + const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + + // Retrieves information about an HDF5 object, given its index. + void getObjinfo(const char* grp_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo, + unsigned fields = H5O_INFO_BASIC, + const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + void getObjinfo(const H5std_string& grp_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo, + unsigned fields = H5O_INFO_BASIC, + const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + #ifndef H5_NO_DEPRECATED_SYMBOLS // Returns the type of an object in this group, given the // object's index. @@ -149,7 +170,7 @@ class H5_DLLCPP H5Location : public IdComponent { H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const; // Returns information about an HDF5 object, given by its name, - // at this location. + // at this location. - Deprecated dues to performance issues void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const; void getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const; void getObjinfo(const char* name, H5G_stat_t& statbuf) const; diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index a33acb3..b95e222 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -227,130 +227,6 @@ int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_dat } //-------------------------------------------------------------------------- -// Function: H5Object::getInfo -///\brief Retrieves information about an HDF5 object. -///\param objinfo - OUT: Struct containing the object info -///\param fields - IN: Indicates the group of information to be retrieved -///\par Description -/// Valid values of \a fields are as follows: -/// \li \c H5O_INFO_BASIC (default) -/// \li \c H5O_INFO_TIME -/// \li \c H5O_INFO_NUM_ATTRS -/// \li \c H5O_INFO_HDR -/// \li \c H5O_INFO_META_SIZE -/// \li \c H5O_INFO_ALL -// 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("getInfo"), "H5Oget_info2 failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::getInfo -///\brief Retrieves information about an HDF5 object given its name. -///\param name - IN: Name of the object to be queried - \c char * -///\param objinfo - OUT: Struct containing the object info -///\param fields - IN: Indicates the group of information to be retrieved -/// - default to H5O_INFO_BASIC -///\param lapl - IN: Link access property list -///\par Description -/// Valid values of \a fields are as follows: -/// \li \c H5O_INFO_BASIC (default) -/// \li \c H5O_INFO_TIME -/// \li \c H5O_INFO_NUM_ATTRS -/// \li \c H5O_INFO_HDR -/// \li \c H5O_INFO_META_SIZE -/// \li \c H5O_INFO_ALL -// 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("getInfo"), "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. -///\param name - IN: Name of the object to be queried - \c H5std_string -///\param objinfo - OUT: Struct containing the object info -///\param fields - IN: Indicates the group of information to be retrieved -/// - default to H5O_INFO_BASIC -///\param lapl - IN: Link access property list -// July, 2018 -//-------------------------------------------------------------------------- -void H5Object::getInfo(const H5std_string& name, H5O_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const -{ - getInfo(name.c_str(), objinfo, fields, lapl); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::getInfo -///\brief Retrieves information about an HDF5 object given its index. -///\param grp_name - IN: Group name where the object belongs - \c char * -///\param idx_type - IN: Type of index -///\param order - IN: Order to traverse -///\param idx - IN: Object position -///\param objinfo - OUT: Struct containing the object info -///\param fields - IN: Indicates the group of information to be retrieved -/// - default to H5O_INFO_BASIC -///\param lapl - IN: Link access property list -///\par Description -/// Valid values of \a fields are as follows: -/// \li \c H5O_INFO_BASIC (default) -/// \li \c H5O_INFO_TIME -/// \li \c H5O_INFO_NUM_ATTRS -/// \li \c H5O_INFO_HDR -/// \li \c H5O_INFO_META_SIZE -/// \li \c H5O_INFO_ALL -// July, 2018 -//-------------------------------------------------------------------------- -void H5Object::getInfo(const char* grp_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, 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_idx2(getId(), grp_name, idx_type, order, - idx, &objinfo, fields, lapl.getId()); - - // Throw exception if C API returns failure - if (ret_value < 0) - throwException(inMemFunc("getInfo"), "H5Oget_info_by_idx2 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. -///\param name - IN: Name of the object to be queried - \c H5std_string -///\param objinfo - OUT: Struct containing the object info -///\param fields - IN: Indicates a group of information to be retrieved -/// - default to H5O_INFO_BASIC -///\param lapl - IN: Link access property list -// July, 2018 -//-------------------------------------------------------------------------- -void H5Object::getInfo(const H5std_string& grp_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo, unsigned fields, - const LinkAccPropList& lapl) const -{ - getInfo(grp_name.c_str(), idx_type, order, idx, objinfo, fields, lapl); -} - -//-------------------------------------------------------------------------- // 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 268fe58..10b3865 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -92,26 +92,6 @@ 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; - // 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) const; - void getInfo(const H5std_string& name, H5O_info_t& objinfo, - unsigned fields = H5O_INFO_BASIC, - const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; - - // Retrieves information about an HDF5 object, given its index. - void getInfo(const char* grp_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, H5O_info_t& objinfo, - unsigned fields = H5O_INFO_BASIC, - const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; - void getInfo(const H5std_string& grp_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, 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; diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index e86052b..a3a055d 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1116,9 +1116,9 @@ static herr_t test_types(H5File& file) /*------------------------------------------------------------------------- - * Function: test_getinfo + * Function: test_getObjinfo * - * Purpose Tests getInfo() + * Purpose Tests getObjinfo() * * Return Success: 0 * @@ -1145,16 +1145,16 @@ static herr_t test_getinfo(H5File& file) // Get dataset header info H5O_info_t oinfo; HDmemset(&oinfo, 0, sizeof(oinfo)); - dataset.getInfo(oinfo, H5O_INFO_HDR); - verify_val(oinfo.hdr.nchunks, 1, "DataSet::getInfo", __LINE__, __FILE__); + dataset.getObjinfo(oinfo, H5O_INFO_HDR); + verify_val(oinfo.hdr.nchunks, 1, "DataSet::getObjinfo", __LINE__, __FILE__); dataset.close(); // Open the dataset we created above and then close it. This is one // way to open an existing dataset for accessing. dataset = file.openDataSet(DSET_DEFAULT_NAME); HDmemset(&oinfo, 0, sizeof(oinfo)); - dataset.getInfo(oinfo, H5O_INFO_ALL); - verify_val(oinfo.hdr.nchunks, 1, "DataSet::getInfo", __LINE__, __FILE__); + dataset.getObjinfo(oinfo, H5O_INFO_ALL); + verify_val(oinfo.hdr.nchunks, 1, "DataSet::getObjinfo", __LINE__, __FILE__); dataset.close(); PASSED(); diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 94c811a..bdf6d80 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -521,8 +521,8 @@ static void test_attr_basic_read() // Verify the correct number of attributes another way H5O_info_t oinfo; HDmemset(&oinfo, 0, sizeof(oinfo)); - dataset.getInfo(oinfo, H5O_INFO_NUM_ATTRS); - verify_val(oinfo.num_attrs, 3, "DataSet::getInfo", __LINE__, __FILE__); + dataset.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS); + verify_val(oinfo.num_attrs, 3, "DataSet::getObjinfo", __LINE__, __FILE__); // Open an attribute for the dataset Attribute ds_attr=dataset.openAttribute(ATTR1_NAME); @@ -548,8 +548,8 @@ static void test_attr_basic_read() // Verify the correct number of attributes another way HDmemset(&oinfo, 0, sizeof(oinfo)); - group.getInfo(oinfo, H5O_INFO_NUM_ATTRS); - verify_val(oinfo.num_attrs, 1, "Group::getInfo", __LINE__, __FILE__); + group.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS); + verify_val(oinfo.num_attrs, 1, "Group::getObjinfo", __LINE__, __FILE__); // Open an attribute for the group Attribute gr_attr = group.openAttribute(ATTR2_NAME); @@ -672,8 +672,8 @@ static void test_attr_compound_read() // Verify the correct number of attributes another way H5O_info_t oinfo; HDmemset(&oinfo, 0, sizeof(oinfo)); - dataset.getInfo(oinfo, H5O_INFO_NUM_ATTRS); - verify_val(oinfo.num_attrs, 1, "DataSet::getInfo", __LINE__, __FILE__); + dataset.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS); + verify_val(oinfo.num_attrs, 1, "DataSet::getObjinfo", __LINE__, __FILE__); // Open 1st attribute for the dataset Attribute attr = dataset.openAttribute((unsigned)0); diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index dd32364..a2bf1c2 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -660,8 +660,8 @@ static void test_libver_bounds_real( // Verify object header version another way H5O_info_t oinfo; HDmemset(&oinfo, 0, sizeof(oinfo)); - file.getInfo(oinfo, H5O_INFO_HDR); - verify_val(oinfo.hdr.version, oh_vers_create, "H5File::getInfo", __LINE__, __FILE__); + file.getObjinfo(oinfo, H5O_INFO_HDR); + verify_val(oinfo.hdr.version, oh_vers_create, "H5File::getObjinfo", __LINE__, __FILE__); /* * Reopen the file and make sure the root group still has the correct @@ -687,8 +687,8 @@ static void test_libver_bounds_real( // Verify object header version another way HDmemset(&oinfo, 0, sizeof(oinfo)); - group.getInfo(oinfo, H5O_INFO_HDR); - verify_val(oinfo.hdr.version, oh_vers_mod, "Group::getInfo", __LINE__, __FILE__); + group.getObjinfo(oinfo, H5O_INFO_HDR); + verify_val(oinfo.hdr.version, oh_vers_mod, "Group::getObjinfo", __LINE__, __FILE__); group.close(); // close "/G1" diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index bfc13a0..537716f 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -545,7 +545,7 @@ static void test_getobjectinfo_same_file() H5O_info_t oinfo1, oinfo2; /* Object info structs */ // Output message about test being performed - SUBTEST("Group::getInfo"); + SUBTEST("Group::getObjinfo"); try { // Create a new HDF5 file @@ -561,9 +561,9 @@ static void test_getobjectinfo_same_file() // Query the info of two groups and verify that they have the same // file number - grp1.getInfo(oinfo1); - grp2.getInfo(oinfo2); - verify_val(oinfo1.fileno, oinfo2.fileno, "file number from getInfo", __LINE__, __FILE__); + grp1.getObjinfo(oinfo1); + grp2.getObjinfo(oinfo2); + verify_val(oinfo1.fileno, oinfo2.fileno, "file number from getObjinfo", __LINE__, __FILE__); // Close groups and file grp1.close(); @@ -584,17 +584,17 @@ static void test_getobjectinfo_same_file() // Query the info of two groups and verify that they have the same // file number - grp1.getInfo(oinfo1); - grp2.getInfo(oinfo2); - verify_val(oinfo1.fileno, oinfo2.fileno, "file number from getInfo", __LINE__, __FILE__); + grp1.getObjinfo(oinfo1); + grp2.getObjinfo(oinfo2); + verify_val(oinfo1.fileno, oinfo2.fileno, "file number from getObjinfo", __LINE__, __FILE__); // Reset object info HDmemset(&oinfo1, 0, sizeof(oinfo1)); HDmemset(&oinfo2, 0, sizeof(oinfo2)); - file1.getInfo(GROUP1NAME, oinfo1); - file1.getInfo(GROUP2NAME, oinfo2); + file1.getObjinfo(GROUP1NAME, oinfo1); + file1.getObjinfo(GROUP2NAME, oinfo2); verify_val(oinfo1.fileno, oinfo2.fileno, "file number from getObjectInfo", __LINE__, __FILE__); // Close groups and files diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index fa214df..562b127 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -481,19 +481,19 @@ static void test_reference_group() fname = group.getFileName(); verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__); - // Check object type using Group::getInfo() + // Check object type using Group::getObjinfo() H5O_info_t oinfo; HDmemset(&oinfo, 0, sizeof(oinfo)); - group.getInfo(".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, oinfo); - verify_val(oinfo.type, H5O_TYPE_DATASET, "Group::getInfo",__LINE__,__FILE__); + group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, oinfo); + verify_val(oinfo.type, H5O_TYPE_DATASET, "Group::getObjinfo",__LINE__,__FILE__); // Check for out of bound query by index try { HDmemset(&oinfo, 0, sizeof(oinfo)); - group.getInfo(".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)9, oinfo); + group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)9, oinfo); // Should FAIL but didn't, so throw an invalid action exception - throw InvalidActionException("Group::getInfo", "Out of bound index."); + throw InvalidActionException("Group::getObjinfo", "Out of bound index."); } catch (Exception& err) {} // do nothing, failure expected // Unlink one of the objects in the dereferenced group, and re-check diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 6d585bd..0de66d7 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -1097,13 +1097,12 @@ static void test_operators() verify_val(flttyp == member_inttyp, false, "DataType::operator==", __LINE__, __FILE__); verify_val(flttyp != member_inttyp, true, "DataType::operator==", __LINE__, __FILE__); - // Get the NATIVE_LONG member from the compound datatype above - IntType member_longtyp = cmptyp.getMemberIntType(2); + // Get the NATIVE_FLOAT member from the compound datatype above + IntType member_flttyp = cmptyp.getMemberIntType(1); // Test various combinations - verify_val(inttyp == member_longtyp, false, "DataType::operator==", __LINE__, __FILE__); - verify_val(flttyp == member_longtyp, false, "DataType::operator==", __LINE__, __FILE__); - verify_val(flttyp != member_longtyp, true, "DataType::operator==", __LINE__, __FILE__); + verify_val(inttyp == member_flttyp, false, "DataType::operator==", __LINE__, __FILE__); + verify_val(flttyp != member_flttyp, false, "DataType::operator==", __LINE__, __FILE__); PASSED(); } |