diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-10-09 01:31:36 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-10-09 01:31:36 (GMT) |
commit | 13e5632d32650ff53190bdc37777277d0ae2913d (patch) | |
tree | e08e61acf61b88a73300e2196ed4ff46c3a1ec13 /src/H5Pdcpl.c | |
parent | 82efaff584c24b49f132f645e86e12695887d144 (diff) | |
download | hdf5-13e5632d32650ff53190bdc37777277d0ae2913d.zip hdf5-13e5632d32650ff53190bdc37777277d0ae2913d.tar.gz hdf5-13e5632d32650ff53190bdc37777277d0ae2913d.tar.bz2 |
[svn-r17623] Description:
Bring "compress group's fractal heap" feature from branch back to
trunk.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.6.1 (amazon) in debug mode
Mac OS X/32 10.6.1 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src/H5Pdcpl.c')
-rw-r--r-- | src/H5Pdcpl.c | 1020 |
1 files changed, 9 insertions, 1011 deletions
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 2f7e280..84ef3d4 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -87,10 +87,6 @@ #define H5D_CRT_EXT_FILE_LIST_SIZE sizeof(H5O_efl_t) #define H5D_CRT_EXT_FILE_LIST_DEF {HADDR_UNDEF, 0, 0, NULL} #define H5D_CRT_EXT_FILE_LIST_CMP H5P_dcrt_ext_file_list_cmp -/* Definitions for data filter pipeline */ -#define H5D_CRT_DATA_PIPELINE_SIZE sizeof(H5O_pline_t) -#define H5D_CRT_DATA_PIPELINE_DEF {{0, NULL, H5O_NULL_ID, {{0, HADDR_UNDEF}}}, H5O_PLINE_VERSION_1, 0, 0, NULL} -#define H5D_CRT_DATA_PIPELINE_CMP H5P_dcrt_data_pipeline_cmp /******************/ @@ -121,7 +117,6 @@ static herr_t H5P_dcrt_close(hid_t dxpl_id, void *close_data); /* Property callbacks */ static int H5P_dcrt_layout_cmp(const void *value1, const void *value2, size_t size); static int H5P_dcrt_ext_file_list_cmp(const void *value1, const void *value2, size_t size); -static int H5P_dcrt_data_pipeline_cmp(const void *value1, const void *value2, size_t size); /*********************/ @@ -183,7 +178,6 @@ H5P_dcrt_reg_prop(H5P_genclass_t *pclass) H5O_fill_t fill = H5D_CRT_FILL_VALUE_DEF; /* Default fill value */ unsigned alloc_time_state = H5D_CRT_ALLOC_TIME_STATE_DEF; /* Default allocation time state */ H5O_efl_t efl = H5D_CRT_EXT_FILE_LIST_DEF; /* Default external file list */ - H5O_pline_t pline = H5D_CRT_DATA_PIPELINE_DEF; /* Default I/O pipeline setting */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5P_dcrt_reg_prop) @@ -204,10 +198,6 @@ H5P_dcrt_reg_prop(H5P_genclass_t *pclass) if(H5P_register(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &efl, NULL, NULL, NULL, NULL, NULL, H5D_CRT_EXT_FILE_LIST_CMP, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the data pipeline property */ - if(H5P_register(pclass, H5D_CRT_DATA_PIPELINE_NAME, H5D_CRT_DATA_PIPELINE_SIZE, &pline, NULL, NULL, NULL, NULL, NULL, H5D_CRT_DATA_PIPELINE_CMP, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_dcrt_reg_prop() */ @@ -234,7 +224,6 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) { H5O_fill_t src_fill, dst_fill; /* Source & destination fill values */ H5O_efl_t src_efl, dst_efl; /* Source & destination external file lists */ - H5O_pline_t src_pline, dst_pline; /* Source & destination I/O pipelines */ H5O_layout_t src_layout, dst_layout; /* Source & destination layout */ H5P_genplist_t *src_plist; /* Pointer to source property list */ H5P_genplist_t *dst_plist; /* Pointer to destination property list */ @@ -257,8 +246,6 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") if(H5P_get(src_plist, H5D_CRT_EXT_FILE_LIST_NAME, &src_efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") - if(H5P_get(src_plist, H5D_CRT_DATA_PIPELINE_NAME, &src_pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Make copy of layout */ if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, &src_layout, &dst_layout)) @@ -313,10 +300,6 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) dst_efl.slot[i].name_offset = 0; } /* end if */ - /* Make copy of data pipeline */ - if(NULL == H5O_msg_copy(H5O_PLINE_ID, &src_pline, &dst_pline)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy data pipeline") - /* Set the layout, fill value, external file list, and data pipeline * properties for the destination property list */ @@ -326,8 +309,6 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value") if(H5P_set(dst_plist, H5D_CRT_EXT_FILE_LIST_NAME, &dst_efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file list") - if(H5P_set(dst_plist, H5D_CRT_DATA_PIPELINE_NAME, &dst_pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") done: FUNC_LEAVE_NOAPI(ret_value) @@ -355,7 +336,6 @@ H5P_dcrt_close(hid_t dcpl_id, void UNUSED *close_data) { H5O_fill_t fill; /* Fill value */ H5O_efl_t efl; /* External file list */ - H5O_pline_t pline; /* I/O pipeline */ H5P_genplist_t *plist; /* Property list */ herr_t ret_value = SUCCEED; /* Return value */ @@ -371,17 +351,12 @@ H5P_dcrt_close(hid_t dcpl_id, void UNUSED *close_data) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - /* Clean up any values set for the fill-value, external file-list and - * data pipeline */ + /* Clean up any values set for the fill-value and external file-list */ if(H5O_msg_reset(H5O_FILL_ID, &fill) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release fill info") if(H5O_msg_reset(H5O_EFL_ID, &efl) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release external file list info") - if(H5O_msg_reset(H5O_PLINE_ID, &pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release pipeline info") done: FUNC_LEAVE_NOAPI(ret_value) @@ -600,92 +575,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_dcrt_data_pipeline_cmp - * - * Purpose: Callback routine which is called whenever the filter pipeline - * property in the dataset creation property list is compared. - * - * Return: positive if VALUE1 is greater than VALUE2, negative if - * VALUE2 is greater than VALUE1 and zero if VALUE1 and - * VALUE2 are equal. - * - * Programmer: Quincey Koziol - * Wednesday, January 7, 2004 - * - *------------------------------------------------------------------------- - */ -static int -H5P_dcrt_data_pipeline_cmp(const void *_pline1, const void *_pline2, size_t UNUSED size) -{ - const H5O_pline_t *pline1 = (const H5O_pline_t *)_pline1, /* Create local aliases for values */ - *pline2 = (const H5O_pline_t *)_pline2; - int cmp_value; /* Value from comparison */ - herr_t ret_value = 0; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_dcrt_data_pipeline_cmp) - - /* Sanity check */ - HDassert(pline1); - HDassert(pline2); - HDassert(size == sizeof(H5O_pline_t)); - - /* Check the number of allocated pipeline entries */ - if(pline1->nalloc < pline2->nalloc) HGOTO_DONE(-1); - if(pline1->nalloc > pline2->nalloc) HGOTO_DONE(1); - - /* Check the number of used pipeline entries */ - if(pline1->nused < pline2->nused) HGOTO_DONE(-1); - if(pline1->nused > pline2->nused) HGOTO_DONE(1); - - /* Check the filter entry information */ - if(pline1->filter == NULL && pline2->filter != NULL) HGOTO_DONE(-1); - if(pline1->filter != NULL && pline2->filter == NULL) HGOTO_DONE(1); - if(pline1->filter != NULL && pline1->nused > 0) { - size_t u; /* Local index variable */ - - /* Loop through all filters, comparing them */ - for(u = 0; u < pline1->nused; u++) { - /* Check the ID of the filter */ - if(pline1->filter[u].id < pline2->filter[u].id) HGOTO_DONE(-1); - if(pline1->filter[u].id > pline2->filter[u].id) HGOTO_DONE(1); - - /* Check the flags for the filter */ - if(pline1->filter[u].flags < pline2->filter[u].flags) HGOTO_DONE(-1); - if(pline1->filter[u].flags > pline2->filter[u].flags) HGOTO_DONE(1); - - /* Check the name of the filter */ - if(pline1->filter[u].name == NULL && pline2->filter[u].name != NULL) HGOTO_DONE(-1); - if(pline1->filter[u].name != NULL && pline2->filter[u].name == NULL) HGOTO_DONE(1); - if(pline1->filter[u].name != NULL) - if((cmp_value = HDstrcmp(pline1->filter[u].name, pline2->filter[u].name)) != 0) - HGOTO_DONE(cmp_value); - - /* Check the number of parameters for the filter */ - if(pline1->filter[u].cd_nelmts < pline2->filter[u].cd_nelmts) HGOTO_DONE(-1); - if(pline1->filter[u].cd_nelmts > pline2->filter[u].cd_nelmts) HGOTO_DONE(1); - - /* Check the filter parameter information */ - if(pline1->filter[u].cd_values == NULL && pline2->filter[u].cd_values != NULL) HGOTO_DONE(-1); - if(pline1->filter[u].cd_values != NULL && pline2->filter[u].cd_values == NULL) HGOTO_DONE(1); - if(pline1->filter[u].cd_values != NULL && pline1->filter[u].cd_nelmts > 0) { - size_t v; /* Local index variable */ - - /* Loop through all parameters, comparing them */ - for(v = 0; v < pline1->filter[u].cd_nelmts; v++) { - /* Check each parameter for the filter */ - if(pline1->filter[u].cd_values[v] < pline2->filter[u].cd_values[v]) HGOTO_DONE(-1); - if(pline1->filter[u].cd_values[v] > pline2->filter[u].cd_values[v]) HGOTO_DONE(1); - } /* end for */ - } /* end if */ - } /* end for */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_dcrt_data_pipeline_cmp() */ - - -/*------------------------------------------------------------------------- * Function: H5P_set_layout * * Purpose: Sets the layout of raw data in the file. @@ -1254,700 +1143,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_modify_filter - * - * Purpose: Modifies the specified FILTER in the - * transient or permanent output filter pipeline - * depending on whether PLIST is a dataset creation or dataset - * transfer property list. The FLAGS argument specifies certain - * general properties of the filter and is documented below. - * The CD_VALUES is an array of CD_NELMTS integers which are - * auxiliary data for the filter. The integer vlues will be - * stored in the dataset object header as part of the filter - * information. - * - * The FLAGS argument is a bit vector of the following fields: - * - * H5Z_FLAG_OPTIONAL(0x0001) - * If this bit is set then the filter is optional. If the - * filter fails during an H5Dwrite() operation then the filter - * is just excluded from the pipeline for the chunk for which it - * failed; the filter will not participate in the pipeline - * during an H5Dread() of the chunk. If this bit is clear and - * the filter fails then the entire I/O operation fails. - * If this bit is set but encoding is disabled for a filter, - * attempting to write will generate an error. - * - * Note: This function currently supports only the permanent filter - * pipeline. That is, PLIST_ID must be a dataset creation - * property list. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Wednesday, October 17, 2007 - * - *------------------------------------------------------------------------- - */ -herr_t -H5P_modify_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned flags, - size_t cd_nelmts, const unsigned cd_values[/*cd_nelmts*/]) -{ - H5O_pline_t pline; - herr_t ret_value = SUCCEED; /* return value */ - - FUNC_ENTER_NOAPI(H5P_modify_filter, FAIL) - - /* Get the pipeline property to append to */ - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - - /* Modify the filter parameters of the I/O pipeline */ - if(H5Z_modify(&pline, filter, flags, cd_nelmts, cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline") - - /* Put the I/O pipeline information back into the property list */ - if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_modify_filter() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pmodify_filter - * - * Purpose: Modifies the specified FILTER in the - * transient or permanent output filter pipeline - * depending on whether PLIST is a dataset creation or dataset - * transfer property list. The FLAGS argument specifies certain - * general properties of the filter and is documented below. - * The CD_VALUES is an array of CD_NELMTS integers which are - * auxiliary data for the filter. The integer vlues will be - * stored in the dataset object header as part of the filter - * information. - * - * The FLAGS argument is a bit vector of the following fields: - * - * H5Z_FLAG_OPTIONAL(0x0001) - * If this bit is set then the filter is optional. If the - * filter fails during an H5Dwrite() operation then the filter - * is just excluded from the pipeline for the chunk for which it - * failed; the filter will not participate in the pipeline - * during an H5Dread() of the chunk. If this bit is clear and - * the filter fails then the entire I/O operation fails. - * If this bit is set but encoding is disabled for a filter, - * attempting to write will generate an error. - * - * Note: This function currently supports only the permanent filter - * pipeline. That is, PLIST_ID must be a dataset creation - * property list. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Friday, April 5, 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, - size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]) -{ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* return value */ - - FUNC_ENTER_API(H5Pmodify_filter, FAIL) - H5TRACE5("e", "iZfIuz*[a3]Iu", plist_id, filter, flags, cd_nelmts, cd_values); - - /* Check args */ - if (filter<0 || filter>H5Z_FILTER_MAX) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier") - if (flags & ~((unsigned)H5Z_FLAG_DEFMASK)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags") - if (cd_nelmts>0 && !cd_values) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied") - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Modify the filter parameters of the I/O pipeline */ - if(H5P_modify_filter(plist, filter, flags, cd_nelmts, cd_values) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't modify filter") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pmodify_filter() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pset_filter - * - * Purpose: Adds the specified FILTER and corresponding properties to the - * end of the transient or permanent output filter pipeline - * depending on whether PLIST is a dataset creation or dataset - * transfer property list. The FLAGS argument specifies certain - * general properties of the filter and is documented below. - * The CD_VALUES is an array of CD_NELMTS integers which are - * auxiliary data for the filter. The integer vlues will be - * stored in the dataset object header as part of the filter - * information. - * - * The FLAGS argument is a bit vector of the following fields: - * - * H5Z_FLAG_OPTIONAL(0x0001) - * If this bit is set then the filter is optional. If the - * filter fails during an H5Dwrite() operation then the filter - * is just excluded from the pipeline for the chunk for which it - * failed; the filter will not participate in the pipeline - * during an H5Dread() of the chunk. If this bit is clear and - * the filter fails then the entire I/O operation fails. - * If this bit is set but encoding is disabled for a filter, - * attempting to write will generate an error. - * - * Note: This function currently supports only the permanent filter - * pipeline. That is, PLIST_ID must be a dataset creation - * property list. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, - size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]) -{ - H5O_pline_t pline; - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ - - FUNC_ENTER_API(H5Pset_filter, FAIL) - H5TRACE5("e", "iZfIuz*[a3]Iu", plist_id, filter, flags, cd_nelmts, cd_values); - - /* Check args */ - if (filter<0 || filter>H5Z_FILTER_MAX) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier") - if (flags & ~((unsigned)H5Z_FLAG_DEFMASK)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags") - if (cd_nelmts>0 && !cd_values) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied") - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Get the pipeline property to append to */ - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - - /* Add the filter to the I/O pipeline */ - if(H5Z_append(&pline, filter, flags, cd_nelmts, cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline") - - /* Put the I/O pipeline information back into the property list */ - if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") - -done: - FUNC_LEAVE_API(ret_value) -} - - -/*------------------------------------------------------------------------- - * Function: H5Pget_nfilters - * - * Purpose: Returns the number of filters in the permanent or transient - * pipeline depending on whether PLIST_ID is a dataset creation - * or dataset transfer property list. In each pipeline the - * filters are numbered from zero through N-1 where N is the - * value returned by this function. During output to the file - * the filters of a pipeline are applied in increasing order - * (the inverse is true for input). - * - * Note: Only permanent filters are supported at this time. - * - * Return: Success: Number of filters or zero if there are none. - * - * Failure: Negative - * - * Programmer: Robb Matzke - * Tuesday, August 4, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -int -H5Pget_nfilters(hid_t plist_id) -{ - H5O_pline_t pline; - H5P_genplist_t *plist; /* Property list pointer */ - int ret_value; /* return value */ - - FUNC_ENTER_API(H5Pget_nfilters, FAIL) - H5TRACE1("Is", "i", plist_id); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Get value */ - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - - /* Set return value */ - ret_value=(int)(pline.nused); - -done: - FUNC_LEAVE_API(ret_value) -} - - -/*------------------------------------------------------------------------- - * Function: H5P_get_filter - * - * Purpose: Internal component of H5Pget_filter & H5Pget_filter_id - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Monday, October 23, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, - size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, - size_t namelen, char name[]/*out*/, - unsigned *filter_config /*out*/) -{ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_get_filter) - - /* Check arguments */ - HDassert(filter); - - /* Filter flags */ - if(flags) - *flags = filter->flags; - - /* Filter parameters */ - if(cd_values) { - size_t i; /* Local index variable */ - - for(i = 0; i < filter->cd_nelmts && i < *cd_nelmts; i++) - cd_values[i] = filter->cd_values[i]; - } /* end if */ - - /* Number of filter parameters */ - if(cd_nelmts) - *cd_nelmts = filter->cd_nelmts; - - /* Filter name */ - if(namelen > 0 && name) { - const char *s = filter->name; - - /* If there's no name on the filter, use the class's filter name */ - if(!s) { - H5Z_class2_t *cls = H5Z_find(filter->id); - - if(cls) - s = cls->name; - } /* end if */ - - /* Check for actual name */ - if(s) { - HDstrncpy(name, s, namelen); - name[namelen - 1] = '\0'; - } /* end if */ - else { - /* Check for unknown library filter */ - /* (probably from a future version of the library) */ - if(filter->id < 256) { - HDstrncpy(name, "Unknown library filter", namelen); - name[namelen - 1] = '\0'; - } /* end if */ - else - name[0] = '\0'; - } /* end if */ - } /* end if */ - - /* Filter configuration (assume filter ID has already been checked) */ - if(filter_config) - H5Zget_filter_info(filter->id, filter_config); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_get_filter() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pget_filter2 - * - * Purpose: This is the query counterpart of H5Pset_filter() and returns - * information about a particular filter number in a permanent - * or transient pipeline depending on whether PLIST_ID is a - * dataset creation or transfer property list. On input, - * CD_NELMTS indicates the number of entries in the CD_VALUES - * array allocated by the caller while on exit it contains the - * number of values defined by the filter. FILTER_CONFIG is a bit - * field contaning encode/decode flags from H5Zpublic.h. The IDX - * should be a value between zero and N-1 as described for - * H5Pget_nfilters() and the function will return failure if the - * filter number is out of range. - * - * Return: Success: Filter identification number. - * - * Failure: H5Z_FILTER_ERROR (Negative) - * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * - *------------------------------------------------------------------------- - */ -H5Z_filter_t -H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, - size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, - size_t namelen, char name[]/*out*/, - unsigned *filter_config /*out*/) -{ - H5O_pline_t pline; /* Filter pipeline */ - const H5Z_filter_info_t *filter; /* Pointer to filter information */ - H5P_genplist_t *plist; /* Property list pointer */ - H5Z_filter_t ret_value; /* return value */ - - FUNC_ENTER_API(H5Pget_filter2, H5Z_FILTER_ERROR) - H5TRACE8("Zf", "iIux*zxzxx", plist_id, idx, flags, cd_nelmts, cd_values, - namelen, name, filter_config); - - /* Check args */ - if(cd_nelmts || cd_values) { - /* - * It's likely that users forget to initialize this on input, so - * we'll check that it has a reasonable value. The actual number - * is unimportant because the H5O layer will detect when a message - * is too large. - */ - if(cd_nelmts && *cd_nelmts > 256) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "probable uninitialized *cd_nelmts argument") - if(cd_nelmts && *cd_nelmts > 0 && !cd_values) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "client data values not supplied") - - /* - * If cd_nelmts is null but cd_values is non-null then just ignore - * cd_values - */ - if(!cd_nelmts) - cd_values = NULL; - } /* end if */ - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID") - - /* Get pipeline info */ - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline") - - /* Check more args */ - if(idx >= pline.nused) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid") - - /* Set pointer to particular filter to query */ - filter = &pline.filter[idx]; - - /* Get filter information */ - if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info") - - /* Set return value */ - ret_value = filter->id; - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_filter2() */ - - -/*------------------------------------------------------------------------- - * Function: H5P_get_filter_by_id - * - * Purpose: This is an additional query counterpart of H5Pset_filter() and - * returns information about a particular filter in a permanent - * or transient pipeline depending on whether PLIST_ID is a - * dataset creation or transfer property list. On input, - * CD_NELMTS indicates the number of entries in the CD_VALUES - * array allocated by the caller while on exit it contains the - * number of values defined by the filter. FILTER_CONFIG is a bit - * field contaning encode/decode flags from H5Zpublic.h. The ID - * should be the filter ID to retrieve the parameters for. If the - * filter is not set for the property list, an error will be returned. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Wednesday, October 17, 2007 - * - *------------------------------------------------------------------------- - */ -herr_t -H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags/*out*/, - size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, - size_t namelen, char name[]/*out*/, unsigned *filter_config) -{ - H5O_pline_t pline; /* Filter pipeline */ - H5Z_filter_info_t *filter; /* Pointer to filter information */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5P_get_filter_by_id, FAIL) - - /* Get pipeline info */ - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - - /* Get pointer to filter in pipeline */ - if(NULL == (filter = H5Z_filter_info(&pline, id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID is invalid") - - /* Get filter information */ - if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_filter_by_id() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pget_filter_by_id2 - * - * Purpose: This is an additional query counterpart of H5Pset_filter() and - * returns information about a particular filter in a permanent - * or transient pipeline depending on whether PLIST_ID is a - * dataset creation or transfer property list. On input, - * CD_NELMTS indicates the number of entries in the CD_VALUES - * array allocated by the caller while on exit it contains the - * number of values defined by the filter. FILTER_CONFIG is a bit - * field contaning encode/decode flags from H5Zpublic.h. The ID - * should be the filter ID to retrieve the parameters for. If the - * filter is not set for the property list, an error will be returned. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Friday, April 5, 2003 - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/, - size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, - size_t namelen, char name[]/*out*/, unsigned *filter_config) -{ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(H5Pget_filter_by_id2, FAIL) - H5TRACE8("e", "iZfx*zxzx*Iu", plist_id, id, flags, cd_nelmts, cd_values, - namelen, name, filter_config); - - /* Check args */ - if(cd_nelmts || cd_values) { - /* - * It's likely that users forget to initialize this on input, so - * we'll check that it has a reasonable value. The actual number - * is unimportant because the H5O layer will detect when a message - * is too large. - */ - if(cd_nelmts && *cd_nelmts > 256) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "probable uninitialized *cd_nelmts argument") - if(cd_nelmts && *cd_nelmts > 0 && !cd_values) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "client data values not supplied") - - /* - * If cd_nelmts is null but cd_values is non-null then just ignore - * cd_values - */ - if(!cd_nelmts) - cd_values = NULL; - } /* end if */ - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Get filter info */ - if(H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_filter_by_id2() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pall_filters_avail - * - * Purpose: This is a query routine to verify that all the filters set - * in the dataset creation property list are available currently. - * - * Return: Success: TRUE if all filters available, FALSE if one or - * more filters not currently available. - * Failure: FAIL on error - * - * Programmer: Quincey Koziol - * Tuesday, April 8, 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -htri_t -H5Pall_filters_avail(hid_t plist_id) -{ - H5P_genplist_t *plist; /* Property list pointer */ - H5O_pline_t pline; /* Filter pipeline */ - htri_t ret_value; /* Return value */ - - FUNC_ENTER_API(H5Pall_filters_avail, FAIL) - H5TRACE1("t", "i", plist_id); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Get pipeline info */ - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - - /* Check if all filters are available */ - if((ret_value = H5Z_all_filters_avail(&pline)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't check pipeline information") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pall_filters_avail() */ - - -/*------------------------------------------------------------------------- - * Function: H5Premove_filter - * - * Purpose: Deletes a filter from the dataset creation property list; - * deletes all filters if FILTER is H5Z_FILTER_NONE - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Pedro Vicente - * January 26, 2004 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5Premove_filter(hid_t plist_id, H5Z_filter_t filter) -{ - H5P_genplist_t *plist; /* Property list pointer */ - H5O_pline_t pline; /* Filter pipeline */ - herr_t ret_value = SUCCEED; /* return value */ - - FUNC_ENTER_API(H5Premove_filter, FAIL) - H5TRACE2("e", "iZf", plist_id, filter); - - /* Get the property list structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Get pipeline info */ - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - - /* Check if there are any filters */ - if (pline.filter) { - /* Delete filter */ - if(H5Z_delete(&pline, filter) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't delete filter") - - /* Put the I/O pipeline information back into the property list */ - if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") - } /* end if */ - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Premove_filter() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pset_deflate - * - * Purpose: Sets the compression method for a permanent or transient - * filter pipeline (depending on whether PLIST_ID is a dataset - * creation or transfer property list) to H5Z_FILTER_DEFLATE - * and the compression level to LEVEL which should be a value - * between zero and nine, inclusive. Lower compression levels - * are faster but result in less compression. This is the same - * algorithm as used by the GNU gzip program. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to check parameter and set property for - * generic property list. - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_deflate(hid_t plist_id, unsigned level) -{ - H5O_pline_t pline; - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ - - FUNC_ENTER_API(H5Pset_deflate, FAIL) - H5TRACE2("e", "iIu", plist_id, level); - - /* Check arguments */ - if(level>9) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid deflate level") - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Add the filter */ - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - if(H5Z_append(&pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &level) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add deflate filter to pipeline") - if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pset_deflate() */ - - -/*------------------------------------------------------------------------- * Function: H5Pset_szip * * Purpose: Sets the compression method for a permanent or transient @@ -2014,11 +1209,11 @@ H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block) cd_values[1]=pixels_per_block; /* Add the filter */ - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) + if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") if(H5Z_append(&pline, H5Z_FILTER_SZIP, H5Z_FLAG_OPTIONAL, (size_t)2, cd_values) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add szip filter to pipeline") - if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) + if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") done: @@ -2061,11 +1256,11 @@ H5Pset_shuffle(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Add the filter */ - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) + if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") if(H5Z_append(&pline, H5Z_FILTER_SHUFFLE, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to shuffle the data") - if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) + if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") done: @@ -2107,11 +1302,11 @@ H5Pset_nbit(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Add the nbit filter */ - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) + if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") if(H5Z_append(&pline, H5Z_FILTER_NBIT, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add nbit filter to pipeline") - if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) + if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") done: @@ -2186,11 +1381,11 @@ H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_fac cd_values[1] = (unsigned)scale_factor; /* Add the scaleoffset filter */ - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) + if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") if(H5Z_append(&pline, H5Z_FILTER_SCALEOFFSET, H5Z_FLAG_OPTIONAL, (size_t)2, cd_values) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add scaleoffset filter to pipeline") - if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) + if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") done: @@ -2199,48 +1394,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_fletcher32 - * - * Purpose: Sets Fletcher32 checksum of EDC for a dataset creation - * property list. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Raymond Lu - * Dec 19, 2002 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_fletcher32(hid_t plist_id) -{ - H5O_pline_t pline; - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ - - FUNC_ENTER_API(H5Pset_fletcher32, FAIL) - H5TRACE1("e", "i", plist_id); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Add the Fletcher32 checksum as a filter */ - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - if(H5Z_append(&pline, H5Z_FILTER_FLETCHER32, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add fletcher32 filter to pipeline") - if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pset_fletcher32() */ - - -/*------------------------------------------------------------------------- * Function: H5Pset_fill_value * * Purpose: Set the fill value for a dataset creation property list. The @@ -2812,158 +1965,3 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_fill_time() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5Pget_filter1 - * - * Purpose: This is the query counterpart of H5Pset_filter() and returns - * information about a particular filter number in a permanent - * or transient pipeline depending on whether PLIST_ID is a - * dataset creation or transfer property list. On input, - * CD_NELMTS indicates the number of entries in the CD_VALUES - * array allocated by the caller while on exit it contains the - * number of values defined by the filter. The IDX - * should be a value between zero and N-1 as described for - * H5Pget_nfilters() and the function will return failure if the - * filter number is out of range. - * - * Return: Success: Filter identification number. - * - * Failure: H5Z_FILTER_ERROR (Negative) - * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * - *------------------------------------------------------------------------- - */ -H5Z_filter_t -H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, - size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, - size_t namelen, char name[]/*out*/) -{ - H5O_pline_t pline; /* Filter pipeline */ - const H5Z_filter_info_t *filter; /* Pointer to filter information */ - H5P_genplist_t *plist; /* Property list pointer */ - H5Z_filter_t ret_value; /* return value */ - - FUNC_ENTER_API(H5Pget_filter1, H5Z_FILTER_ERROR) - H5TRACE7("Zf", "iIux*zxzx", plist_id, idx, flags, cd_nelmts, cd_values, namelen, - name); - - /* Check args */ - if(cd_nelmts || cd_values) { - /* - * It's likely that users forget to initialize this on input, so - * we'll check that it has a reasonable value. The actual number - * is unimportant because the H5O layer will detect when a message - * is too large. - */ - if(cd_nelmts && *cd_nelmts > 256) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "probable uninitialized *cd_nelmts argument") - if(cd_nelmts && *cd_nelmts > 0 && !cd_values) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "client data values not supplied") - - /* - * If cd_nelmts is null but cd_values is non-null then just ignore - * cd_values - */ - if(!cd_nelmts) - cd_values = NULL; - } /* end if */ - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID") - - /* Get pipeline info */ - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline") - - /* Check more args */ - if(idx >= pline.nused) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid") - - /* Set pointer to particular filter to query */ - filter = &pline.filter[idx]; - - /* Get filter information */ - if(H5P_get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info") - - /* Set return value */ - ret_value = filter->id; - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_filter1() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pget_filter_by_id1 - * - * Purpose: This is an additional query counterpart of H5Pset_filter() and - * returns information about a particular filter in a permanent - * or transient pipeline depending on whether PLIST_ID is a - * dataset creation or transfer property list. On input, - * CD_NELMTS indicates the number of entries in the CD_VALUES - * array allocated by the caller while on exit it contains the - * number of values defined by the filter. The ID - * should be the filter ID to retrieve the parameters for. If the - * filter is not set for the property list, an error will be returned. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Friday, April 5, 2003 - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/, - size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, - size_t namelen, char name[]/*out*/) -{ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(H5Pget_filter_by_id1, FAIL) - H5TRACE7("e", "iZfx*zxzx", plist_id, id, flags, cd_nelmts, cd_values, namelen, - name); - - /* Check args */ - if(cd_nelmts || cd_values) { - /* - * It's likely that users forget to initialize this on input, so - * we'll check that it has a reasonable value. The actual number - * is unimportant because the H5O layer will detect when a message - * is too large. - */ - if(cd_nelmts && *cd_nelmts > 256) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "probable uninitialized *cd_nelmts argument") - if(cd_nelmts && *cd_nelmts > 0 && !cd_values) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "client data values not supplied") - - /* - * If cd_nelmts is null but cd_values is non-null then just ignore - * cd_values - */ - if(!cd_nelmts) - cd_values = NULL; - } /* end if */ - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Get filter info */ - if(H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_filter_by_id1() */ - -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - |