[svn-r4584]

Purpose:
    Switch from old property list to new generic property list.
Description:
    Mainly changed H5Pcreat, H5Pclose, H5Pcopy.
Platforms tested:
    IRIX64 6.5, FreeBSD, SunOS 5.7.
This commit is contained in:
Raymond Lu 2001-11-02 14:46:36 -05:00
parent ec59e5f52a
commit 5122df335c
13 changed files with 107 additions and 510 deletions

View File

@ -2114,18 +2114,17 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
fprintf(out, "NULL"); fprintf(out, "NULL");
} }
} else { } else {
/* Before deleting the last of these old-style lists, convert */ hid_t pclass_id = va_arg (ap, hid_t);
/* this chunk of code to print the class of the property list */ char *class_name=NULL;
/* using the generic property list classes - QAK */
H5P_class_t_old plist_class = va_arg (ap, H5P_class_t_old); /* Get the class name and print it */
switch (plist_class) { if((class_name=H5Pget_class_name(pclass_id))!=NULL) {
case H5P_NO_CLASS_OLD: fprintf (out, class_name);
fprintf (out, "H5P_NO_CLASS"); H5MM_xfree(class_name);
break; } /* end if */
default: else {
fprintf (out, "%ld", (long)plist_class); fprintf (out, "%ld", (long)pclass_id);
break; } /* end else */
}
} }
break; break;

View File

@ -150,7 +150,7 @@ H5A_term_interface(void)
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
hid_t hid_t
H5Acreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, H5Acreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t plist_id) hid_t UNUSED plist_id)
{ {
H5G_entry_t *ent = NULL; H5G_entry_t *ent = NULL;
H5T_t *type = NULL; H5T_t *type = NULL;
@ -180,12 +180,6 @@ H5Acreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
NULL == (space = H5I_object(space_id))) { NULL == (space = H5I_object(space_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
} }
if (H5P_DEFAULT!=plist_id &&
(H5P_DATASET_CREATE != H5P_get_class(plist_id) ||
NULL == H5I_object(plist_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"not a dataset creation property list");
}
/* Go do the real work for attaching the attribute to the dataset */ /* Go do the real work for attaching the attribute to the dataset */
if ((ret_value=H5A_create(ent,name,type,space))<0) { if ((ret_value=H5A_create(ent,name,type,space))<0) {

View File

@ -252,7 +252,7 @@ H5D_init_interface(void)
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 default data transfer property list */ /* Register the default data transfer property list */
if ((H5P_LST_DATASET_XFER_g = H5Pcreate_list (H5P_CLS_DATASET_XFER_g))<0) if ((H5P_LST_DATASET_XFER_g = H5Pcreate (H5P_CLS_DATASET_XFER_g))<0)
HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register default property list"); HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register default property list");
/* =========Dataset Creation Property Class Initialization========== */ /* =========Dataset Creation Property Class Initialization========== */
@ -301,7 +301,7 @@ H5D_init_interface(void)
"can't insert property into class"); "can't insert property into class");
/* Register the default data transfer property list */ /* Register the default data transfer property list */
if ((H5P_LST_DATASET_CREATE_g = H5Pcreate_list (H5P_CLS_DATASET_CREATE_g))<0) if ((H5P_LST_DATASET_CREATE_g = H5Pcreate (H5P_CLS_DATASET_CREATE_g))<0)
HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register default property list"); HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register default property list");
done: done:
@ -982,7 +982,7 @@ H5Dget_create_plist(hid_t dset_id)
HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset");
} }
/* Copy the creation property list */ /* Copy the creation property list */
if((ret_value = H5P_copy_new(dset->dcpl_id)) < 0) { if((ret_value = H5Pcopy(dset->dcpl_id)) < 0) {
HRETURN_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, HRETURN_ERROR(H5E_DATASET, H5E_CANTGET, FAIL,
"unable to copy the creation property list"); "unable to copy the creation property list");
} }
@ -1291,7 +1291,7 @@ H5D_new(hid_t dcpl_id)
TRUE != H5Pisa_class(dcpl_id, H5P_DATASET_CREATE)) TRUE != H5Pisa_class(dcpl_id, H5P_DATASET_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not property list"); HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not property list");
ret_value->dcpl_id = H5P_copy_new(dcpl_id); ret_value->dcpl_id = H5Pcopy(dcpl_id);
ret_value->ent.header = HADDR_UNDEF; ret_value->ent.header = HADDR_UNDEF;
/* Success */ /* Success */
@ -1957,7 +1957,7 @@ H5D_close(H5D_t *dataset)
* can do if one of these fails, so we just continue. * can do if one of these fails, so we just continue.
*/ */
free_failed = (H5T_close(dataset->type) < 0 || free_failed = (H5T_close(dataset->type) < 0 ||
H5Pclose_list(dataset->dcpl_id) < 0); H5Pclose(dataset->dcpl_id) < 0);
/* Close the dataset object */ /* Close the dataset object */
H5O_close(&(dataset->ent)); H5O_close(&(dataset->ent));
@ -3654,7 +3654,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available"); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available");
/* Change to the custom memory allocation routines for reading VL data */ /* Change to the custom memory allocation routines for reading VL data */
if((vlen_bufsize.xfer_pid=H5Pcreate_list(H5P_DATASET_XFER))<0) if((vlen_bufsize.xfer_pid=H5Pcreate(H5P_DATASET_XFER))<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "no dataset xfer plists available"); HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "no dataset xfer plists available");
if(H5Pset_vlen_mem_manager(vlen_bufsize.xfer_pid,H5D_vlen_get_buf_size_alloc,&vlen_bufsize,NULL,NULL)<0) if(H5Pset_vlen_mem_manager(vlen_bufsize.xfer_pid,H5D_vlen_get_buf_size_alloc,&vlen_bufsize,NULL,NULL)<0)
@ -3681,7 +3681,7 @@ done:
if(vlen_bufsize.vl_tbuf!=NULL) if(vlen_bufsize.vl_tbuf!=NULL)
H5FL_BLK_FREE(vlen_vl_buf,vlen_bufsize.vl_tbuf); H5FL_BLK_FREE(vlen_vl_buf,vlen_bufsize.vl_tbuf);
if(vlen_bufsize.xfer_pid>0) if(vlen_bufsize.xfer_pid>0)
H5Pclose_list(vlen_bufsize.xfer_pid); H5Pclose(vlen_bufsize.xfer_pid);
FUNC_LEAVE(ret_value); FUNC_LEAVE(ret_value);
} /* end H5Dvlen_get_buf_size() */ } /* end H5Dvlen_get_buf_size() */

View File

@ -283,7 +283,7 @@ H5F_init_interface(void)
"can't insert property into class"); "can't insert property into class");
/* Register the default file creation property list */ /* Register the default file creation property list */
if((H5P_LST_FILE_CREATE_g = H5Pcreate_list(H5P_CLS_FILE_CREATE_g))<0) if((H5P_LST_FILE_CREATE_g = H5Pcreate(H5P_CLS_FILE_CREATE_g))<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL,
"can't insert property into class"); "can't insert property into class");
@ -381,7 +381,7 @@ H5F_init_interface(void)
/* Register the default file access property list */ /* Register the default file access property list */
if((H5P_LST_FILE_ACCESS_g = H5Pcreate_list(H5P_CLS_FILE_ACCESS_g))<0) if((H5P_LST_FILE_ACCESS_g = H5Pcreate(H5P_CLS_FILE_ACCESS_g))<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL,
"can't insert property into class"); "can't insert property into class");
@ -397,7 +397,7 @@ H5F_init_interface(void)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
"can't insert property into class"); "can't insert property into class");
/* Register the default file mount property list */ /* Register the default file mount property list */
if((H5P_LST_MOUNT_g = H5Pcreate_list(H5P_CLS_MOUNT_g))<0) if((H5P_LST_MOUNT_g = H5Pcreate(H5P_CLS_MOUNT_g))<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL,
"can't insert property into class"); "can't insert property into class");
@ -750,7 +750,7 @@ H5Fget_create_plist(hid_t file_id)
} }
/* Create the property list object to return */ /* Create the property list object to return */
if((ret_value=H5P_copy_new(file->shared->fcpl_id)) < 0) { if((ret_value=H5Pcopy(file->shared->fcpl_id)) < 0) {
HRETURN_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, HRETURN_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL,
"unable to copy file creation properties"); "unable to copy file creation properties");
} }
@ -784,7 +784,6 @@ hid_t
H5Fget_access_plist(hid_t file_id) H5Fget_access_plist(hid_t file_id)
{ {
H5F_t *f = NULL; H5F_t *f = NULL;
H5P_t *plist=NULL;
hid_t ret_value = FAIL; hid_t ret_value = FAIL;
FUNC_ENTER(H5Fget_access_plist, FAIL); FUNC_ENTER(H5Fget_access_plist, FAIL);
@ -796,7 +795,7 @@ H5Fget_access_plist(hid_t file_id)
} }
/* Make a copy of the default file access property list */ /* Make a copy of the default file access property list */
if((ret_value=H5P_copy_new(H5P_LST_FILE_ACCESS_g)) < 0) if((ret_value=H5Pcopy(H5P_LST_FILE_ACCESS_g)) < 0)
HRETURN_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, HRETURN_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL,
"can't copy file access property list"); "can't copy file access property list");
@ -1063,7 +1062,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id)
if(H5I_GENPROP_LST != H5I_get_type(fcpl_id) || if(H5I_GENPROP_LST != H5I_get_type(fcpl_id) ||
TRUE != H5Pisa_class(fcpl_id, H5P_FILE_CREATE)) TRUE != H5Pisa_class(fcpl_id, H5P_FILE_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not property list"); HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not property list");
f->shared->fcpl_id = H5P_copy_new(fcpl_id); f->shared->fcpl_id = H5Pcopy(fcpl_id);
if(H5P_DEFAULT == fapl_id) if(H5P_DEFAULT == fapl_id)
@ -1214,7 +1213,7 @@ H5F_dest(H5F_t *f)
if(H5I_GENPROP_LST != H5I_get_type(f->shared->fcpl_id)) if(H5I_GENPROP_LST != H5I_get_type(f->shared->fcpl_id))
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL,
"not a property list"); "not a property list");
if((ret_value=H5Pclose_list(f->shared->fcpl_id)) < 0) if((ret_value=H5Pclose(f->shared->fcpl_id)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL,
"can't close property list"); "can't close property list");

View File

@ -552,7 +552,6 @@ H5FD_dpss_read (H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t ad
globus_result_t globus_result; globus_result_t globus_result;
#ifdef COALESCE_READS #ifdef COALESCE_READS
static int count = 0; /* counter for single reads */ static int count = 0; /* counter for single reads */
H5F_xfer_t *xfer_parms; /*transfer property list*/
#endif #endif
FUNC_ENTER (H5FD_dpss_read, FAIL); FUNC_ENTER (H5FD_dpss_read, FAIL);
@ -579,15 +578,14 @@ H5FD_dpss_read (H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t ad
#ifdef COALESCE_READS #ifdef COALESCE_READS
/* Get the dataset transfer property list */ /* Get the dataset transfer property list */
if (H5P_DEFAULT == dxpl_id) { if (H5P_DEFAULT == dxpl_id) {
xfer_parms = &H5F_xfer_dflt; dxpl_id = H5P_DATASET_XFER_DEFAULT;
} else if (H5P_DATASET_XFER != H5P_get_class (dxpl_id) || if(H5I_GENPROP_LST != H5I_get_type(plist_id) ||
NULL == (xfer_parms = H5I_object (dxpl_id))) { TRUE!=H5Pisa_class(dxpl_id,H5P_DATASET_XFER))
HRETURN_ERROR (H5E_PLIST, H5E_BADTYPE, FAIL, "not a xfer"); HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get gather read");
}
if(!count || H5P_get(dxpl_id, H5D_XFER_GATHER_READS_NAME, &count) < 0)
HRETURN_ERROR(H5E_S, H5E_BADTYPE, FAIL, "not xfer parms");
if (xfer_parms->gather_reads) {
if (! count)
count = xfer_parms->gather_reads;
#ifdef DEBUG #ifdef DEBUG
fprintf (stdout, "H5FD_dpss_read: request would be queued\n"); fprintf (stdout, "H5FD_dpss_read: request would be queued\n");
#endif #endif

View File

@ -186,7 +186,7 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t memb_size, hid_t memb_fapl_id)
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"not a file access property list"); "not a file access property list");
if(H5P_DEFAULT != memb_fapl_id && if(H5P_DEFAULT != memb_fapl_id &&
TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS)) TRUE != H5Pisa_class(memb_fapl_id, H5P_FILE_ACCESS))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list"); HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list");
/* /*
@ -241,7 +241,7 @@ H5Pget_fapl_family(hid_t fapl_id, hsize_t *memb_size/*out*/,
if (NULL==(fa=H5Pget_driver_info(fapl_id))) if (NULL==(fa=H5Pget_driver_info(fapl_id)))
HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info");
if (memb_size) *memb_size = fa->memb_size; if (memb_size) *memb_size = fa->memb_size;
if (memb_fapl_id) *memb_fapl_id = H5P_copy_new(fa->memb_fapl_id); if (memb_fapl_id) *memb_fapl_id = H5Pcopy(fa->memb_fapl_id);
FUNC_LEAVE(SUCCEED); FUNC_LEAVE(SUCCEED);
} }
@ -845,7 +845,7 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si
if (H5P_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(dxpl_id)) { if (H5P_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(dxpl_id)) {
H5FD_family_dxpl_t *dx = H5Pget_driver_info(dxpl_id); H5FD_family_dxpl_t *dx = H5Pget_driver_info(dxpl_id);
assert(H5P_DATASET_XFER==H5Pget_class(dxpl_id)); assert(H5Pisa_class(dxpl_id, H5P_DATASET_XFER));
assert(dx); assert(dx);
memb_dxpl_id = dx->memb_dxpl_id; memb_dxpl_id = dx->memb_dxpl_id;
} }
@ -908,7 +908,7 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s
if (H5P_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(dxpl_id)) { if (H5P_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(dxpl_id)) {
H5FD_family_dxpl_t *dx = H5Pget_driver_info(dxpl_id); H5FD_family_dxpl_t *dx = H5Pget_driver_info(dxpl_id);
assert(H5P_DATASET_XFER==H5Pget_class(dxpl_id)); assert(H5Pisa_class(dxpl_id, H5P_DATASET_XFER));
assert(dx); assert(dx);
memb_dxpl_id = dx->memb_dxpl_id; memb_dxpl_id = dx->memb_dxpl_id;
} }

View File

@ -443,7 +443,7 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map,
* All members of MEMB_FAPL must be either defaults or actual file * All members of MEMB_FAPL must be either defaults or actual file
* access property lists. * access property lists.
*/ */
if (H5P_DEFAULT!=memb_fapl[mmt] && H5P_FILE_ACCESS!=H5Pget_class(memb_fapl[mmt])) if (H5P_DEFAULT!=memb_fapl[mmt] && TRUE!=H5Pisa_class(memb_fapl[mmt], H5P_FILE_ACCESS))
H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "file resource type incorrect", -1); H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "file resource type incorrect", -1);
/* All names must be defined */ /* All names must be defined */
@ -572,13 +572,13 @@ H5Pset_dxpl_multi(hid_t dxpl_id, const hid_t *memb_dxpl)
H5Eclear(); H5Eclear();
/* Check arguments */ /* Check arguments */
if (H5P_DATASET_XFER!=H5Pget_class(dxpl_id)) if (TRUE!=H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1); H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1);
if (!memb_dxpl) if (!memb_dxpl)
H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "invalid pointer", -1); H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "invalid pointer", -1);
for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=mt+1) { for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=mt+1) {
if (H5P_DEFAULT!=memb_dxpl[mt] && if (H5P_DEFAULT!=memb_dxpl[mt] &&
H5P_DATASET_XFER!=H5Pget_class(memb_dxpl[mt])) TRUE!=H5Pisa_class(memb_dxpl[mt], H5P_DATASET_XFER))
H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1); H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a data transfer property list", -1);
} }
@ -617,7 +617,7 @@ H5Pget_dxpl_multi(hid_t dxpl_id, hid_t *memb_dxpl/*out*/)
/* Clear the error stack */ /* Clear the error stack */
H5Eclear(); H5Eclear();
if (H5P_FILE_ACCESS!=H5Pget_class(dxpl_id)) if (TRUE!=H5Pisa_class(dxpl_id, H5P_DATASET_XFER))
H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1); H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1);
if (H5FD_MULTI!=H5Pget_driver(dxpl_id)) if (H5FD_MULTI!=H5Pget_driver(dxpl_id))
H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1); H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1);

View File

@ -235,8 +235,10 @@ H5Pset_fapl_sec2(hid_t fapl_id)
FUNC_ENTER(H5Pset_fapl_sec2, FAIL); FUNC_ENTER(H5Pset_fapl_sec2, FAIL);
H5TRACE1("e","i",fapl_id); H5TRACE1("e","i",fapl_id);
if (H5P_FILE_ACCESS!=H5Pget_class(fapl_id)) if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl"); TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"not a file access property list");
ret_value= H5Pset_driver(fapl_id, H5FD_SEC2, NULL); ret_value= H5Pset_driver(fapl_id, H5FD_SEC2, NULL);

View File

