[svn-r22627] Description:

Merge some of the changes on the plist_encode_decode branch back to the
trunk.

Tested on:
    Mac OSX/64 10.7.4 (amazon) w/debug
    (Too minor to require h5committest)
This commit is contained in:
Quincey Koziol 2012-08-03 18:44:17 -05:00
parent 28943c415b
commit f2bc1b43de
17 changed files with 179 additions and 95 deletions

View File

@ -118,7 +118,7 @@ H5P_init_pub_interface(void)
hid_t
H5Pcopy(hid_t id)
{
void *obj; /* Property object to copy */
void *obj; /* Property object to copy */
hid_t ret_value=FALSE; /* return value */
FUNC_ENTER_API(FAIL)
@ -224,7 +224,7 @@ H5Pcreate_class(hid_t parent, const char *name,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't retrieve parent class")
/* Create the new property list class */
if(NULL == (pclass = H5P_create_class(par_class, name, FALSE, cls_create, create_data, cls_copy, copy_data, cls_close, close_data)))
if(NULL == (pclass = H5P_create_class(par_class, name, H5P_TYPE_USER, cls_create, create_data, cls_copy, copy_data, cls_close, close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list class")
/* Get an atom for the class */
@ -1147,6 +1147,7 @@ H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data)
{
H5P_iter_ud_t udata; /* User data for internal iterator callback */
int fake_idx = 0; /* Index when user doesn't provide one */
void *obj; /* Property object to copy */
int ret_value; /* return value */
FUNC_ENTER_API(FAIL)
@ -1155,6 +1156,8 @@ H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data)
/* Check arguments. */
if(H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property object");
if(NULL == (obj = H5I_object(id)))
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist");
if(iter_func == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration callback");
@ -1165,13 +1168,13 @@ H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data)
if(H5I_GENPROP_LST == H5I_get_type(id)) {
/* Iterate over a property list */
if((ret_value = H5P_iterate_plist(id, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
if((ret_value = H5P_iterate_plist((H5P_genplist_t *)obj, TRUE, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over list");
} /* end if */
else
if(H5I_GENPROP_CLS == H5I_get_type(id)) {
/* Iterate over a property class */
if((ret_value = H5P_iterate_pclass(id, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
if((ret_value = H5P_iterate_pclass((H5P_genclass_t *)obj, (idx ? idx : &fake_idx), H5P__iterate_cb, &udata)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over class");
} /* end if */
else

View File

@ -64,6 +64,7 @@
/* Attribute creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_ACRT[1] = {{
"attribute create", /* Class name for debugging */
H5P_TYPE_ATTRIBUTE_CREATE, /* Class type */
&H5P_CLS_STRING_CREATE_g, /* Parent class ID */
&H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class ID */
&H5P_LST_ATTRIBUTE_CREATE_g, /* Pointer to default property list ID */

View File

@ -82,15 +82,16 @@ static herr_t H5P__dacc_reg_prop(H5P_genclass_t *pclass);
/* Dataset access property list class library initialization object */
const H5P_libclass_t H5P_CLS_DACC[1] = {{
"dataset access", /* Class name for debugging */
H5P_TYPE_DATASET_ACCESS, /* Class type */
&H5P_CLS_LINK_ACCESS_g, /* Parent class ID */
&H5P_CLS_DATASET_ACCESS_g, /* Pointer to class ID */
&H5P_LST_DATASET_ACCESS_g, /* Pointer to default property list ID */
H5P__dacc_reg_prop, /* Default property registration routine */
NULL, /* Class creation callback */
NULL, /* Class creation callback */
NULL, /* Class creation callback info */
NULL, /* Class copy callback */
NULL, /* Class copy callback */
NULL, /* Class copy callback info */
NULL, /* Class close callback */
NULL, /* Class close callback */
NULL /* Class close callback info */
}};
@ -271,3 +272,4 @@ H5Pget_chunk_cache(hid_t dapl_id, size_t *rdcc_nslots, size_t *rdcc_nbytes, doub
done:
FUNC_LEAVE_API(ret_value)
}

View File

@ -128,6 +128,7 @@ static int H5P__dcrt_ext_file_list_cmp(const void *value1, const void *value2, s
/* Dataset creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_DCRT[1] = {{
"dataset create", /* Class name for debugging */
H5P_TYPE_DATASET_CREATE, /* Class type */
&H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */
&H5P_CLS_DATASET_CREATE_g, /* Pointer to class ID */
&H5P_LST_DATASET_CREATE_g, /* Pointer to default property list ID */

View File

@ -47,8 +47,8 @@
/* ======== Data transfer properties ======== */
/* Definitions for maximum temp buffer size property */
#define H5D_XFER_MAX_TEMP_BUF_SIZE sizeof(size_t)
#define H5D_XFER_MAX_TEMP_BUF_DEF H5D_TEMP_BUF_SIZE
#define H5D_XFER_MAX_TEMP_BUF_SIZE sizeof(size_t)
#define H5D_XFER_MAX_TEMP_BUF_DEF H5D_TEMP_BUF_SIZE
/* Definitions for type conversion buffer property */
#define H5D_XFER_TCONV_BUF_SIZE sizeof(void *)
#define H5D_XFER_TCONV_BUF_DEF NULL
@ -88,6 +88,8 @@
*/
#define H5D_XFER_HYPER_VECTOR_SIZE_SIZE sizeof(size_t)
#define H5D_XFER_HYPER_VECTOR_SIZE_DEF H5D_IO_VECTOR_SIZE
#ifdef H5_HAVE_PARALLEL
/* Definitions for I/O transfer mode property */
#define H5D_XFER_IO_XFER_MODE_SIZE sizeof(H5FD_mpio_xfer_t)
#define H5D_XFER_IO_XFER_MODE_DEF H5FD_MPIO_INDEPENDENT
@ -106,6 +108,14 @@
/* Definitions for chunk io mode property. */
#define H5D_MPIO_ACTUAL_IO_MODE_SIZE sizeof(H5D_mpio_actual_io_mode_t)
#define H5D_MPIO_ACTUAL_IO_MODE_DEF H5D_MPIO_NO_COLLECTIVE
/* Definitions for memory MPI type property */
#define H5FD_MPI_XFER_MEM_MPI_TYPE_SIZE sizeof(MPI_Datatype)
#define H5FD_MPI_XFER_MEM_MPI_TYPE_DEF MPI_DATATYPE_NULL
/* Definitions for file MPI type property */
#define H5FD_MPI_XFER_FILE_MPI_TYPE_SIZE sizeof(MPI_Datatype)
#define H5FD_MPI_XFER_FILE_MPI_TYPE_DEF MPI_DATATYPE_NULL
#endif /* H5_HAVE_PARALLEL */
/* Definitions for EDC property */
#define H5D_XFER_EDC_SIZE sizeof(H5Z_EDC_t)
#define H5D_XFER_EDC_DEF H5Z_ENABLE_EDC
@ -121,12 +131,6 @@
#define H5D_XFER_XFORM_DEL H5P_dxfr_xform_del
#define H5D_XFER_XFORM_COPY H5P_dxfr_xform_copy
#define H5D_XFER_XFORM_CLOSE H5P_dxfr_xform_close
/* Definitions for memory MPI type property */
#define H5FD_MPI_XFER_MEM_MPI_TYPE_SIZE sizeof(MPI_Datatype)
#define H5FD_MPI_XFER_MEM_MPI_TYPE_DEF MPI_DATATYPE_NULL
/* Definitions for file MPI type property */
#define H5FD_MPI_XFER_FILE_MPI_TYPE_SIZE sizeof(MPI_Datatype)
#define H5FD_MPI_XFER_FILE_MPI_TYPE_DEF MPI_DATATYPE_NULL
/******************/
/* Local Typedefs */
@ -161,6 +165,7 @@ static herr_t H5P_dxfr_xform_close(const char* name, size_t size, void* value);
/* Data transfer property list class library initialization object */
const H5P_libclass_t H5P_CLS_DXFR[1] = {{
"data transfer", /* Class name for debugging */
H5P_TYPE_DATASET_XFER, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_DATASET_XFER_g, /* Pointer to class ID */
&H5P_LST_DATASET_XFER_g, /* Pointer to default property list ID */
@ -722,8 +727,6 @@ done:
* Programmer: Robb Matzke
* Monday, March 16, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
herr_t
@ -736,7 +739,7 @@ H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg)
H5TRACE4("e", "iz*x*x", plist_id, size, tconv, bkg);
/* Check arguments */
if (size<=0)
if(size == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size must not be zero")
/* Get the plist structure */
@ -744,16 +747,16 @@ H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Update property list */
if(H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
if(H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer buffer size")
if(H5P_set(plist, H5D_XFER_TCONV_BUF_NAME, &tconv)<0)
if(H5P_set(plist, H5D_XFER_TCONV_BUF_NAME, &tconv) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer type conversion buffer")
if(H5P_set(plist, H5D_XFER_BKGR_BUF_NAME, &bkg)<0)
if(H5P_set(plist, H5D_XFER_BKGR_BUF_NAME, &bkg) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set background type conversion buffer")
done:
FUNC_LEAVE_API(ret_value)
}
} /* end H5Pset_buffer() */
/*-------------------------------------------------------------------------
@ -768,8 +771,6 @@ done:
* Programmer: Robb Matzke
* Monday, March 16, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
size_t

View File

@ -168,6 +168,7 @@ static herr_t H5P_file_image_info_close(const char *name, size_t size, void *val
/* File access property list class library initialization object */
const H5P_libclass_t H5P_CLS_FACC[1] = {{
"file access", /* Class name for debugging */
H5P_TYPE_FILE_ACCESS, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_FILE_ACCESS_g, /* Pointer to class ID */
&H5P_LST_FILE_ACCESS_g, /* Pointer to default property list ID */

View File

@ -106,6 +106,7 @@ static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass);
/* File creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_FCRT[1] = {{
"file create", /* Class name for debugging */
H5P_TYPE_FILE_CREATE, /* Class type */
&H5P_CLS_GROUP_CREATE_g, /* Parent class ID */
&H5P_CLS_FILE_CREATE_g, /* Pointer to class ID */
&H5P_LST_FILE_CREATE_g, /* Pointer to default property list ID */

View File

@ -74,6 +74,7 @@ static herr_t H5P_fmnt_reg_prop(H5P_genclass_t *pclass);
/* File mount property list class library initialization object */
const H5P_libclass_t H5P_CLS_FMNT[1] = {{
"file mount", /* Class name for debugging */
H5P_TYPE_FILE_MOUNT, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_FILE_MOUNT_g, /* Pointer to class ID */
&H5P_LST_FILE_MOUNT_g, /* Pointer to default property list ID */

View File

@ -68,6 +68,7 @@ static herr_t H5P_gcrt_reg_prop(H5P_genclass_t *pclass);
/* Group creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_GCRT[1] = {{
"group create", /* Class name for debugging */
H5P_TYPE_GROUP_CREATE, /* Class type */
&H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */
&H5P_CLS_GROUP_CREATE_g, /* Pointer to class ID */
&H5P_LST_GROUP_CREATE_g, /* Pointer to default property list ID */

View File

@ -132,6 +132,7 @@ hid_t H5P_LST_LINK_ACCESS_g = FAIL;
/* Root property list class library initialization object */
const H5P_libclass_t H5P_CLS_ROOT[1] = {{
"root", /* Class name for debugging */
H5P_TYPE_ROOT, /* Class type */
NULL, /* Parent class ID */
&H5P_CLS_ROOT_g, /* Pointer to class ID */
NULL, /* Pointer to default property list ID */
@ -148,6 +149,7 @@ const H5P_libclass_t H5P_CLS_ROOT[1] = {{
/* (move to proper source code file when used for real) */
const H5P_libclass_t H5P_CLS_GACC[1] = {{
"group access", /* Class name for debugging */
H5P_TYPE_GROUP_ACCESS, /* Class type */
&H5P_CLS_LINK_ACCESS_g, /* Parent class ID */
&H5P_CLS_GROUP_ACCESS_g, /* Pointer to class ID */
&H5P_LST_GROUP_ACCESS_g, /* Pointer to default property list ID */
@ -164,6 +166,7 @@ const H5P_libclass_t H5P_CLS_GACC[1] = {{
/* (move to proper source code file when used for real) */
const H5P_libclass_t H5P_CLS_TCRT[1] = {{
"datatype create", /* Class name for debugging */
H5P_TYPE_DATATYPE_CREATE, /* Class type */
&H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */
&H5P_CLS_DATATYPE_CREATE_g, /* Pointer to class ID */
&H5P_LST_DATATYPE_CREATE_g, /* Pointer to default property list ID */
@ -180,6 +183,7 @@ const H5P_libclass_t H5P_CLS_TCRT[1] = {{
/* (move to proper source code file when used for real) */
const H5P_libclass_t H5P_CLS_TACC[1] = {{
"datatype access", /* Class name for debugging */
H5P_TYPE_DATATYPE_ACCESS, /* Class type */
&H5P_CLS_LINK_ACCESS_g, /* Parent class ID */
&H5P_CLS_DATATYPE_ACCESS_g, /* Pointer to class ID */
&H5P_LST_DATATYPE_ACCESS_g, /* Pointer to default property list ID */
@ -433,7 +437,7 @@ H5P_init_interface(void)
} /* end if */
/* Allocate the new class */
if(NULL == (new_pclass = H5P_create_class(par_pclass, lib_class->name, 1, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data)))
if(NULL == (new_pclass = H5P_create_class(par_pclass, lib_class->name, lib_class->type, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed")
/* Call routine to register properties for class */
@ -599,11 +603,11 @@ H5P_copy_pclass(H5P_genclass_t *pclass)
*/
/* Create the new property list class */
if(NULL==(new_pclass=H5P_create_class(pclass->parent, pclass->name, 0, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data)))
if(NULL == (new_pclass = H5P_create_class(pclass->parent, pclass->name, pclass->type, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "unable to create property list class")
/* Copy the properties registered for this class */
if(pclass->nprops>0) {
if(pclass->nprops > 0) {
H5SL_node_t *curr_node; /* Current node in skip list */
/* Walk through the properties in the old class */
@ -1092,7 +1096,7 @@ done:
/*--------------------------------------------------------------------------
NAME
H5P_find_prop_plist
H5P__find_prop_plist
PURPOSE
Internal routine to check for a property in a property list's skip list
USAGE
@ -1108,12 +1112,12 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static H5P_genprop_t *
H5P_find_prop_plist(H5P_genplist_t *plist, const char *name)
H5P_genprop_t *
H5P__find_prop_plist(H5P_genplist_t *plist, const char *name)
{
H5P_genprop_t *ret_value; /* Property pointer return value */
FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE
HDassert(plist);
HDassert(name);
@ -1147,7 +1151,7 @@ H5P_find_prop_plist(H5P_genplist_t *plist, const char *name)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5P_find_prop_plist() */
} /* H5P__find_prop_plist() */
/*--------------------------------------------------------------------------
@ -1448,11 +1452,11 @@ H5P_open_class_path_cb(void *_obj, hid_t UNUSED id, void *_key)
PURPOSE
Internal routine to create a new property list class.
USAGE
H5P_genclass_t H5P_create_class(par_class, name, internal,
H5P_genclass_t H5P_create_class(par_class, name, type,
cls_create, create_data, cls_close, close_data)
H5P_genclass_t *par_class; IN: Pointer to parent class
const char *name; IN: Name of class we are creating
hbool_t internal; IN: Whether this is an internal class or not
H5P_plist_type_t type; IN: Type of class we are creating
H5P_cls_create_func_t; IN: The callback function to call when each
property list in this class is created.
void *create_data; IN: Pointer to user data to pass along to class
@ -1476,7 +1480,7 @@ H5P_open_class_path_cb(void *_obj, hid_t UNUSED id, void *_key)
REVISION LOG
--------------------------------------------------------------------------*/
H5P_genclass_t *
H5P_create_class(H5P_genclass_t *par_class, const char *name, hbool_t internal,
H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type,
H5P_cls_create_func_t cls_create, void *create_data,
H5P_cls_copy_func_t cls_copy, void *copy_data,
H5P_cls_close_func_t cls_close, void *close_data)
@ -1489,7 +1493,7 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, hbool_t internal,
HDassert(name);
/* Allow internal classes to break some rules */
/* (This allows the root of the tree to be created with this routine -QAK) */
if(!internal)
if(type == H5P_TYPE_USER)
HDassert(par_class);
/* Allocate room for the class */
@ -1500,11 +1504,11 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, hbool_t internal,
pclass->parent = par_class;
if(NULL == (pclass->name = H5MM_xstrdup(name)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "propery list class name allocation failed")
pclass->type = type;
pclass->nprops = 0; /* Classes are created without properties initially */
pclass->plists = 0; /* No properties lists of this class yet */
pclass->classes = 0; /* No classes derived from this class yet */
pclass->ref_count = 1; /* This is the first reference to the new class */
pclass->internal = internal;
pclass->deleted = FALSE; /* Not deleted yet... :-) */
pclass->revision = H5P_GET_NEXT_REV; /* Get a revision number for the class */
@ -2141,7 +2145,7 @@ H5P_register(H5P_genclass_t **ppclass, const char *name, size_t size,
*/
if(pclass->plists > 0 || pclass->classes > 0) {
if(NULL == (new_class = H5P_create_class(pclass->parent, pclass->name,
pclass->internal, pclass->create_func, pclass->create_data,
pclass->type, pclass->create_func, pclass->create_data,
pclass->copy_func, pclass->copy_data,
pclass->close_func, pclass->close_data)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy class")
@ -2711,11 +2715,11 @@ H5P_get_size_plist(H5P_genplist_t *plist, const char *name, size_t *size)
HDassert(size);
/* Find property */
if((prop=H5P_find_prop_plist(plist,name)) == NULL)
if(NULL == (prop = H5P__find_prop_plist(plist, name)))
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist")
/* Get property size */
*size=prop->size;
*size = prop->size;
done:
FUNC_LEAVE_NOAPI(ret_value)
@ -3032,9 +3036,9 @@ H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2)
if(pclass1->ref_count < pclass2->ref_count) HGOTO_DONE(-1);
if(pclass1->ref_count > pclass2->ref_count) HGOTO_DONE(1);
/* Check whether they are internal or not */
if(pclass1->internal < pclass2->internal) HGOTO_DONE(-1);
if(pclass1->internal > pclass2->internal) HGOTO_DONE(1);
/* Check the property list types */
if(pclass1->type < pclass2->type) HGOTO_DONE(-1);
if(pclass1->type > pclass2->type) HGOTO_DONE(1);
/* Check whether they are deleted or not */
if(pclass1->deleted < pclass2->deleted) HGOTO_DONE(-1);
@ -3438,8 +3442,11 @@ H5P__iterate_plist_pclass_cb(void *_item, void *_key, void *_udata)
PURPOSE
Internal routine to iterate over the properties in a property list
USAGE
int H5P_iterate_plist(plist_id, idx, cb_func, iter_data)
hid_t plist_id; IN: ID of property list to iterate over
int H5P_iterate_plist(plist, iter_all_prop, idx, cb_func, iter_data)
const H5P_genplist_t *plist; IN: Property list to iterate over
hbool_t iter_all_prop; IN: Whether to iterate over all properties
(TRUE), or just non-default (i.e. changed)
properties (FALSE).
int *idx; IN/OUT: Index of the property to begin with
H5P_iterate_t cb_func; IN: Function pointer to function to be
called with each property iterated over.
@ -3484,10 +3491,10 @@ iteration, the function's behavior is undefined.
REVISION LOG
--------------------------------------------------------------------------*/
int
H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_int_t cb_func, void *udata)
H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx,
H5P_iterate_int_t cb_func, void *udata)
{
H5P_genclass_t *tclass; /* Temporary class pointer */
H5P_genplist_t *plist; /* Property list pointer */
H5P_iter_plist_ud_t udata_int; /* User data for skip list iterator */
H5SL_t *seen = NULL; /* Skip list to hold names of properties already seen */
int curr_idx = 0; /* Current iteration index */
@ -3495,13 +3502,11 @@ H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_int_t cb_func, void *uda
FUNC_ENTER_NOAPI_NOINIT
/* Sanity check */
HDassert(plist);
HDassert(idx);
HDassert(cb_func);
/* Get the property list object */
if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Create the skip list to hold names of properties already seen */
if(NULL == (seen = H5SL_create(H5SL_TYPE_STR, NULL)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't create skip list for seen properties")
@ -3520,17 +3525,20 @@ H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_int_t cb_func, void *uda
if(ret_value != 0)
HGOTO_DONE(ret_value);
/* Walk up the class hiearchy */
tclass = plist->pclass;
while(tclass != NULL) {
/* Iterate over properties in property list class */
ret_value = H5SL_iterate(tclass->props, H5P__iterate_plist_pclass_cb, &udata_int);
if(ret_value != 0)
HGOTO_DONE(ret_value);
/* Check for iterating over all properties, or just non-default ones */
if(iter_all_prop) {
/* Walk up the class hiearchy */
tclass = plist->pclass;
while(tclass != NULL) {
/* Iterate over properties in property list class */
ret_value = H5SL_iterate(tclass->props, H5P__iterate_plist_pclass_cb, &udata_int);
if(ret_value != 0)
HGOTO_DONE(ret_value);
/* Go up to parent class */
tclass = tclass->parent;
} /* end while */
/* Go up to parent class */
tclass = tclass->parent;
} /* end while */
} /* end if */
done:
/* Set the index we stopped at */
@ -3601,8 +3609,8 @@ done:
PURPOSE
Internal routine to iterate over the properties in a property class
USAGE
herr_t H5P_iterate_pclass(pclass_id, idx, cb_func, iter_data)
hid_t pclass_id; IN: ID of property class to iterate over
herr_t H5P_iterate_pclass(pclass, idx, cb_func, iter_data)
const H5P_genpclass_t *pclass; IN: Property list class to iterate over
int *idx; IN/OUT: Index of the property to begin with
H5P_iterate_t cb_func; IN: Function pointer to function to be
called with each property iterated over.
@ -3647,22 +3655,20 @@ iteration, the function's behavior is undefined.
REVISION LOG
--------------------------------------------------------------------------*/
int
H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_int_t cb_func, void *udata)
H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx,
H5P_iterate_int_t cb_func, void *udata)
{
H5P_genclass_t *pclass; /* Property list pointer */
H5P_iter_pclass_ud_t udata_int; /* User data for skip list iterator */
int curr_idx = 0; /* Current iteration index */
int ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity check */
HDassert(pclass);
HDassert(idx);
HDassert(cb_func);
/* Get the property list object */
if(NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class")
/* Set up iterator callback info */
udata_int.cb_func = cb_func;
udata_int.udata = udata;
@ -4190,13 +4196,13 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist")
/* If the property exists in the destination alread */
if(H5P_find_prop_plist(dst_plist,name)!=NULL) {
if(NULL != H5P__find_prop_plist(dst_plist, name)) {
/* Delete the property from the destination list, calling the 'close' callback if necessary */
if(H5P_remove(dst_id,dst_plist,name) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property")
/* Get the pointer to the source property */
prop=H5P_find_prop_plist(src_plist,name);
prop = H5P__find_prop_plist(src_plist, name);
/* Make a copy of the source property */
if((new_prop=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL)
@ -4218,7 +4224,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
/* If not, get the information required to do an H5Pinsert2 with the property into the destination list */
else {
/* Get the pointer to the source property */
prop = H5P_find_prop_plist(src_plist, name);
prop = H5P__find_prop_plist(src_plist, name);
/* Create property object from parameters */
if(NULL == (new_prop = H5P_create_prop(prop->name, prop->size, H5P_PROP_WITHIN_LIST, prop->value,

View File

@ -53,6 +53,7 @@
#define H5L_ACS_ELINK_PREFIX_DEF NULL /*default is no prefix */
#define H5L_ACS_ELINK_PREFIX_DEL H5P_lacc_elink_pref_del
#define H5L_ACS_ELINK_PREFIX_COPY H5P_lacc_elink_pref_copy
#define H5L_ACS_ELINK_PREFIX_CMP H5P_lacc_elink_pref_cmp
#define H5L_ACS_ELINK_PREFIX_CLOSE H5P_lacc_elink_pref_close
/* Definitions for setting fapl of external link access */
@ -70,6 +71,7 @@
#define H5L_ACS_ELINK_CB_SIZE sizeof(H5L_elink_cb_t)
#define H5L_ACS_ELINK_CB_DEF {NULL,NULL}
/******************/
/* Local Typedefs */
/******************/
@ -90,8 +92,8 @@ static herr_t H5P_lacc_reg_prop(H5P_genclass_t *pclass);
/* Property list callbacks */
static herr_t H5P_lacc_elink_pref_del(hid_t prop_id, const char* name, size_t size, void* value);
static herr_t H5P_lacc_elink_pref_copy(const char* name, size_t size, void* value);
static int H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t size);
static herr_t H5P_lacc_elink_pref_close(const char* name, size_t size, void* value);
static herr_t H5P_lacc_elink_fapl_del(hid_t prop_id, const char* name, size_t size, void* value);
static herr_t H5P_lacc_elink_fapl_copy(const char* name, size_t size, void* value);
static herr_t H5P_lacc_elink_fapl_close(const char* name, size_t size, void* value);
@ -104,6 +106,7 @@ static herr_t H5P_lacc_elink_fapl_close(const char* name, size_t size, void* val
/* Dataset creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_LACC[1] = {{
"link access", /* Class name for debugging */
H5P_TYPE_LINK_ACCESS, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_LINK_ACCESS_g, /* Pointer to class ID */
&H5P_LST_LINK_ACCESS_g, /* Pointer to default property list ID */
@ -162,7 +165,7 @@ H5P_lacc_reg_prop(H5P_genclass_t *pclass)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for external link prefix */
if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &elink_prefix, NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, NULL, H5L_ACS_ELINK_PREFIX_CLOSE) < 0)
if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &elink_prefix, NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, H5L_ACS_ELINK_PREFIX_CMP, H5L_ACS_ELINK_PREFIX_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register fapl for link access */
@ -341,6 +344,41 @@ H5P_lacc_elink_pref_copy(const char UNUSED *name, size_t UNUSED size, void *valu
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P_lacc_elink_pref_copy() */
/*-------------------------------------------------------------------------
* Function: H5P_lacc_elink_pref_cmp
*
* Purpose: Callback routine which is called whenever the elink prefix
* property in the dataset creation property list is
* compared.
*
* Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise.
*
* Programmer: Mohamad Chaarawi
* Thursday, November 3, 2011
*
*-------------------------------------------------------------------------
*/
static int
H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t UNUSED size)
{
const char *pref1 = *(const char **)value1;
const char *pref2 = *(const char **)value2;
int ret_value = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
if(NULL == pref1 && NULL != pref2)
HGOTO_DONE(1);
if(NULL != pref1 && NULL == pref2)
HGOTO_DONE(-1);
if(NULL != pref1 && NULL != pref2)
ret_value = HDstrcmp(pref1, pref2);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_lacc_elink_pref_cmp() */
/*-------------------------------------------------------------------------
* Function: H5P_lacc_elink_pref_close
@ -815,3 +853,4 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_elink_cb() */

View File

@ -75,6 +75,7 @@ static herr_t H5P_lcrt_reg_prop(H5P_genclass_t *pclass);
/* Link creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_LCRT[1] = {{
"link create", /* Class name for debugging */
H5P_TYPE_LINK_CREATE, /* Class type */
&H5P_CLS_STRING_CREATE_g, /* Parent class ID */
&H5P_CLS_LINK_CREATE_g, /* Pointer to class ID */
&H5P_LST_LINK_CREATE_g, /* Pointer to default property list ID */
@ -120,7 +121,7 @@ H5P_lcrt_reg_prop(H5P_genclass_t *pclass)
/* Register create intermediate groups property */
if(H5P_register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &intmd_group, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
FUNC_LEAVE_NOAPI(ret_value)

View File

@ -87,6 +87,7 @@ static int H5P_ocrt_pipeline_cmp(const void *value1, const void *value2, size_t
/* Object creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_OCRT[1] = {{
"object create", /* Class name for debugging */
H5P_TYPE_OBJECT_CREATE, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_OBJECT_CREATE_g, /* Pointer to class ID */
NULL, /* Pointer to default property list ID */
@ -137,15 +138,15 @@ H5P_ocrt_reg_prop(H5P_genclass_t *pclass)
/* Register max. compact attribute storage property */
if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &attr_max_compact, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register min. dense attribute storage property */
if(H5P_register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &attr_min_dense, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register object header flags property */
if(H5P_register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &ohdr_flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the pipeline property */
if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &pline, NULL, NULL, NULL, NULL, NULL, H5O_CRT_PIPELINE_CMP, NULL) < 0)

View File

@ -91,6 +91,7 @@ static int H5P_ocpy_merge_comm_dt_list_cmp(const void *value1, const void *value
/* Object copy property list class library initialization object */
const H5P_libclass_t H5P_CLS_OCPY[1] = {{
"object copy", /* Class name for debugging */
H5P_TYPE_OBJECT_COPY, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_OBJECT_COPY_g, /* Pointer to class ID */
&H5P_LST_OBJECT_COPY_g, /* Pointer to default property list ID */
@ -141,15 +142,15 @@ H5P_ocpy_reg_prop(H5P_genclass_t *pclass)
/* Register copy options property */
if(H5P_register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &ocpy_option, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register merge named dtype list property */
if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &merge_comm_dtype_list, NULL, NULL, NULL, NULL, NULL, H5O_CPY_MERGE_COMM_DT_LIST_CMP, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register property for callback when completing the search for a matching named datatype from the named dtype list */
if(H5P_register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &mcdt_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
FUNC_LEAVE_NOAPI(ret_value)

View File

@ -84,23 +84,23 @@ typedef struct H5P_genprop_t {
/* Define structure to hold class information */
struct H5P_genclass_t {
struct H5P_genclass_t *parent; /* Pointer to parent class */
char *name; /* Name of property list class */
size_t nprops; /* Number of properties in class */
char *name; /* Name of property list class */
H5P_plist_type_t type; /* Type of property */
size_t nprops; /* Number of properties in class */
unsigned plists; /* Number of property lists that have been created since the last modification to the class */
unsigned classes; /* Number of classes that have been derived since the last modification to the class */
unsigned ref_count; /* Number of oustanding ID's open on this class object */
hbool_t internal; /* Whether this class is internal to the library or not */
hbool_t deleted; /* Whether this class has been deleted and is waiting for dependent classes & proplists to close */
unsigned revision; /* Revision number of a particular class (global) */
H5SL_t *props; /* Skip list containing properties */
H5SL_t *props; /* Skip list containing properties */
/* Callback function pointers & info */
H5P_cls_create_func_t create_func; /* Function to call when a property list is created */
void *create_data; /* Pointer to user data to pass along to create callback */
H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */
void *copy_data; /* Pointer to user data to pass along to copy callback */
H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */
void *close_data; /* Pointer to user data to pass along to close callback */
void *create_data; /* Pointer to user data to pass along to create callback */
H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */
void *copy_data; /* Pointer to user data to pass along to copy callback */
H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */
void *close_data; /* Pointer to user data to pass along to close callback */
};
/* Define structure to hold property list information */
@ -123,6 +123,7 @@ typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass);
*/
typedef struct H5P_libclass_t {
const char *name; /* Class name */
H5P_plist_type_t type; /* Class type */
hid_t const * const par_class_id; /* Pointer to global parent class property list class ID */
hid_t * const class_id; /* Pointer to global property list class ID */
@ -152,7 +153,7 @@ typedef int (*H5P_iterate_int_t)(H5P_genprop_t *prop, void *udata);
/* Private functions, not part of the publicly documented API */
H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class,
const char *name, unsigned internal,
const char *name, H5P_plist_type_t type,
H5P_cls_create_func_t cls_create, void *create_data,
H5P_cls_copy_func_t cls_copy, void *copy_data,
H5P_cls_close_func_t cls_close, void *close_data);
@ -178,10 +179,10 @@ H5_DLL H5P_genclass_t *H5P_get_class(const H5P_genplist_t *plist);
H5_DLL herr_t H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops);
H5_DLL int H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2);
H5_DLL int H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2);
H5_DLL int H5P_iterate_plist(hid_t plist_id, int *idx, H5P_iterate_int_t iter_func,
void *iter_data);
H5_DLL int H5P_iterate_pclass(hid_t pclass_id, int *idx, H5P_iterate_int_t iter_func,
void *iter_data);
H5_DLL int H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop,
int *idx, H5P_iterate_int_t iter_func, void *iter_data);
H5_DLL int H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx,
H5P_iterate_int_t iter_func, void *iter_data);
H5_DLL herr_t H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name);
H5_DLL herr_t H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name);
H5_DLL herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name);
@ -192,6 +193,7 @@ H5_DLL herr_t H5P_close_class(void *_pclass);
H5_DLL herr_t H5P_get_filter(const H5Z_filter_info_t *filter,
unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[],
size_t namelen, char name[], unsigned *filter_config);
H5_DLL H5P_genprop_t *H5P__find_prop_plist(H5P_genplist_t *plist, const char *name);
/* Testing functions */
#ifdef H5P_TESTING

View File

@ -42,6 +42,27 @@
typedef struct H5P_genplist_t H5P_genplist_t;
typedef struct H5P_genclass_t H5P_genclass_t;
typedef enum H5P_plist_type_t {
H5P_TYPE_USER = 0,
H5P_TYPE_ROOT = 1,
H5P_TYPE_OBJECT_CREATE = 2,
H5P_TYPE_FILE_CREATE = 3,
H5P_TYPE_FILE_ACCESS = 4,
H5P_TYPE_DATASET_CREATE = 5,
H5P_TYPE_DATASET_ACCESS = 6,
H5P_TYPE_DATASET_XFER = 7,
H5P_TYPE_FILE_MOUNT = 8,
H5P_TYPE_GROUP_CREATE = 9,
H5P_TYPE_GROUP_ACCESS = 10,
H5P_TYPE_DATATYPE_CREATE = 11,
H5P_TYPE_DATATYPE_ACCESS = 12,
H5P_TYPE_STRING_CREATE = 13,
H5P_TYPE_ATTRIBUTE_CREATE = 14,
H5P_TYPE_OBJECT_COPY = 15,
H5P_TYPE_LINK_CREATE = 16,
H5P_TYPE_LINK_ACCESS = 17,
H5P_TYPE_MAX_TYPE
} H5P_plist_type_t;
/*****************************/
/* Library Private Variables */

View File

@ -73,6 +73,7 @@ static herr_t H5P_strcrt_reg_prop(H5P_genclass_t *pclass);
/* String creation property list class library initialization object */
const H5P_libclass_t H5P_CLS_STRCRT[1] = {{
"string create", /* Class name for debugging */
H5P_TYPE_STRING_CREATE, /* Class type */
&H5P_CLS_ROOT_g, /* Parent class ID */
&H5P_CLS_STRING_CREATE_g, /* Pointer to class ID */
NULL, /* Pointer to default property list ID */