diff options
Diffstat (limited to 'c++')
-rw-r--r-- | c++/examples/h5group.cpp | 8 | ||||
-rw-r--r-- | c++/src/C2Cppfunction_map.htm | 4 | ||||
-rw-r--r-- | c++/src/H5Location.cpp | 157 | ||||
-rw-r--r-- | c++/src/H5Location.h | 35 | ||||
-rw-r--r-- | c++/src/H5Object.cpp | 28 | ||||
-rw-r--r-- | c++/src/H5Object.h | 4 | ||||
-rw-r--r-- | c++/test/dsets.cpp | 26 | ||||
-rw-r--r-- | c++/test/tattr.cpp | 4 | ||||
-rw-r--r-- | c++/test/tfile.cpp | 14 | ||||
-rw-r--r-- | c++/test/titerate.cpp | 12 | ||||
-rw-r--r-- | c++/test/tlinks.cpp | 4 | ||||
-rw-r--r-- | c++/test/tobject.cpp | 2 | ||||
-rw-r--r-- | c++/test/trefer.cpp | 2 |
13 files changed, 217 insertions, 83 deletions
diff --git a/c++/examples/h5group.cpp b/c++/examples/h5group.cpp index fab54cd..271c538 100644 --- a/c++/examples/h5group.cpp +++ b/c++/examples/h5group.cpp @@ -36,7 +36,7 @@ const H5std_string FILE_NAME( "Group.h5" ); const int RANK = 2; // Operator function -extern "C" herr_t file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, +extern "C" herr_t file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata); int main(void) @@ -157,7 +157,7 @@ int main(void) * root directory. */ cout << endl << "Iterating over elements in the file" << endl; - herr_t idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); + herr_t idx = H5Literate2(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); cout << endl; /* @@ -175,7 +175,7 @@ int main(void) cout << "\"Data\" is unlinked" << endl; cout << endl << "Iterating over elements in the file again" << endl; - idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); + idx = H5Literate2(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); cout << endl; /* @@ -219,7 +219,7 @@ int main(void) * Operator function. */ herr_t -file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata) +file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata) { hid_t group; diff --git a/c++/src/C2Cppfunction_map.htm b/c++/src/C2Cppfunction_map.htm index 2d779a3..a9e0a27 100644 --- a/c++/src/C2Cppfunction_map.htm +++ b/c++/src/C2Cppfunction_map.htm @@ -11493,7 +11493,7 @@ normal'><span style='font-size:14.0pt;mso-bidi-font-size:11.0pt;line-height: mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt; mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'> <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: - normal'>H5L_info_t getLinkInfo(const char* link_name,</p> + normal'>H5L_info2_t getLinkInfo(const char* link_name,</p> <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal'><span style='mso-tab-count:1'> </span>const LinkAccPropList& lapl = LinkAccPropList::DEFAULT)</p> @@ -11526,7 +11526,7 @@ normal'><span style='font-size:14.0pt;mso-bidi-font-size:11.0pt;line-height: mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt; mso-border-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt'> <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: - normal'>H5L_info_t getLinkInfo(const H5std_string& link_name,</p> + normal'>H5L_info2_t getLinkInfo(const H5std_string& link_name,</p> <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height: normal'><span style='mso-tab-count:1'> </span>const LinkAccPropList& lapl = LinkAccPropList::DEFAULT)</p> diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 2641960..764aa12 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -1404,6 +1404,121 @@ void H5Location::unlink(const H5std_string& name, const LinkAccPropList& lapl) c } //-------------------------------------------------------------------------- +// Function: H5Location::getNativeObjinfo +///\brief Retrieves native information about an HDF5 object. +///\param objinfo - OUT: Struct containing the native 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_HDR (default) +/// \li \c H5O_INFO_META_SIZE +/// \li \c H5O_INFO_ALL +// July, 2018 +//-------------------------------------------------------------------------- +void H5Location::getNativeObjinfo(H5O_native_info_t& objinfo, unsigned fields) const +{ + + // Use C API to get information of the object + herr_t ret_value = H5Oget_native_info(getId(), &objinfo, fields); + + // Throw exception if C API returns failure + if (ret_value < 0) + throwException(inMemFunc("getNativeObjinfo"), "H5Oget_native_info failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getNativeObjinfo +///\brief Retrieves native 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 native object info +///\param fields - IN: Indicates the group of information to be retrieved +/// - default to H5O_INFO_HDR +///\param lapl - IN: Link access property list +///\par Description +/// Valid values of \a fields are as follows: +/// \li \c H5O_INFO_HDR (default) +/// \li \c H5O_INFO_META_SIZE +/// \li \c H5O_INFO_ALL +// July, 2018 +//-------------------------------------------------------------------------- +void H5Location::getNativeObjinfo(const char* name, H5O_native_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const +{ + // Use C API to get information of the object + herr_t ret_value = H5Oget_native_info_by_name(getId(), name, &objinfo, fields, lapl.getId()); + + // Throw exception if C API returns failure + if (ret_value < 0) + throwException(inMemFunc("getNativeObjinfo"), "H5Oget_native_info_by_name failed"); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getNativeObjinfo +///\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 native object info +///\param fields - IN: Indicates the group of information to be retrieved +/// - default to H5O_INFO_HDR +///\param lapl - IN: Link access property list +// July, 2018 +//-------------------------------------------------------------------------- +void H5Location::getNativeObjinfo(const H5std_string& name, H5O_native_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const +{ + getNativeObjinfo(name.c_str(), objinfo, fields, lapl); +} + +//-------------------------------------------------------------------------- +// Function: H5Location::getNativeObjinfo +///\brief Retrieves native 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 native object info +///\param fields - IN: Indicates the group of information to be retrieved +/// - default to H5O_INFO_HDR +///\param lapl - IN: Link access property list +///\par Description +/// Valid values of \a fields are as follows: +/// \li \c H5O_INFO_HDR (default) +/// \li \c H5O_INFO_META_SIZE +/// \li \c H5O_INFO_ALL +// July, 2018 +//-------------------------------------------------------------------------- +void H5Location::getNativeObjinfo(const char* grp_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo, unsigned fields, + const LinkAccPropList& lapl) const +{ + // Use C API to get information of the object + herr_t ret_value = H5Oget_native_info_by_idx(getId(), grp_name, idx_type, order, + idx, &objinfo, fields, lapl.getId()); + + // Throw exception if C API returns failure + if (ret_value < 0) + throwException(inMemFunc("getNativeObjinfo"), "H5Oget_native_info_by_idx 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 native object info +///\param fields - IN: Indicates a group of information to be retrieved +/// - default to H5O_INFO_HDR +///\param lapl - IN: Link access property list +// July, 2018 +//-------------------------------------------------------------------------- +void H5Location::getNativeObjinfo(const H5std_string& grp_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo, unsigned fields, + const LinkAccPropList& lapl) const +{ + getNativeObjinfo(grp_name.c_str(), idx_type, order, idx, objinfo, fields, lapl); +} + +//-------------------------------------------------------------------------- // Function: H5Location::getObjinfo ///\brief Retrieves information about an HDF5 object. ///\param objinfo - OUT: Struct containing the object info @@ -1418,15 +1533,15 @@ void H5Location::unlink(const H5std_string& name, const LinkAccPropList& lapl) c /// \li \c H5O_INFO_ALL // July, 2018 //-------------------------------------------------------------------------- -void H5Location::getObjinfo(H5O_info_t& objinfo, unsigned fields) const +void H5Location::getObjinfo(H5O_info2_t& objinfo, unsigned fields) const { // Use C API to get information of the object - herr_t ret_value = H5Oget_info2(getId(), &objinfo, fields); + herr_t ret_value = H5Oget_info3(getId(), &objinfo, fields); // Throw exception if C API returns failure if (ret_value < 0) - throwException(inMemFunc("getObjinfo"), "H5Oget_info2 failed"); + throwException(inMemFunc("getObjinfo"), "H5Oget_info3 failed"); } //-------------------------------------------------------------------------- @@ -1447,10 +1562,10 @@ void H5Location::getObjinfo(H5O_info_t& objinfo, unsigned fields) const /// \li \c H5O_INFO_ALL // July, 2018 //-------------------------------------------------------------------------- -void H5Location::getObjinfo(const char* name, H5O_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const +void H5Location::getObjinfo(const char* name, H5O_info2_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()); + herr_t ret_value = H5Oget_info_by_name3(getId(), name, &objinfo, fields, lapl.getId()); // Throw exception if C API returns failure if (ret_value < 0) @@ -1469,7 +1584,7 @@ void H5Location::getObjinfo(const char* name, H5O_info_t& objinfo, unsigned fiel ///\param lapl - IN: Link access property list // July, 2018 //-------------------------------------------------------------------------- -void H5Location::getObjinfo(const H5std_string& name, H5O_info_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const +void H5Location::getObjinfo(const H5std_string& name, H5O_info2_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const { getObjinfo(name.c_str(), objinfo, fields, lapl); } @@ -1496,11 +1611,11 @@ void H5Location::getObjinfo(const H5std_string& name, H5O_info_t& objinfo, unsig // 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, + H5_iter_order_t order, hsize_t idx, H5O_info2_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, + herr_t ret_value = H5Oget_info_by_idx3(getId(), grp_name, idx_type, order, idx, &objinfo, fields, lapl.getId()); // Throw exception if C API returns failure @@ -1521,7 +1636,7 @@ void H5Location::getObjinfo(const char* grp_name, H5_index_t idx_type, // 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, + H5_iter_order_t order, hsize_t idx, H5O_info2_t& objinfo, unsigned fields, const LinkAccPropList& lapl) const { getObjinfo(grp_name.c_str(), idx_type, order, idx, objinfo, fields, lapl); @@ -1596,11 +1711,11 @@ void H5Location::getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const ///\exception H5::FileIException/H5::GroupIException/H5::LocationException // 2000 //-------------------------------------------------------------------------- -H5L_info_t H5Location::getLinkInfo(const char* link_name, const LinkAccPropList& lapl) const +H5L_info2_t H5Location::getLinkInfo(const char* link_name, const LinkAccPropList& lapl) const { - H5L_info_t linkinfo; // link info structure + H5L_info2_t linkinfo; // link info structure - herr_t ret_value = H5Lget_info(getId(), link_name, &linkinfo, lapl.getId()); + herr_t ret_value = H5Lget_info2(getId(), link_name, &linkinfo, lapl.getId()); if (ret_value < 0) throwException("getLinkInfo", "H5Lget_info to find buffer size failed"); @@ -1613,7 +1728,7 @@ H5L_info_t H5Location::getLinkInfo(const char* link_name, const LinkAccPropList& /// It differs from the above function in that it takes an /// \c H5std_string for \a link_name. //-------------------------------------------------------------------------- -H5L_info_t H5Location::getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl) const +H5L_info2_t H5Location::getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl) const { return(getLinkInfo(link_name.c_str(), lapl)); } @@ -1629,7 +1744,7 @@ H5L_info_t H5Location::getLinkInfo(const H5std_string& link_name, const LinkAccP //-------------------------------------------------------------------------- H5std_string H5Location::getLinkval(const char* name, size_t size) const { - H5L_info_t linkinfo; + H5L_info2_t linkinfo; char *value_C; // value in C string size_t val_size = size; H5std_string value = ""; @@ -1638,7 +1753,7 @@ H5std_string H5Location::getLinkval(const char* name, size_t size) const // if user doesn't provide buffer size, determine it if (size == 0) { - ret_value = H5Lget_info(getId(), name, &linkinfo, H5P_DEFAULT); + ret_value = H5Lget_info2(getId(), name, &linkinfo, H5P_DEFAULT); if (ret_value < 0) throwException("getLinkval", "H5Lget_info to find buffer size failed"); @@ -1941,11 +2056,11 @@ ssize_t H5Location::getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size //-------------------------------------------------------------------------- H5O_type_t H5Location::childObjType(const char* objname) const { - H5O_info_t objinfo; + H5O_info2_t objinfo; H5O_type_t objtype = H5O_TYPE_UNKNOWN; // Use C API to get information of the object - herr_t ret_value = H5Oget_info_by_name2(getId(), objname, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT); + herr_t ret_value = H5Oget_info_by_name3(getId(), objname, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT); // Throw exception if C API returns failure if (ret_value < 0) @@ -2016,11 +2131,11 @@ H5O_type_t H5Location::childObjType(const H5std_string& objname) const H5O_type_t H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_iter_order_t order, const char* objname) const { herr_t ret_value; - H5O_info_t objinfo; + H5O_info2_t objinfo; H5O_type_t objtype = H5O_TYPE_UNKNOWN; // Use C API to get information of the object - ret_value = H5Oget_info_by_idx2(getId(), objname, index_type, order, index, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT); + ret_value = H5Oget_info_by_idx3(getId(), objname, index_type, order, index, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT); // Throw exception if C API returns failure if (ret_value < 0) @@ -2058,11 +2173,11 @@ H5O_type_t H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_ite //-------------------------------------------------------------------------- unsigned H5Location::childObjVersion(const char* objname) const { - H5O_info_t objinfo; + H5O_native_info_t objinfo; unsigned version = 0; // Use C API to get information of the object - herr_t ret_value = H5Oget_info_by_name2(getId(), objname, &objinfo, H5O_INFO_HDR, H5P_DEFAULT); + herr_t ret_value = H5Oget_native_info_by_name(getId(), objname, &objinfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); // Throw exception if C API returns failure if (ret_value < 0) diff --git a/c++/src/H5Location.h b/c++/src/H5Location.h index dc3db75..3bad8bc 100644 --- a/c++/src/H5Location.h +++ b/c++/src/H5Location.h @@ -118,8 +118,8 @@ class H5_DLLCPP H5Location : public IdComponent { DataSet openDataSet(const char* name, const DSetAccPropList& dapl = DSetAccPropList::DEFAULT) const; DataSet openDataSet(const H5std_string& name, const DSetAccPropList& dapl = DSetAccPropList::DEFAULT) const; - H5L_info_t getLinkInfo(const char* link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; - H5L_info_t getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + H5L_info2_t getLinkInfo(const char* link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + H5L_info2_t getLinkInfo(const H5std_string& link_name, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; // Returns the value of a symbolic link. H5std_string getLinkval(const char* link_name, size_t size=0) const; @@ -147,26 +147,47 @@ class H5_DLLCPP H5Location : public IdComponent { 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; + void getObjinfo(H5O_info2_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, + void getObjinfo(const char* name, H5O_info2_t& objinfo, unsigned fields = H5O_INFO_BASIC, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; - void getObjinfo(const H5std_string& name, H5O_info_t& objinfo, + void getObjinfo(const H5std_string& name, H5O_info2_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, + H5_iter_order_t order, hsize_t idx, H5O_info2_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, + H5_iter_order_t order, hsize_t idx, H5O_info2_t& objinfo, unsigned fields = H5O_INFO_BASIC, const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + // Retrieves native native information about an HDF5 object. + void getNativeObjinfo(H5O_native_info_t& objinfo, unsigned fields = H5O_NATIVE_INFO_HDR) const; + + // Retrieves native information about an HDF5 object, given its name. + void getNativeObjinfo(const char* name, H5O_native_info_t& objinfo, + unsigned fields = H5O_NATIVE_INFO_HDR, + const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + void getNativeObjinfo(const H5std_string& name, H5O_native_info_t& objinfo, + unsigned fields = H5O_NATIVE_INFO_HDR, + const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + + // Retrieves native information about an HDF5 object, given its index. + void getNativeObjinfo(const char* grp_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo, + unsigned fields = H5O_NATIVE_INFO_HDR, + const LinkAccPropList& lapl = LinkAccPropList::DEFAULT) const; + void getNativeObjinfo(const H5std_string& grp_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t idx, H5O_native_info_t& objinfo, + unsigned fields = H5O_NATIVE_INFO_HDR, + 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. diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 8d3334b..081cab7 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -52,9 +52,9 @@ extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, } // userVisitOpWrpr interfaces between the user's function and the -// C library function H5Ovisit2 +// C library function H5Ovisit3 extern "C" herr_t userVisitOpWrpr(hid_t obj_id, const char *attr_name, - const H5O_info_t *obj_info, void *op_data) + const H5O_info2_t *obj_info, void *op_data) { H5std_string s_attr_name = H5std_string(attr_name); UserData4Visit* myData = reinterpret_cast<UserData4Visit *> (op_data); @@ -250,13 +250,11 @@ int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_dat ///\param *op_data - IN: User-defined pointer to data required by the /// application for its processing of the object ///\param fields - IN: Flags specifying the fields to be retrieved -/// to the callback op via the H5O_info_t argument. +/// to the callback op via the H5O_info2_t argument. /// \li \c H5O_INFO_BASIC fileno, addr, type, and rc fields /// \li \c H5O_INFO_TIME atime, mtime, ctime, and btime fields /// \li \c H5O_INFO_NUM_ATTRS num_attrs field -/// \li \c H5O_INFO_HDR hdr field -/// \li \c H5O_INFO_META_SIZE meta_size field -/// \li \c H5O_INFO_ALL H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE +/// \li \c H5O_INFO_ALL H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS ///\return /// \li On success: /// \li the return value of the first operator that returns a positive value @@ -266,7 +264,7 @@ int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_dat /// wrong within the library or the operator failed ///\exception H5::Exception ///\par Description -/// For information, please refer to the H5Ovisit2 API in the HDF5 +/// For information, please refer to the H5Ovisit3 API in the HDF5 /// C Reference Manual. // Programmer Binh-Minh Ribler - Feb, 2019 //-------------------------------------------------------------------------- @@ -279,15 +277,15 @@ void H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_ userData->obj = this; // Call the C API passing in op wrapper and info - herr_t ret_value = H5Ovisit2(getId(), idx_type, order, userVisitOpWrpr, static_cast<void *>(userData), fields); + herr_t ret_value = H5Ovisit3(getId(), idx_type, order, userVisitOpWrpr, static_cast<void *>(userData), fields); // Release memory delete userData; - // Throw exception if H5Ovisit2 failed, which could be a failure in + // Throw exception if H5Ovisit3 failed, which could be a failure in // the library or in the call back operator if (ret_value < 0) - throw Exception(inMemFunc("visit"), "H5Ovisit2 failed"); + throw Exception(inMemFunc("visit"), "H5Ovisit3 failed"); } //-------------------------------------------------------------------------- @@ -304,15 +302,15 @@ void H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_ //-------------------------------------------------------------------------- unsigned H5Object::objVersion() const { - H5O_info_t objinfo; + H5O_native_info_t objinfo; unsigned version = 0; // Use C API to get information of the object - herr_t ret_value = H5Oget_info2(getId(), &objinfo, H5O_INFO_HDR); + herr_t ret_value = H5Oget_native_info(getId(), &objinfo, H5O_NATIVE_INFO_HDR); // Throw exception if C API returns failure if (ret_value < 0) - throw Exception(inMemFunc("objVersion"), "H5Oget_info failed"); + throw Exception(inMemFunc("objVersion"), "H5Oget_native_info failed"); // Return a valid version or throw an exception for invalid value else { @@ -332,9 +330,9 @@ unsigned H5Object::objVersion() const //-------------------------------------------------------------------------- int H5Object::getNumAttrs() const { - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ - if(H5Oget_info2(getId(), &oinfo, H5O_INFO_NUM_ATTRS) < 0) + if(H5Oget_info3(getId(), &oinfo, H5O_INFO_NUM_ATTRS) < 0) throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed"); else return(static_cast<int>(oinfo.num_attrs)); diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h index 4a4e909..033b1b7 100644 --- a/c++/src/H5Object.h +++ b/c++/src/H5Object.h @@ -44,10 +44,10 @@ typedef void (*attr_operator_t)(H5Object& loc, const H5std_string attr_name, void *operator_data); -// Define the operator function pointer for H5Ovisit2(). +// Define the operator function pointer for H5Ovisit3(). typedef int (*visit_operator_t)(H5Object& obj, const H5std_string attr_name, - const H5O_info_t *oinfo, + const H5O_info2_t *oinfo, void *operator_data); // User data for attribute iteration diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 14f1bd4..fc29307 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1116,9 +1116,9 @@ static herr_t test_types(H5File& file) /*------------------------------------------------------------------------- - * Function: test_getObjinfo + * Function: test_getNativeObjinfo * - * Purpose Tests getObjinfo() + * Purpose Tests getNativeObjinfo() * * Return Success: 0 * Failure: -1 @@ -1126,7 +1126,7 @@ static herr_t test_types(H5File& file) * July, 2018 *------------------------------------------------------------------------- */ -static herr_t test_getinfo(H5File& file) +static herr_t test_getnativeinfo(H5File& file) { SUBTEST("Getting object information"); @@ -1142,18 +1142,18 @@ static herr_t test_getinfo(H5File& file) DataSet dataset(file.openDataSet(DSET_CHUNKED_NAME)); // Get dataset header info - H5O_info_t oinfo; - HDmemset(&oinfo, 0, sizeof(oinfo)); - dataset.getObjinfo(oinfo, H5O_INFO_HDR); - verify_val(oinfo.hdr.nchunks, 1, "DataSet::getObjinfo", __LINE__, __FILE__); + H5O_native_info_t ninfo; + HDmemset(&ninfo, 0, sizeof(ninfo)); + dataset.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR); + verify_val(ninfo.hdr.nchunks, 1, "DataSet::getNativeObjinfo", __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.getObjinfo(oinfo, H5O_INFO_ALL); - verify_val(oinfo.hdr.nchunks, 1, "DataSet::getObjinfo", __LINE__, __FILE__); + HDmemset(&ninfo, 0, sizeof(ninfo)); + dataset.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_ALL); + verify_val(ninfo.hdr.nchunks, 1, "DataSet::getNativeObjinfo", __LINE__, __FILE__); dataset.close(); PASSED(); @@ -1169,10 +1169,10 @@ static herr_t test_getinfo(H5File& file) // catch all other exceptions catch (Exception& E) { - issue_fail_msg("test_getinfo", __LINE__, __FILE__); + issue_fail_msg("test_getnativeinfo", __LINE__, __FILE__); return -1; } -} // test_getinfo +} // test_getnativeinfo /*------------------------------------------------------------------------- @@ -1408,7 +1408,7 @@ void test_dset() nerrors += test_create(file) < 0 ? 1:0; nerrors += test_simple_io(file) < 0 ? 1:0; - nerrors += test_getinfo(file) < 0 ? 1:0; + nerrors += test_getnativeinfo(file) < 0 ? 1:0; nerrors += test_tconv(file) < 0 ? 1:0; nerrors += test_compression(file) < 0 ? 1:0; nerrors += test_nbit_compression(file) < 0 ? 1:0; diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 4734755..9485ec6 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -519,7 +519,7 @@ static void test_attr_basic_read() verify_val(num_attrs, 3, "DataSet::getNumAttrs", __LINE__, __FILE__); // Verify the correct number of attributes another way - H5O_info_t oinfo; + H5O_info2_t oinfo; HDmemset(&oinfo, 0, sizeof(oinfo)); dataset.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS); verify_val(oinfo.num_attrs, 3, "DataSet::getObjinfo", __LINE__, __FILE__); @@ -670,7 +670,7 @@ static void test_attr_compound_read() verify_val(num_attrs, 1, "DataSet::getNumAttrs", __LINE__, __FILE__); // Verify the correct number of attributes another way - H5O_info_t oinfo; + H5O_info2_t oinfo; HDmemset(&oinfo, 0, sizeof(oinfo)); dataset.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS); verify_val(oinfo.num_attrs, 1, "DataSet::getObjinfo", __LINE__, __FILE__); diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 055cf23..a0231a6 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -716,10 +716,10 @@ static void test_libver_bounds_real( verify_val(obj_version, oh_vers_create, "H5File::childObjVersion", __LINE__, __FILE__); // Verify object header version another way - H5O_info_t oinfo; - HDmemset(&oinfo, 0, sizeof(oinfo)); - file.getObjinfo(oinfo, H5O_INFO_HDR); - verify_val(oinfo.hdr.version, oh_vers_create, "H5File::getObjinfo", __LINE__, __FILE__); + H5O_native_info_t ninfo; + HDmemset(&ninfo, 0, sizeof(ninfo)); + file.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR); + verify_val(ninfo.hdr.version, oh_vers_create, "H5File::getNativeObjinfo", __LINE__, __FILE__); /* * Reopen the file and make sure the root group still has the correct @@ -744,9 +744,9 @@ static void test_libver_bounds_real( verify_val(obj_version, oh_vers_mod, "Group::objVersion", __LINE__, __FILE__); // Verify object header version another way - HDmemset(&oinfo, 0, sizeof(oinfo)); - group.getObjinfo(oinfo, H5O_INFO_HDR); - verify_val(oinfo.hdr.version, oh_vers_mod, "Group::getObjinfo", __LINE__, __FILE__); + HDmemset(&ninfo, 0, sizeof(ninfo)); + group.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR); + verify_val(ninfo.hdr.version, oh_vers_mod, "Group::getNativeObjinfo", __LINE__, __FILE__); group.close(); // close "/G1" diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp index e77ebcc..c689087 100644 --- a/c++/test/titerate.cpp +++ b/c++/test/titerate.cpp @@ -96,7 +96,7 @@ int iter_strcmp(const void *s1, const void *s2) * Purpose Custom link iteration callback routine *------------------------------------------------------------------------- */ -static herr_t liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info, void *op_data) +static herr_t liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info, void *op_data) { iter_info *info = (iter_info *)op_data; static int count = 0; @@ -158,7 +158,7 @@ static void test_iter_group(FileAccPropList& fapl) /* Test iterating over empty group */ info.command = RET_ZERO; idx = 0; - ret = H5Literate(file.getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + ret = H5Literate2(file.getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); verify_val(ret, SUCCEED, "H5Literate", __LINE__, __FILE__); DataType datatype(PredType::NATIVE_INT); @@ -207,7 +207,7 @@ static void test_iter_group(FileAccPropList& fapl) H5std_string obj_name; for (i = 0; i < nobjs; i++) { - //H5O_info_t oinfo; /* Object info */ + //H5O_info2_t oinfo; /* Object info */ obj_name = root_group.getObjnameByIdx(i); //ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT); @@ -287,7 +287,7 @@ static void test_iter_group(FileAccPropList& fapl) /* Test all objects in group, when callback always returns 0 */ info.command = RET_ZERO; idx = 0; - if((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) + if((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) TestErrPrintf("Group iteration function didn't return zero correctly!\n"); /* Test all objects in group, when callback always returns 1 */ @@ -295,7 +295,7 @@ static void test_iter_group(FileAccPropList& fapl) info.command = RET_TWO; i = 0; idx = 0; - while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) { + while((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) { /* Verify return value from iterator gets propagated correctly */ verify_val(ret, 2, "H5Literate", __LINE__, __FILE__); @@ -321,7 +321,7 @@ static void test_iter_group(FileAccPropList& fapl) info.command = new_format ? RET_CHANGE2 : RET_CHANGE; i = 0; idx = 0; - while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) { + while((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) { /* Verify return value from iterator gets propagated correctly */ verify_val(ret, 1, "H5Literate", __LINE__, __FILE__); diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index 491cd6a..1bdd442 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -190,7 +190,7 @@ const H5std_string GROUP2NAME("Second_group"); static void test_lcpl(hid_t fapl_id, hbool_t new_format) { - H5L_info_t linfo; + H5L_info2_t linfo; char filename[1024]; hsize_t dims[2]; @@ -604,7 +604,7 @@ const int RANK = 2; const int DIM1 = 2; // Operator function -static int visit_obj_cb(H5Object& obj, const H5std_string name, const H5O_info_t *oinfo, void *_op_data) +static int visit_obj_cb(H5Object& obj, const H5std_string name, const H5O_info2_t *oinfo, void *_op_data) { ovisit_ud_t *op_data = static_cast <ovisit_ud_t *>(_op_data); diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index 232ece2..fd0f5ce 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -542,7 +542,7 @@ const H5std_string GROUP1NAME("group1"); const H5std_string GROUP2NAME("group2"); static void test_getobjectinfo_same_file() { - H5O_info_t oinfo1, oinfo2; /* Object info structs */ + H5O_info2_t oinfo1, oinfo2; /* Object info structs */ // Output message about test being performed SUBTEST("Group::getObjinfo"); diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 562b127..8a6fb51 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -482,7 +482,7 @@ static void test_reference_group() verify_val(fname, FILE1, "H5Group::getFileName",__LINE__,__FILE__); // Check object type using Group::getObjinfo() - H5O_info_t oinfo; + H5O_info2_t oinfo; HDmemset(&oinfo, 0, sizeof(oinfo)); group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, oinfo); verify_val(oinfo.type, H5O_TYPE_DATASET, "Group::getObjinfo",__LINE__,__FILE__); |