diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-02-08 18:50:21 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-02-08 18:50:21 (GMT) |
commit | 494f46639dfdd646cb54235ef9d8a3b0cf75523c (patch) | |
tree | 0a76ca21742e73ab36f76634a3872f3c9feee303 | |
parent | 1e5e6baad117093c66c922f157dade58b2716f89 (diff) | |
download | hdf5-494f46639dfdd646cb54235ef9d8a3b0cf75523c.zip hdf5-494f46639dfdd646cb54235ef9d8a3b0cf75523c.tar.gz hdf5-494f46639dfdd646cb54235ef9d8a3b0cf75523c.tar.bz2 |
[svn-r13272] Description:
Checkpoint attribute creation order coding on "by index" routines.
Tested on:
Linux/32 2.6 (chicago)
Linux/64 2.6 (chicago2)
-rw-r--r-- | src/H5A.c | 64 | ||||
-rw-r--r-- | src/H5Apublic.h | 6 | ||||
-rw-r--r-- | src/H5L.c | 32 | ||||
-rw-r--r-- | src/H5Lpublic.h | 23 | ||||
-rw-r--r-- | src/H5Oattribute.c | 3 | ||||
-rw-r--r-- | src/H5Opkg.h | 4 | ||||
-rw-r--r-- | test/tattr.c | 96 |
7 files changed, 147 insertions, 81 deletions
@@ -69,7 +69,8 @@ typedef struct H5A_iter_cb1 { static hid_t H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_t *space, hid_t acpl_id, hid_t dxpl_id); static herr_t H5A_open_common(const H5G_loc_t *loc, H5A_t *attr); -static H5A_t *H5A_open_by_idx(H5G_loc_t *loc, unsigned idx, hid_t dxpl_id); +static H5A_t *H5A_open_by_idx(H5G_loc_t *loc, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, hid_t dxpl_id); static H5A_t *H5A_open_by_name(const H5G_loc_t *loc, const char *name, hid_t dxpl_id); static herr_t H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id); @@ -507,7 +508,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Open the attribute in the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, idx, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_idx(&loc, H5_INDEX_NAME, H5_ITER_INC, (hsize_t)idx, H5AC_ind_dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") /* Register the attribute and get an ID for it */ @@ -598,7 +599,8 @@ done: *------------------------------------------------------------------------- */ static H5A_t * -H5A_open_by_idx(H5G_loc_t *loc, unsigned idx, hid_t dxpl_id) +H5A_open_by_idx(H5G_loc_t *loc, H5_index_t idx_type, H5_iter_order_t order, + hsize_t n, hid_t dxpl_id) { H5A_t *attr = NULL; H5A_t *ret_value; /* Return value */ @@ -609,8 +611,7 @@ H5A_open_by_idx(H5G_loc_t *loc, unsigned idx, hid_t dxpl_id) HDassert(loc); /* Read in attribute from object header */ -/* XXX: This uses name index order currently, but should use creation order, once it's implemented */ - if(NULL == (attr = H5O_attr_open_by_idx(loc->oloc, (hsize_t)idx, dxpl_id))) + if(NULL == (attr = H5O_attr_open_by_idx(loc->oloc, idx_type, order, n, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to load attribute info from object header") attr->initialized = TRUE; @@ -1322,6 +1323,59 @@ done: /*------------------------------------------------------------------------- + * Function: H5Aget_info_by_idx + * + * Purpose: Retrieve information about an attribute, according to the + * order within an index. + * + * Return: Success: Non-negative with information in AINFO + * Failure: Negative + * + * Programmer: Quincey Koziol + * February 8, 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Aget_info_by_idx(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, + hsize_t n, H5A_info_t *ainfo) +{ + H5G_loc_t loc; /* Object location */ + H5A_t *attr = NULL; /* Attribute object for name */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(H5Aget_info_by_idx, FAIL) + + /* Check args */ + if(H5I_FILE == H5I_get_type(loc_id) || H5I_ATTR == H5I_get_type(loc_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(NULL == ainfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") + + /* Open the attribute on the object header */ + if(NULL == (attr = H5A_open_by_idx(&loc, idx_type, order, n, H5AC_ind_dxpl_id))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + + /* Get the attribute information */ + if(H5A_get_info(attr, ainfo) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + +done: + /* Cleanup on failure */ + if(attr && H5A_close(attr) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + + FUNC_LEAVE_API(ret_value) +} /* end H5Aget_info_by_idx() */ + + +/*------------------------------------------------------------------------- * Function: H5A_get_info * * Purpose: Retrieve information about an attribute. diff --git a/src/H5Apublic.h b/src/H5Apublic.h index dee7644..0bcf8d6 100644 --- a/src/H5Apublic.h +++ b/src/H5Apublic.h @@ -42,7 +42,7 @@ typedef herr_t (*H5A_operator_t)(hid_t location_id/*in*/, /* Public function prototypes */ H5_DLL hid_t H5Acreate(hid_t loc_id, const char *name, hid_t type_id, - hid_t space_id, hid_t plist_id); + hid_t space_id, hid_t plist_id); H5_DLL hid_t H5Aopen_name(hid_t loc_id, const char *name); H5_DLL hid_t H5Aopen_idx(hid_t loc_id, unsigned idx); H5_DLL herr_t H5Awrite(hid_t attr_id, hid_t type_id, const void *buf); @@ -54,9 +54,11 @@ H5_DLL hid_t H5Aget_create_plist(hid_t attr_id); H5_DLL ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf); H5_DLL hsize_t H5Aget_storage_size(hid_t attr_id); H5_DLL herr_t H5Aget_info(hid_t loc_id, const char *name, H5A_info_t *ainfo /*out*/); +H5_DLL herr_t H5Aget_info_by_idx(hid_t loc_id, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, H5A_info_t *ainfo /*out*/); H5_DLL herr_t H5Arename(hid_t loc_id, const char *old_name, const char *new_name); H5_DLL herr_t H5Aiterate(hid_t loc_id, unsigned *attr_num, H5A_operator_t op, - void *op_data); + void *op_data); H5_DLL herr_t H5Adelete(hid_t loc_id, const char *name); /* Functions and variables defined for compatibility with previous versions @@ -184,7 +184,7 @@ static herr_t H5L_get_info_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, H5G_own_loc_t *own_loc/*out*/); static herr_t H5L_get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - H5L_info_t *linkbuf/*out*/, hid_t lapl_id, hid_t dxpl_id); + H5L_info_t *linfo/*out*/, hid_t lapl_id, hid_t dxpl_id); static herr_t H5L_get_name_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -830,7 +830,7 @@ done: * * Purpose: Gets metadata for a link. * - * Return: Success: Non-negative with information in LINKBUF + * Return: Success: Non-negative with information in LINFO * * Failure: Negative * @@ -840,14 +840,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linkbuf /*out*/, +H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, hid_t lapl_id) { H5G_loc_t loc; herr_t ret_value = SUCCEED; FUNC_ENTER_API(H5Lget_info, FAIL) - H5TRACE4("e", "isxi", loc_id, name, linkbuf, lapl_id); + H5TRACE4("e", "isxi", loc_id, name, linfo, lapl_id); /* Check arguments */ if(H5G_loc(loc_id, &loc)) @@ -861,12 +861,12 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linkbuf /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Get the link information */ - if(H5L_get_info(&loc, name, linkbuf, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5L_get_info(&loc, name, linfo, lapl_id, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) -} /* end H5Gget_info() */ +} /* end H5Lget_info() */ /*------------------------------------------------------------------------- @@ -875,7 +875,7 @@ done: * Purpose: Gets metadata for a link, according to the order within an * index. * - * Return: Success: Non-negative with information in LINKBUF + * Return: Success: Non-negative with information in LINFO * Failure: Negative * * Programmer: Quincey Koziol @@ -886,13 +886,13 @@ done: herr_t H5Lget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - H5L_info_t *linkbuf /*out*/, hid_t lapl_id) + H5L_info_t *linfo /*out*/, hid_t lapl_id) { H5G_loc_t loc; /* Group location for group to query */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Lget_info_by_idx, FAIL) - H5TRACE7("e", "isIiIohxi", loc_id, group_name, idx_type, order, n, linkbuf, + H5TRACE7("e", "isIiIohxi", loc_id, group_name, idx_type, order, n, linfo, lapl_id); /* Check arguments */ @@ -911,12 +911,12 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Get the link information */ - if(H5L_get_info_by_idx(&loc, group_name, idx_type, order, n, linkbuf, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5L_get_info_by_idx(&loc, group_name, idx_type, order, n, linfo, lapl_id, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) -} /* end H5Gget_info_by_idx() */ +} /* end H5Lget_info_by_idx() */ /*------------------------------------------------------------------------- @@ -1095,7 +1095,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, done: FUNC_LEAVE_API(ret_value) -} /* end H5Gget_name_by_idx() */ +} /* end H5Lget_name_by_idx() */ /*------------------------------------------------------------------------- @@ -2578,14 +2578,14 @@ done: */ herr_t H5L_get_info(const H5G_loc_t *loc, const char *name, - H5L_info_t *linkbuf/*out*/, hid_t lapl_id, hid_t dxpl_id) + H5L_info_t *linfo/*out*/, hid_t lapl_id, hid_t dxpl_id) { H5L_trav_gi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5L_get_info, FAIL) - udata.linfo = linkbuf; + udata.linfo = linfo; udata.dxpl_id = dxpl_id; /* Traverse the group hierarchy to locate the object to get info about */ @@ -2665,7 +2665,7 @@ done: static herr_t H5L_get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - H5L_info_t *linkbuf/*out*/, hid_t lapl_id, hid_t dxpl_id) + H5L_info_t *linfo/*out*/, hid_t lapl_id, hid_t dxpl_id) { H5L_trav_gibi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2681,7 +2681,7 @@ H5L_get_info_by_idx(const H5G_loc_t *loc, const char *group_name, udata.order = order; udata.n = n; udata.dxpl_id = dxpl_id; - udata.linfo = linkbuf; + udata.linfo = linfo; /* Traverse the group hierarchy to locate the object to get info about */ if(H5G_traverse(loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_info_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index 4c3e58d..7faeb8e 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -135,16 +135,15 @@ typedef herr_t (*H5L_iterate_t)(hid_t group, const char *name, const H5L_info_t /* Public Prototypes */ /*********************/ H5_DLL herr_t H5Llink(hid_t cur_loc_id, const char *cur_name, - hid_t obj_id, hid_t lcpl_id, hid_t lapl_id); + hid_t obj_id, hid_t lcpl_id, hid_t lapl_id); H5_DLL herr_t H5Lmove(hid_t src_loc, const char *src_name, hid_t dst_loc, - const char *dst_name, hid_t lcpl_id, hid_t lapl_id); + const char *dst_name, hid_t lcpl_id, hid_t lapl_id); H5_DLL herr_t H5Lcopy(hid_t src_loc, const char *src_name, hid_t dst_loc, - const char *dst_name, hid_t lcpl_id, hid_t lapl_id); + const char *dst_name, hid_t lcpl_id, hid_t lapl_id); H5_DLL herr_t H5Lcreate_hard(hid_t cur_loc, const char *cur_name, - hid_t dst_loc, const char *dst_name, hid_t lcpl_id, - hid_t lapl_id); + hid_t dst_loc, const char *dst_name, hid_t lcpl_id, hid_t lapl_id); H5_DLL herr_t H5Lcreate_soft(const char *target_path, hid_t cur_loc, - const char *cur_name, hid_t lcpl_id, hid_t lapl_id); + const char *cur_name, hid_t lcpl_id, hid_t lapl_id); H5_DLL herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id); H5_DLL herr_t H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id); @@ -154,10 +153,10 @@ H5_DLL herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, void *buf/*out*/, size_t size, hid_t lapl_id); H5_DLL herr_t H5Lget_info(hid_t loc_id, const char *name, - H5L_info_t *linkbuf /*out*/, hid_t lapl_id); + H5L_info_t *linfo /*out*/, hid_t lapl_id); H5_DLL herr_t H5Lget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, - H5L_info_t *linkbuf /*out*/, hid_t lapl_id); + H5L_info_t *linfo /*out*/, hid_t lapl_id); H5_DLL ssize_t H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size, hid_t lapl_id); @@ -167,17 +166,17 @@ H5_DLL herr_t H5Literate(hid_t loc_id, const char *group_name, /* UD link functions */ H5_DLL herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name, - H5L_type_t link_type, const void * udata, size_t udata_size, - hid_t lcpl_id, hid_t lapl_id); + H5L_type_t link_type, const void * udata, size_t udata_size, hid_t lcpl_id, + hid_t lapl_id); H5_DLL herr_t H5Lregister(const H5L_class_t *cls); H5_DLL herr_t H5Lunregister(H5L_type_t id); H5_DLL htri_t H5Lis_registered(H5L_type_t id); /* External link functions */ H5_DLL herr_t H5Lunpack_elink_val(char * ext_linkval/*in*/, size_t link_size, - char ** filename/*out*/, char** obj_path /*out*/); + char ** filename/*out*/, char** obj_path /*out*/); H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name, - hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id); + hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id); #ifdef __cplusplus } diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 5a1a2b1..781572b 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -475,7 +475,8 @@ done: *------------------------------------------------------------------------- */ H5A_t * -H5O_attr_open_by_idx(const H5O_loc_t *loc, hsize_t n, hid_t dxpl_id) +H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, hid_t dxpl_id) { H5A_attr_iter_op_t attr_op; /* Attribute operator */ H5A_t *ret_value = NULL; /* Return value */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index b07a46f..2d106da 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -475,8 +475,8 @@ H5_DLL herr_t H5O_shared_debug(const H5O_shared_t *mesg, FILE *stream, H5_DLL herr_t H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr); H5_DLL H5A_t *H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id); -H5_DLL H5A_t *H5O_attr_open_by_idx(const H5O_loc_t *loc, hsize_t n, - hid_t dxpl_id); +H5_DLL H5A_t *H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, hid_t dxpl_id); H5_DLL herr_t H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr); H5_DLL herr_t H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, diff --git a/test/tattr.c b/test/tattr.c index 6e0142c..b95c9f0 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -3777,7 +3777,6 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_corder_delete() */ -#ifdef NOT_YET /**************************************************************** ** ** test_attr_info_by_idx(): Test basic H5A (attribute) code. @@ -3788,10 +3787,12 @@ static void test_attr_info_by_idx(hid_t fcpl, hid_t fapl) { hid_t fid; /* HDF5 File ID */ - hid_t dataset; /* Dataset ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset; /* Current dataset ID */ hid_t sid; /* Dataspace ID */ hid_t attr; /* Attribute ID */ hid_t dcpl; /* Dataset creation property list ID */ + H5A_info_t ainfo; /* Attribute information */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ htri_t is_empty; /* Are there any attributes? */ @@ -3801,6 +3802,7 @@ test_attr_info_by_idx(hid_t fcpl, hid_t fapl) hsize_t corder_count; /* # of records in creation order index */ hbool_t use_index; /* Use index on creation order values */ char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ unsigned u; /* Local index variable */ herr_t ret; /* Generic return value */ @@ -3812,9 +3814,9 @@ test_attr_info_by_idx(hid_t fcpl, hid_t fapl) for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Output message about test being performed */ if(use_index) - MESSAGE(5, ("Testing Querying Attribute Info By Index w/Creation Order Index\n")); + MESSAGE(5, ("Testing Querying Attribute Info By Index w/Creation Order Index\n")) else - MESSAGE(5, ("Testing Querying Attribute Info By Index w/o Creation Order Index\n")); + MESSAGE(5, ("Testing Querying Attribute Info By Index w/o Creation Order Index\n")) /* Create file */ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); @@ -3828,24 +3830,53 @@ test_attr_info_by_idx(hid_t fcpl, hid_t fapl) ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))); CHECK(ret, FAIL, "H5Pset_attr_creation_order"); - /* Create a dataset */ - dataset = H5Dcreate(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, dcpl); - CHECK(dataset, FAIL, "H5Dcreate"); - - /* Check on dataset's attribute storage status */ - is_empty = H5O_is_attr_empty_test(dataset); - VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); - /* Query the attribute creation properties */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); CHECK(ret, FAIL, "H5Pget_attr_phase_change"); + /* Create datasets */ + dset1 = H5Dcreate(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, dcpl); + CHECK(dset1, FAIL, "H5Dcreate"); + dset2 = H5Dcreate(fid, DSET2_NAME, H5T_NATIVE_UCHAR, sid, dcpl); + CHECK(dset2, FAIL, "H5Dcreate"); + dset3 = H5Dcreate(fid, DSET3_NAME, H5T_NATIVE_UCHAR, sid, dcpl); + CHECK(dset3, FAIL, "H5Dcreate"); + /* Close property list */ ret = H5Pclose(dcpl); CHECK(ret, FAIL, "H5Pclose"); + /* Work on all the datasets */ + for(curr_dset = 0; curr_dset < NUM_DSETS; curr_dset++) { + switch(curr_dset) { + case 0: + my_dataset = dset1; + break; + + case 1: + my_dataset = dset2; + break; + + case 2: + my_dataset = dset3; + break; + + default: + HDassert(0 && "Too many datasets!"); + } /* end switch */ + + /* Check on dataset's attribute storage status */ + is_empty = H5O_is_attr_empty_test(my_dataset); + VERIFY(is_empty, TRUE, "H5O_is_attr_empty_test"); + is_dense = H5O_is_attr_dense_test(my_dataset); + VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + + /* Check for query on non-existant attribute */ + ret = H5Aget_info_by_idx(my_dataset, H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &ainfo); + VERIFY(ret, FALSE, "H5Aget_info_by_idx"); + } /* end for */ + +#ifdef NOT_YET /* Create attributes, until attribute storage is in dense form */ for(u = 0; u < max_compact * 2; u++) { /* Create attribute */ @@ -3875,43 +3906,22 @@ test_attr_info_by_idx(hid_t fcpl, hid_t fapl) ret = H5O_attr_dense_info_test(dataset, &name_count, &corder_count); CHECK(ret, FAIL, "H5O_attr_dense_info_test"); VERIFY(name_count, corder_count, "H5O_attr_dense_info_test"); +#endif /* NOT_YET */ - /* Close Dataset */ - ret = H5Dclose(dataset); + /* Close Datasets */ + ret = H5Dclose(dset1); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Dclose(dset2); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Dclose(dset3); CHECK(ret, FAIL, "H5Dclose"); - - /* Check for deleting dataset without re-opening file */ - if(!reopen_file) { - ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Ldelete"); - } /* end if */ /* Close file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check for deleting dataset after re-opening file */ - if(reopen_file) { - /* Re-open file */ - fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); - CHECK(fid, FAIL, "H5Fopen"); - - /* Delete the dataset */ - ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Ldelete"); - - /* Close file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); - } /* end if */ - - /* Get the size of the file now */ - file_size = h5_get_file_size(FILENAME); - CHECK(file_size, FAIL, "h5_get_file_size"); - VERIFY(file_size, empty_size, "h5_get_file_size"); } /* end for */ } /* test_attr_corder_delete() */ -#endif /* NOT_YET */ /**************************************************************** ** @@ -5523,8 +5533,8 @@ test_attr(void) test_attr_corder_transition(my_fcpl, my_fapl); /* Test attribute storage transitions on an object w/attribute creation order info */ test_attr_corder_delete(my_fcpl, my_fapl); /* Test deleting object using dense storage w/attribute creation order info */ - /* New attribute API routine tests */ #ifdef NOT_YET + /* New attribute API routine tests */ test_attr_info_by_idx(my_fcpl, my_fapl); /* Test querying attribute info by index */ #endif /* NOT_YET */ |