@ -269,7 +269,7 @@ herr_t H5Pset_fapl_stream (hid_t fapl_id, H5FD_stream_fapl_t *fapl)
FUNC_ENTER (H5Pset_fapl_stream, FAIL); FUNC_ENTER (H5Pset_fapl_stream, FAIL);
H5TRACE2 ("e", "ix", fapl_id, fapl); H5TRACE2 ("e", "ix", fapl_id, fapl);
if (H5P_FILE_ACCESS != H5Pget_class (fapl_id)) if ( TRUE!=H5Pisa_class(fapl_id, H5P_FILE_ACCESS) )
{ {
HRETURN_ERROR (H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl"); HRETURN_ERROR (H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl");
} }
@ -322,7 +322,7 @@ herr_t H5Pget_fapl_stream(hid_t fapl_id, H5FD_stream_fapl_t *fapl /* out */)
FUNC_ENTER (H5Pget_fapl_stream, FAIL); FUNC_ENTER (H5Pget_fapl_stream, FAIL);
H5TRACE2("e","ix",fapl_id,fapl); H5TRACE2("e","ix",fapl_id,fapl);
if (H5P_FILE_ACCESS != H5Pget_class (fapl_id)) if (TRUE!=H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
{ {
HRETURN_ERROR (H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl"); HRETURN_ERROR (H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl");
} }

474
src/H5P.c
View File

@ -34,11 +34,6 @@ static int interface_initialize_g = 0;
#define INTERFACE_INIT H5P_init_interface #define INTERFACE_INIT H5P_init_interface
static herr_t H5P_init_interface(void); static herr_t H5P_init_interface(void);
/* hid_t aliases for old H5P_class_t enum values */
/* These go away as each old-style property list is converted to a generic */
/* property list -QAK */
hid_t H5P_NO_CLASS=(hid_t)H5P_NO_CLASS_OLD;
/* /*
* Predefined property list classes. These are initialized at runtime by * Predefined property list classes. These are initialized at runtime by
* H5P_init_interface() in this source file. * H5P_init_interface() in this source file.
@ -67,7 +62,7 @@ static H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class,
H5P_cls_create_func_t cls_create, void *create_data, H5P_cls_create_func_t cls_create, void *create_data,
H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_copy_func_t cls_copy, void *copy_data,
H5P_cls_close_func_t cls_close, void *close_data); H5P_cls_close_func_t cls_close, void *close_data);
static herr_t H5P_close_list(void *_plist); static herr_t H5P_close(void *_plist);
static herr_t H5P_close_class(void *_pclass); static herr_t H5P_close_class(void *_pclass);
static herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name); static herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name);
static H5P_genprop_t *H5P_dup_prop(H5P_genprop_t *oprop); static H5P_genprop_t *H5P_dup_prop(H5P_genprop_t *oprop);
@ -75,9 +70,6 @@ static herr_t H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod);
static herr_t H5P_add_prop(H5P_genprop_t *hash[], unsigned hashsize, H5P_genprop_t *prop); static herr_t H5P_add_prop(H5P_genprop_t *hash[], unsigned hashsize, H5P_genprop_t *prop);
static herr_t H5P_free_prop(H5P_genprop_t *prop); static herr_t H5P_free_prop(H5P_genprop_t *prop);
/* Declare a free list to manage the H5P_t struct */
H5FL_DEFINE_STATIC(H5P_t);
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* Function: H5P_init * Function: H5P_init
@ -172,20 +164,6 @@ H5P_init_interface(void)
FUNC_ENTER(H5P_init_interface, FAIL); FUNC_ENTER(H5P_init_interface, FAIL);
assert(H5P_NCLASSES_OLD <= H5I_TEMPLATE_MAX - H5I_TEMPLATE_0);
/*
* Initialize the mappings between property list classes and atom
* groups. We keep the two separate because property list classes are
* publicly visible but atom groups aren't.
*/
for (i = 0; i < H5P_NCLASSES_OLD; i++) {
status = H5I_init_group((H5I_type_t)(H5I_TEMPLATE_0 +i),
H5I_TEMPID_HASHSIZE, 0, (H5I_free_t)H5P_close);
if (status < 0)
ret_value = FAIL;
}
if (ret_value < 0) { if (ret_value < 0) {
HRETURN_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, HRETURN_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL,
"unable to initialize atom group"); "unable to initialize atom group");
@ -196,7 +174,7 @@ H5P_init_interface(void)
*/ */
if (H5I_init_group(H5I_GENPROP_CLS, H5I_GENPROPCLS_HASHSIZE, 0, (H5I_free_t)H5P_close_class) < 0) if (H5I_init_group(H5I_GENPROP_CLS, H5I_GENPROPCLS_HASHSIZE, 0, (H5I_free_t)H5P_close_class) < 0)
HRETURN_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize atom group"); HRETURN_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize atom group");
if (H5I_init_group(H5I_GENPROP_LST, H5I_GENPROPOBJ_HASHSIZE, 0, (H5I_free_t)H5P_close_list) < 0) if (H5I_init_group(H5I_GENPROP_LST, H5I_GENPROPOBJ_HASHSIZE, 0, (H5I_free_t)H5P_close) < 0)
HRETURN_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize atom group"); HRETURN_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize atom group");
/* Create root property list class */ /* Create root property list class */
@ -283,24 +261,14 @@ H5P_term_interface(void)
/* Destroy HDF5 library property classes & lists */ /* Destroy HDF5 library property classes & lists */
/* Check if there are any open property list classes or lists */ /* Check if there are any open property list classes or lists */
for (i=0; i<H5P_NCLASSES_OLD; i++)
n += H5I_nmembers((H5I_type_t)(H5I_TEMPLATE_0+i));
n += H5I_nmembers(H5I_GENPROP_CLS); n += H5I_nmembers(H5I_GENPROP_CLS);
n += H5I_nmembers(H5I_GENPROP_LST); n += H5I_nmembers(H5I_GENPROP_LST);
/* If there are any open classes or groups, attempt to get rid of them. */ /* If there are any open classes or groups, attempt to get rid of them. */
if (n) { if (n) {
for (i=0; i<H5P_NCLASSES_OLD; i++)
H5I_clear_group((H5I_type_t)(H5I_TEMPLATE_0+i), FALSE);
H5I_clear_group(H5I_GENPROP_CLS, FALSE); H5I_clear_group(H5I_GENPROP_CLS, FALSE);
H5I_clear_group(H5I_GENPROP_LST, FALSE); H5I_clear_group(H5I_GENPROP_LST, FALSE);
} else { } else {
/* Close the ID groups which hold the property list classes & lists */
for (i=0; i<H5P_NCLASSES_OLD; i++) {
H5I_destroy_group((H5I_type_t)(H5I_TEMPLATE_0 + i));
n++; /*H5I*/
}
H5I_destroy_group(H5I_GENPROP_CLS); H5I_destroy_group(H5I_GENPROP_CLS);
n++; /*H5I*/ n++; /*H5I*/
H5I_destroy_group(H5I_GENPROP_LST); H5I_destroy_group(H5I_GENPROP_LST);
@ -312,235 +280,6 @@ H5P_term_interface(void)
return n; return n;
} }
/*-------------------------------------------------------------------------
* Function: H5Pcreate
*
* Purpose: Creates a new property list by copying a default property
* list.
*
* Return: Success: A new copy of a default property list.
*
* Failure: NULL
*
* Programmer: Unknown
*
* Modifications:
* Robb Matzke, 1999-08-18
* Rewritten in terms of H5P_copy() to fix memory leaks.
*-------------------------------------------------------------------------
*/
hid_t
H5Pcreate(hid_t type)
{
hid_t ret_value = FAIL;
const void *src = NULL;
H5P_t *new_plist = NULL;
H5P_class_t_old old_type;
FUNC_ENTER(H5Pcreate, FAIL);
H5TRACE1("i","i",type);
/* Kludge to detect generic property creations and divert them to the */
/* generic property list creation routine - QAK */
if (H5I_GENPROP_CLS == H5I_get_type(type)) {
if((ret_value=H5Pcreate_list(type))<0)
HRETURN_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list");
} /* end if */
FUNC_LEAVE(ret_value);
}
/*-------------------------------------------------------------------------
* Function: H5P_create
*
* Purpose: Given a pointer to some property list struct, atomize the
* property list and return its ID. The property list memory is
* not copied, so the caller should not free it; it will be
* freed by H5P_release().
*
* Return: Success: A new property list ID.
*
* Failure: Negative
*
* Programmer: Robb Matzke
* Wednesday, December 3, 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
hid_t
H5P_create(H5P_class_t_old type, H5P_t *plist)
{
hid_t ret_value = FAIL;
FUNC_ENTER(H5P_create, FAIL);
/* check args */
assert(type >= 0 && type < H5P_NCLASSES_OLD);
assert(plist);
/* Atomize the new property list */
if ((ret_value=H5I_register((H5I_type_t)(H5I_TEMPLATE_0+type), plist))<0) {
HRETURN_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL,
"unable to register property list");
}
FUNC_LEAVE(ret_value);
}
/*-------------------------------------------------------------------------
* Function: H5Pclose
*
* Purpose: Release access to a property list object, PLIST_ID.
*
* Return: Success: non-negative
*
* Failure: negative
*
* Programmer: Unknown
*
* Modifications:
* Robb Matzke, 1999-08-03
* Attempting to close H5P_DEFAULT is no longer an error, but
* rather a no-op.
*-------------------------------------------------------------------------
*/
herr_t
H5Pclose(hid_t plist_id)
{
FUNC_ENTER(H5Pclose, FAIL);
H5TRACE1("e","i",plist_id);
/* Check arguments */
if (plist_id==H5P_DEFAULT)
HRETURN(SUCCEED);
/* Kludge to detect generic property creations and divert them to the */
/* generic property list creation routine - QAK */
if (H5I_GENPROP_LST == H5I_get_type(plist_id)) {
if(H5Pclose_list(plist_id)<0)
HRETURN_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to close property list");
} /* end if */
else {
if (H5P_get_class (plist_id)<0) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
}
/* When the reference count reaches zero the resources are freed */
if (H5I_dec_ref(plist_id) < 0)
HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing property list");
} /* end else */
FUNC_LEAVE (SUCCEED);
}
/*-------------------------------------------------------------------------
* Function: H5P_close
*
* Purpose: Closes a property list and frees the memory associated with
* the property list.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Wednesday, February 18, 1998
*
* Modifications:
* Robb Matzke, 1999-08-03
* Modified to work with the virtual file layer.
*
* Raymond Lu, 2001-10-02
* Took out case H5P_DATASET_CREATE for generic property list.
*
*-------------------------------------------------------------------------
*/
herr_t
H5P_close(void *_plist)
{
H5P_t *plist=(H5P_t *)_plist;
FUNC_ENTER (H5P_close, FAIL);
/* Check args */
if (!plist)
HRETURN (SUCCEED);
/* Return the property list to the free list */
H5FL_FREE(H5P_t,plist);
FUNC_LEAVE(SUCCEED);
}
/*-------------------------------------------------------------------------
* Function: H5Pget_class
*
* Purpose: Returns the class identifier for a property list.
*
* Return: Success: A property list class
*
* Failure: H5P_NO_CLASS (-1)
*
* Programmer: Robb Matzke
* Wednesday, December 3, 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
hid_t
H5Pget_class(hid_t plist_id)
{
hid_t ret_value = H5P_NO_CLASS;
FUNC_ENTER(H5Pget_class, H5P_NO_CLASS);
H5TRACE1("i","i",plist_id);
ret_value = H5P_get_class(plist_id);
FUNC_LEAVE(ret_value);
}
/*-------------------------------------------------------------------------
* Function: H5P_get_class
*
* Purpose: Internal function for getting the property list class.
*
* Return: Success: A property list class
*
* Failure: H5P_NO_CLASS (-1)
*
* Programmer: Robb Matzke
* Tuesday, July 7, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
H5P_class_t_old
H5P_get_class(hid_t plist_id)
{
H5I_type_t group;
H5P_class_t_old ret_value = H5P_NO_CLASS;
FUNC_ENTER(H5P_get_class, H5P_NO_CLASS_OLD);
if ((group = H5I_get_type(plist_id)) < 0 ||
group >= H5I_TEMPLATE_MAX ||
group < H5I_TEMPLATE_0) {
HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, H5P_NO_CLASS,
"not a property list");
}
ret_value = (H5P_class_t_old)(group - H5I_TEMPLATE_0);
FUNC_LEAVE(ret_value);
}
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
NAME NAME
@ -626,12 +365,11 @@ done:
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
NAME NAME
H5P_copy_plist H5P_copy
PURPOSE PURPOSE
Internal routine to copy a generic property lists Internal routine to copy a generic property lists
USAGE USAGE
hid_t H5P_copy_plist(old_plist, old_plist_id) hid_t H5P_copy(old_plist_id)
H5P_genplist_t *old_plist; IN: Property list to copy
hid_t old_plist_id; IN: Property list ID to copy hid_t old_plist_id; IN: Property list ID to copy
RETURNS RETURNS
Success: valid property list ID on success (non-negative) Success: valid property list ID on success (non-negative)
@ -646,17 +384,20 @@ done:
EXAMPLES EXAMPLES
REVISION LOG REVISION LOG
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
static hid_t H5P_copy_plist(H5P_genplist_t *old_plist, hid_t old_plist_id) hid_t H5P_copy(hid_t old_plist_id)
{ {
H5P_genplist_t *new_plist; /* New property list generated from copy */ H5P_genplist_t *new_plist; /* New property list generated from copy */
H5P_genplist_t *old_plist;
H5P_genprop_t *tprop; /* Temporary pointer to properties */ H5P_genprop_t *tprop; /* Temporary pointer to properties */
H5P_genprop_t *new_prop; /* New property created for copy */ H5P_genprop_t *new_prop; /* New property created for copy */
hid_t new_plist_id; /* Property list ID of new list created */ hid_t new_plist_id; /* Property list ID of new list created */
unsigned u; /* Local index variable */ unsigned u; /* Local index variable */
hid_t ret_value=FAIL; /* return value */ hid_t ret_value=FAIL; /* return value */
FUNC_ENTER (H5P_copy_plist, FAIL); FUNC_ENTER (H5P_copy, FAIL);
if(NULL == (old_plist = (H5P_genplist_t*)H5I_object(old_plist_id)))
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist");
assert(old_plist); assert(old_plist);
/* /*
@ -730,19 +471,19 @@ static hid_t H5P_copy_plist(H5P_genplist_t *old_plist, hid_t old_plist_id)
done: done:
if (ret_value<0 && new_plist) if (ret_value<0 && new_plist)
H5P_close_list(new_plist); H5P_close(new_plist);
FUNC_LEAVE (ret_value); FUNC_LEAVE (ret_value);
} /* H5P_copy_plist() */ } /* H5P_copy() */
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
NAME NAME
H5P_copy_new H5Pcopy
PURPOSE PURPOSE
Routine to copy a property list or class Routine to copy a property list or class
USAGE USAGE
hid_t H5P_copy_new(id) hid_t H5Pcopy(id)
hid_t id; IN: Property list or class ID to copy hid_t id; IN: Property list or class ID to copy
RETURNS RETURNS
Success: valid property list ID on success (non-negative) Success: valid property list ID on success (non-negative)
@ -757,12 +498,15 @@ done:
EXAMPLES EXAMPLES
REVISION LOG REVISION LOG
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
hid_t H5P_copy_new(hid_t id) 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 */ hid_t ret_value=FALSE; /* return value */
FUNC_ENTER (H5P_copy_new, FAIL); FUNC_ENTER (H5Pcopy, FAIL);
if (H5P_DEFAULT==id)
HRETURN(H5P_DEFAULT);
/* Check arguments. */ /* Check arguments. */
if (H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id)) if (H5I_GENPROP_LST != H5I_get_type(id) && H5I_GENPROP_CLS != H5I_get_type(id))
@ -772,7 +516,7 @@ hid_t H5P_copy_new(hid_t id)
/* Compare property lists */ /* Compare property lists */
if(H5I_GENPROP_LST == H5I_get_type(id)) { if(H5I_GENPROP_LST == H5I_get_type(id)) {
if((ret_value=H5P_copy_plist(obj, id))<0) if((ret_value=H5P_copy(id))<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property list"); HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property list");
} /* end if */ } /* end if */
/* Must be property classes */ /* Must be property classes */
@ -783,126 +527,7 @@ hid_t H5P_copy_new(hid_t id)
done: done:
FUNC_LEAVE (ret_value); FUNC_LEAVE (ret_value);
} /* H5P_copy_new() */ } /* H5Pcopy() */
/*-------------------------------------------------------------------------
* Function: H5Pcopy
*
* Purpose: Deep-copies a property list PLIST_ID.
*
* Return: Success: The ID of the new copy of the property list.
* The ID will be different than the input ID
* since the new ID refers to a completely
* separate copy of the the structure that the
* original ID points to.
*
* Failure: Negative
*
* Programmer: Unknown
*
* Modifications:
* Robb Matzke, 1999-08-03
* If PLIST_ID is H5P_DEFAULT then we return H5P_DEFAULT.
*-------------------------------------------------------------------------
*/
hid_t
H5Pcopy(hid_t plist_id)
{
const void *plist = NULL;
void *new_plist = NULL;
H5P_class_t_old type;
hid_t ret_value = FAIL;
H5I_type_t group;
FUNC_ENTER(H5Pcopy, FAIL);
H5TRACE1("i","i",plist_id);
if (H5P_DEFAULT==plist_id)
HRETURN(H5P_DEFAULT);
/* Check args */
if ((group = H5I_get_type(plist_id)) < 0)
HRETURN_ERROR(H5E_ATOM, H5E_BADTYPE, FAIL,
"unable to retrieve ID type");
/* Copy generic property lists and classes in new way */
if(group==H5I_GENPROP_CLS || group==H5I_GENPROP_LST) {
/* Copy it */
if ((ret_value=H5P_copy_new (plist_id))<0)
HRETURN_ERROR (H5E_INTERNAL, H5E_CANTINIT, FAIL,
"unable to copy property list");
} /* end if */
/* Use old way to copy old-style property lists */
else {
/* Further arg checking... */
if (NULL == (plist = H5I_object(plist_id)))
HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL,
"unable to unatomize property list");
if ((type = H5P_get_class(plist_id)) < 0)
HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL,
"unable to retrieve property list type");
/* Copy it */
if (NULL==(new_plist=H5P_copy (type, plist)))
HRETURN_ERROR (H5E_INTERNAL, H5E_CANTINIT, FAIL,
"unable to copy property list");
/* Register the atom for the new property list */
if ((ret_value = H5I_register(group, new_plist)) < 0) {
HRETURN_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL,
"unable to atomize property list pointer");
}
} /* end else */
FUNC_LEAVE(ret_value);
}
/*-------------------------------------------------------------------------
* Function: H5P_copy
*
* Purpose: Creates a new property list and initializes it with some
* other property list.
*
* Return: Success: Ptr to new property list
*
* Failure: NULL
*
* Programmer: Robb Matzke
* Tuesday, February 3, 1998
*
* Modifications:
* Robb Matzke, 1999-08-03
* Modified to use the virtual file layer.
*
* Raymond Lu, 2001-10-02
* Took out case H5P_DATASET_CREATE for generic property list.
*
*-------------------------------------------------------------------------
*/
void *
H5P_copy (H5P_class_t_old type, const void *src)
{
size_t size;
H5P_t *dst = NULL;
FUNC_ENTER (H5P_copy, NULL);
/* Create the new property list */
if (NULL==(dst = H5FL_ALLOC(H5P_t,0))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
/* Copy into new object */
HDmemcpy(dst, src, size);
/* Set the type of the property list */
dst->cls=type;
FUNC_LEAVE (dst);
}
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
@ -4194,11 +3819,11 @@ done:
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
NAME NAME
H5P_create_list H5P_create
PURPOSE PURPOSE
Internal routine to create a new property list of a property list class. Internal routine to create a new property list of a property list class.
USAGE USAGE
H5P_genplist_t *H5P_create_list(class) H5P_genplist_t *H5P_create(class)
H5P_genclass_t *class; IN: Property list class create list from H5P_genclass_t *class; IN: Property list class create list from
RETURNS RETURNS
Returns a pointer to the newly created property list on success, Returns a pointer to the newly created property list on success,
@ -4217,7 +3842,7 @@ done:
EXAMPLES EXAMPLES
REVISION LOG REVISION LOG
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
static H5P_genplist_t *H5P_create_list(H5P_genclass_t *pclass) static H5P_genplist_t *H5P_create(H5P_genclass_t *pclass)
{ {
H5P_genclass_t *tclass=NULL; /* Temporary class pointer */ H5P_genclass_t *tclass=NULL; /* Temporary class pointer */
H5P_genplist_t *plist=NULL; /* New property list created */ H5P_genplist_t *plist=NULL; /* New property list created */
@ -4226,7 +3851,7 @@ static H5P_genplist_t *H5P_create_list(H5P_genclass_t *pclass)
H5P_genprop_t *pcopy; /* Copy of property to insert into class */ H5P_genprop_t *pcopy; /* Copy of property to insert into class */
unsigned u; /* Local index variable */ unsigned u; /* Local index variable */
FUNC_ENTER (H5P_create_list, NULL); FUNC_ENTER (H5P_create, NULL);
assert(pclass); assert(pclass);
@ -4320,16 +3945,16 @@ done:
} /* end if */ } /* end if */
FUNC_LEAVE (ret_value); FUNC_LEAVE (ret_value);
} /* H5P_create_list() */ } /* H5P_create() */
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
NAME NAME
H5Pcreate_list H5Pcreate
PURPOSE PURPOSE
Routine to create a new property list of a property list class. Routine to create a new property list of a property list class.
USAGE USAGE
hid_t H5Pcreate_list(cls_id) hid_t H5Pcreate(cls_id)
hid_t cls_id; IN: Property list class create list from hid_t cls_id; IN: Property list class create list from
RETURNS RETURNS
Returns a valid property list ID on success, FAIL on failure. Returns a valid property list ID on success, FAIL on failure.
@ -4345,21 +3970,21 @@ done:
EXAMPLES EXAMPLES
REVISION LOG REVISION LOG
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
hid_t H5Pcreate_list(hid_t cls_id) hid_t H5Pcreate(hid_t cls_id)
{ {
H5P_genclass_t *pclass; /* Property list class to modify */ H5P_genclass_t *pclass; /* Property list class to modify */
H5P_genplist_t *plist=NULL; /* Property list created */ H5P_genplist_t *plist=NULL; /* Property list created */
hid_t plist_id=FAIL; /* Property list ID */ hid_t plist_id=FAIL; /* Property list ID */
hid_t ret_value=FAIL; /* return value */ hid_t ret_value=FAIL; /* return value */
FUNC_ENTER (H5Pcreate_list, FAIL); FUNC_ENTER (H5Pcreate, FAIL);
/* Check arguments. */ /* Check arguments. */
if (H5I_GENPROP_CLS != H5I_get_type(cls_id) || NULL == (pclass = H5I_object(cls_id))) if (H5I_GENPROP_CLS != H5I_get_type(cls_id) || NULL == (pclass = H5I_object(cls_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class"); HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class");
/* Create the new property list */ /* Create the new property list */
if ((plist=H5P_create_list(pclass))==NULL) if ((plist=H5P_create(pclass))==NULL)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list"); HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list");
/* Get an atom for the property list */ /* Get an atom for the property list */
@ -4386,10 +4011,10 @@ hid_t H5Pcreate_list(hid_t cls_id)
done: done:
if (ret_value<0 && plist) if (ret_value<0 && plist)
H5P_close_list(plist); H5P_close(plist);
FUNC_LEAVE (ret_value); FUNC_LEAVE (ret_value);
} /* H5Pcreate_list() */ } /* H5Pcreate() */
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
@ -5500,7 +5125,7 @@ done:
EXAMPLES EXAMPLES
REVISION LOG REVISION LOG
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
static H5P_genclass_t *H5P_get_class_new(H5P_genplist_t *plist) static H5P_genclass_t *H5P_get_class(H5P_genplist_t *plist)
{ {
H5P_genclass_t *ret_value=NULL; /* return value */ H5P_genclass_t *ret_value=NULL; /* return value */
@ -5535,7 +5160,7 @@ static H5P_genclass_t *H5P_get_class_new(H5P_genplist_t *plist)
EXAMPLES EXAMPLES
REVISION LOG REVISION LOG
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
hid_t H5Pget_class_new(hid_t plist_id) hid_t H5Pget_class(hid_t plist_id)
{ {
H5P_genplist_t *plist; /* Property list to query */ H5P_genplist_t *plist; /* Property list to query */
H5P_genclass_t *pclass=NULL; /* Property list class */ H5P_genclass_t *pclass=NULL; /* Property list class */
@ -5548,7 +5173,7 @@ hid_t H5Pget_class_new(hid_t plist_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
/* Retrieve the property list class */ /* Retrieve the property list class */
if ((pclass=H5P_get_class_new(plist))==NULL) if ((pclass=H5P_get_class(plist))==NULL)
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to query class of property list"); HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to query class of property list");
/* Increment the outstanding references to the class object */ /* Increment the outstanding references to the class object */
@ -5564,7 +5189,7 @@ done:
H5P_close_class(pclass); H5P_close_class(pclass);
FUNC_LEAVE (ret_value); FUNC_LEAVE (ret_value);
} /* H5Pget_class_name() */ } /* H5Pget_class() */
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
@ -6099,7 +5724,7 @@ htri_t H5Pisa_class(hid_t plist_id, hid_t pclass_id)
H5P_genclass_t *pclass=NULL; /* Property list class */ H5P_genclass_t *pclass=NULL; /* Property list class */
htri_t ret_value=FAIL; /* return value */ htri_t ret_value=FAIL; /* return value */
FUNC_ENTER (H5Pget_class, FAIL); FUNC_ENTER (H5Pisa_class, FAIL);
/* Check arguments. */ /* Check arguments. */
if (H5I_GENPROP_LST != H5I_get_type(plist_id) || NULL == (plist = H5I_object(plist_id))) if (H5I_GENPROP_LST != H5I_get_type(plist_id) || NULL == (plist = H5I_object(plist_id)))
@ -7298,11 +6923,11 @@ done:
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
NAME NAME
H5P_close_list H5P_close
PURPOSE PURPOSE
Internal routine to close a property list. Internal routine to close a property list.
USAGE USAGE
herr_t H5P_close_list(plist) herr_t H5P_close(plist)
H5P_genplist_t *plist; IN: Property list to close H5P_genplist_t *plist; IN: Property list to close
RETURNS RETURNS
Returns non-negative on success, negative on failure. Returns non-negative on success, negative on failure.
@ -7320,12 +6945,12 @@ done:
EXAMPLES EXAMPLES
REVISION LOG REVISION LOG
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
static herr_t H5P_close_list(void *_plist) static herr_t H5P_close(void *_plist)
{ {
H5P_genplist_t *plist=(H5P_genplist_t *)_plist; H5P_genplist_t *plist=(H5P_genplist_t *)_plist;
herr_t ret_value=FAIL; /* return value */ herr_t ret_value=FAIL; /* return value */
FUNC_ENTER (H5P_close_list, FAIL); FUNC_ENTER (H5P_close, FAIL);
assert(plist); assert(plist);
@ -7349,16 +6974,16 @@ static herr_t H5P_close_list(void *_plist)
done: done:
FUNC_LEAVE (ret_value); FUNC_LEAVE (ret_value);
} /* H5P_close_list() */ } /* H5P_close() */
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
NAME NAME
H5Pclose_list H5Pclose
PURPOSE PURPOSE
Routine to close a property list. Routine to close a property list.
USAGE USAGE
herr_t H5Pclose_list(plist_id) herr_t H5Pclose(plist_id)
hid_t plist_id; IN: Property list to close hid_t plist_id; IN: Property list to close
RETURNS RETURNS
Returns non-negative on success, negative on failure. Returns non-negative on success, negative on failure.
@ -7373,19 +6998,22 @@ done:
EXAMPLES EXAMPLES
REVISION LOG REVISION LOG
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
herr_t H5Pclose_list(hid_t plist_id) herr_t H5Pclose(hid_t plist_id)
{ {
H5P_genplist_t *plist; /* Property list created */ H5P_genplist_t *plist; /* Property list created */
herr_t ret_value=FAIL; /* return value */ herr_t ret_value=FAIL; /* return value */
FUNC_ENTER (H5Pclose_list, FAIL); FUNC_ENTER (H5Pclose, FAIL);
if (plist_id==H5P_DEFAULT)
HRETURN(SUCCEED);
/* Check arguments. */ /* Check arguments. */
if (H5I_GENPROP_LST != H5I_get_type(plist_id) || NULL == (plist = H5I_object(plist_id))) if (H5I_GENPROP_LST != H5I_get_type(plist_id) || NULL == (plist = H5I_object(plist_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
/* Close the property list */ /* Close the property list */
if ((ret_value=H5P_close_list(plist)) < 0) if ((ret_value=H5P_close(plist)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close"); HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close");
/* Remove the property list from the ID manager now */ /* Remove the property list from the ID manager now */
@ -7394,7 +7022,7 @@ herr_t H5Pclose_list(hid_t plist_id)
done: done:
FUNC_LEAVE (ret_value); FUNC_LEAVE (ret_value);
} /* H5Pclose_list() */ } /* H5Pclose() */
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------

View File

@ -90,23 +90,15 @@ typedef struct H5P_genplist_tag {
H5P_genprop_t *props[1]; /* Hash table of pointers to properties in the list */ H5P_genprop_t *props[1]; /* Hash table of pointers to properties in the list */
} H5P_genplist_t; } H5P_genplist_t;
typedef struct {
H5P_class_t cls;
} H5P_t;
/* Private functions, not part of the publicly documented API */ /* Private functions, not part of the publicly documented API */
__DLL__ herr_t H5P_init(void); __DLL__ herr_t H5P_init(void);
__DLL__ hid_t H5P_create(H5P_class_t_old type, H5P_t *plist); __DLL__ hid_t H5P_copy(hid_t old_plist_id);
__DLL__ void *H5P_copy(H5P_class_t_old type, const void *src);
__DLL__ hid_t H5P_copy_new(hid_t id);
__DLL__ herr_t H5P_close(void *plist);
__DLL__ herr_t H5P_register(H5P_genclass_t *pclass, const char *name, size_t size, __DLL__ herr_t H5P_register(H5P_genclass_t *pclass, const char *name, size_t size,
void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set,
H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete,
H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close); H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close);
__DLL__ herr_t H5P_get(hid_t plist_id, const char *name, void *value); __DLL__ herr_t H5P_get(hid_t plist_id, const char *name, void *value);
__DLL__ herr_t H5P_set(hid_t plist_id, const char *name, const void *value); __DLL__ herr_t H5P_set(hid_t plist_id, const char *name, const void *value);
__DLL__ H5P_class_t_old H5P_get_class(hid_t tid);
__DLL__ hid_t H5P_get_driver(hid_t plist_id); __DLL__ hid_t H5P_get_driver(hid_t plist_id);
/* Private functions to "peek" at properties of a certain type */ /* Private functions to "peek" at properties of a certain type */

View File

@ -36,23 +36,10 @@ typedef long off_t;
#endif #endif
/*__MWERKS__*/ /*__MWERKS__*/
/* Property list classes */ #ifdef H5_WANT_H5_V1_4_COMPAT
typedef enum H5P_class_t_old { /* Backward compatibility typedef... */
H5P_NO_CLASS_OLD = -1, /*error return value */
H5P_NCLASSES_OLD /*this must be last! */
} H5P_class_t_old;
/* This typedef should go in the v1.4 compat section when all the internal */
/* property lists are switched to generic property lists - QAK */
typedef hid_t H5P_class_t; /* Alias H5P_class_t to hid_t */ typedef hid_t H5P_class_t; /* Alias H5P_class_t to hid_t */
/* hid_t aliases for old H5P_class_t enum values */ #endif /* H5_WANT_H5_V1_4_COMPAT */
/* These go away as each old-style property list is converted to a generic */
/* property list -QAK */
/* Also - merge/delete H5Pcreate and H5Pcreate_list */
/* - merge/delete H5Pget_class and H5Pget_class_new */
/* - merge/delete H5Pcopy and H5Pcopy_new */
/* - merge/delete H5Pclose and H5Pclose_list */
__DLLVAR__ hid_t H5P_NO_CLASS;
/* H5P_DATASET_XFER was the name from the beginning through 1.2. It was /* H5P_DATASET_XFER was the name from the beginning through 1.2. It was
* changed to H5P_DATA_XFER on v1.3.0. Then it was changed back to * changed to H5P_DATA_XFER on v1.3.0. Then it was changed back to
@ -86,7 +73,7 @@ extern "C" {
/* /*
* The library created property list classes * The library created property list classes
*/ */
#define H5P_NO_CLASS_NEW (H5open(), H5P_CLS_NO_CLASS_g) #define H5P_NO_CLASS (H5open(), H5P_CLS_NO_CLASS_g)
#define H5P_NO_CLASS_HASH_SIZE 1 /* 1, not 0, otherwise allocations get weird */ #define H5P_NO_CLASS_HASH_SIZE 1 /* 1, not 0, otherwise allocations get weird */
#define H5P_FILE_CREATE (H5open(), H5P_CLS_FILE_CREATE_g) #define H5P_FILE_CREATE (H5open(), H5P_CLS_FILE_CREATE_g)
#define H5P_FILE_CREATE_HASH_SIZE 17 #define H5P_FILE_CREATE_HASH_SIZE 17
@ -126,7 +113,7 @@ __DLL__ hid_t H5Pcreate_class(hid_t parent, const char *name, unsigned hashsize,
H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_copy_func_t cls_copy, void *copy_data,
H5P_cls_close_func_t cls_close, void *close_data); H5P_cls_close_func_t cls_close, void *close_data);
__DLL__ char *H5Pget_class_name(hid_t pclass_id); __DLL__ char *H5Pget_class_name(hid_t pclass_id);
__DLL__ hid_t H5Pcreate_list(hid_t cls_id); __DLL__ hid_t H5Pcreate(hid_t cls_id);
__DLL__ herr_t H5Pregister(hid_t cls_id, const char *name, size_t size, __DLL__ herr_t H5Pregister(hid_t cls_id, const char *name, size_t size,
void *def_value, H5P_prp_create_func_t prp_create, void *def_value, H5P_prp_create_func_t prp_create,
H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
@ -142,7 +129,7 @@ __DLL__ herr_t H5Pset(hid_t plist_id, const char *name, void *value);
__DLL__ htri_t H5Pexist(hid_t plist_id, const char *name); __DLL__ htri_t H5Pexist(hid_t plist_id, const char *name);
__DLL__ herr_t H5Pget_size(hid_t id, const char *name, size_t *size); __DLL__ herr_t H5Pget_size(hid_t id, const char *name, size_t *size);
__DLL__ herr_t H5Pget_nprops(hid_t id, size_t *nprops); __DLL__ herr_t H5Pget_nprops(hid_t id, size_t *nprops);
__DLL__ hid_t H5Pget_class_new(hid_t plist_id); __DLL__ hid_t H5Pget_class(hid_t plist_id);
__DLL__ hid_t H5Pget_class_parent(hid_t pclass_id); __DLL__ hid_t H5Pget_class_parent(hid_t pclass_id);
__DLL__ herr_t H5Pget(hid_t plist_id, const char *name, void * value); __DLL__ herr_t H5Pget(hid_t plist_id, const char *name, void * value);
__DLL__ htri_t H5Pequal(hid_t id1, hid_t id2); __DLL__ htri_t H5Pequal(hid_t id1, hid_t id2);
@ -152,12 +139,10 @@ __DLL__ int H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func,
__DLL__ herr_t H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name); __DLL__ herr_t H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name);
__DLL__ herr_t H5Premove(hid_t plist_id, const char *name); __DLL__ herr_t H5Premove(hid_t plist_id, const char *name);
__DLL__ herr_t H5Punregister(hid_t pclass_id, const char *name); __DLL__ herr_t H5Punregister(hid_t pclass_id, const char *name);
__DLL__ herr_t H5Pclose_list(hid_t plist_id);
__DLL__ herr_t H5Pclose_class(hid_t plist_id); __DLL__ herr_t H5Pclose_class(hid_t plist_id);
__DLL__ hid_t H5Pcreate(hid_t type); __DLL__ hid_t H5Pcreate(hid_t type);
__DLL__ herr_t H5Pclose(hid_t plist_id); __DLL__ herr_t H5Pclose(hid_t plist_id);
__DLL__ hid_t H5Pcopy(hid_t plist_id); __DLL__ hid_t H5Pcopy(hid_t plist_id);
__DLL__ hid_t H5Pget_class(hid_t plist_id);
__DLL__ herr_t H5Pget_version(hid_t plist_id, int *boot/*out*/, __DLL__ herr_t H5Pget_version(hid_t plist_id, int *boot/*out*/,
int *freelist/*out*/, int *stab/*out*/, int *freelist/*out*/, int *stab/*out*/,
int *shhdr/*out*/); int *shhdr/*out*/);

View File

@ -4483,7 +4483,7 @@ H5Tconvert(hid_t src_id, hid_t dst_id, hsize_t nelmts, void *buf,
/* Check args */ /* Check args */
if (H5I_DATATYPE!=H5I_get_type(src_id) || NULL==(src=H5I_object(src_id)) || if (H5I_DATATYPE!=H5I_get_type(src_id) || NULL==(src=H5I_object(src_id)) ||
H5I_DATATYPE!=H5I_get_type(dst_id) || NULL==(dst=H5I_object(dst_id)) || H5I_DATATYPE!=H5I_get_type(dst_id) || NULL==(dst=H5I_object(dst_id)) ||
(H5P_DEFAULT!=plist_id && H5P_DATASET_XFER!=H5P_get_class(plist_id))) { (H5P_DEFAULT!=plist_id && TRUE != H5Pisa_class(plist_id, H5P_DATASET_XFER))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
} }