summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-02-08 18:50:21 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-02-08 18:50:21 (GMT)
commit494f46639dfdd646cb54235ef9d8a3b0cf75523c (patch)
tree0a76ca21742e73ab36f76634a3872f3c9feee303 /src
parent1e5e6baad117093c66c922f157dade58b2716f89 (diff)
downloadhdf5-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)
Diffstat (limited to 'src')
-rw-r--r--src/H5A.c64
-rw-r--r--src/H5Apublic.h6
-rw-r--r--src/H5L.c32
-rw-r--r--src/H5Lpublic.h23
-rw-r--r--src/H5Oattribute.c3
-rw-r--r--src/H5Opkg.h4
6 files changed, 94 insertions, 38 deletions
diff --git a/src/H5A.c b/src/H5A.c
index cf5a326..28e9813 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -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
diff --git a/src/H5L.c b/src/H5L.c
index bc11e8b..e39e787 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -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,