/*------------------------------------------------------------------------- * Function: H5Pget_sizes * * Purpose: Returns the size of address and size quantities stored in a * file according to a file creation property list. Either (or * even both) SIZEOF_ADDR and SIZEOF_SIZE may be null pointers. * * Return: Success: Non-negative, sizes returned through arguments. * * Failure: Negative * * Programmer: Robb Matzke * Wednesday, January 7, 1998 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr /*out */ , size_t *sizeof_size /*out */ ) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pget_sizes, FAIL); H5TRACE3("e","ixx",plist_id,sizeof_addr,sizeof_size); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Get values */ if (sizeof_addr) if(H5P_get(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, sizeof_addr) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for an address"); if (sizeof_size) if(H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, sizeof_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for object "); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pget_btree_ratios * * Purpose: Queries B-tree split ratios. See H5Pset_btree_ratios(). * * Return: Success: Non-negative with split ratios returned through * the non-null arguments. * * Failure: Negative * * Programmer: Robb Matzke * Monday, September 28, 1998 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pget_btree_ratios(hid_t plist_id, double *left/*out*/, double *middle/*out*/, double *right/*out*/) { double btree_split_ratio[3]; /* B-tree node split ratios */ H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pget_btree_ratios, FAIL); H5TRACE4("e","ixxx",plist_id,left,middle,right); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Get the split ratios */ if (H5P_get(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&btree_split_ratio)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); /* Get values */ if (left) *left = btree_split_ratio[0]; if (middle) *middle = btree_split_ratio[1]; if (right) *right = btree_split_ratio[2]; done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pset_btree_ratios * * Purpose: Sets B-tree split ratios for a dataset transfer property * list. The split ratios determine what percent of children go * in the first node when a node splits. The LEFT ratio is * used when the splitting node is the left-most node at its * level in the tree; the RIGHT ratio is when the splitting node * is the right-most node at its level; and the MIDDLE ratio for * all other cases. A node which is the only node at its level * in the tree uses the RIGHT ratio when it splits. All ratios * are real numbers between 0 and 1, inclusive. * * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Monday, September 28, 1998 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right) { double split_ratio[3]; /* B-tree node split ratios */ H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pset_btree_ratios, FAIL); H5TRACE4("e","iddd",plist_id,left,middle,right); /* Check arguments */ if (left<0.0 || left>1.0 || middle<0.0 || middle>1.0 || right<0.0 || right>1.0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0<=X<=1.0"); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Set values */ split_ratio[0] = left; split_ratio[1] = middle; split_ratio[2] = right; /* Set the split ratios */ if (H5P_set(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&split_ratio)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Iget_name * * Purpose: Gets a name of an object from its ID. * * Return: Success: The length of name. * * Failure: -1 * * Programmer: Pedro Vicente, [email protected] * * Date: July 26, 2002 * * Comments: Public function * If `name' is non-NULL then write up to `size' bytes into that * buffer and always return the length of the entry name. * Otherwise `size' is ignored and the function does not store the name, * just returning the number of characters required to store the name. * If an error occurs then the buffer pointed to by `name' (NULL or non-NULL) * is unchanged and the function returns a negative value. * If a zero is returned for the name's length, then there is no name * associated with the ID. * * Modifications: * *------------------------------------------------------------------------- */ ssize_t H5Iget_name(hid_t id, char *name/*out*/, size_t size) { H5G_entry_t *ent; /*symbol table entry */ size_t len=0; ssize_t ret_value; FUNC_ENTER_API (H5Iget_name, FAIL); H5TRACE3("Zs","ixz",id,name,size); /* get symbol table entry */ if(NULL!=(ent = H5G_loc(id))) { if (ent->user_path_r != NULL && ent->user_path_hidden==0) { len = H5RS_len(ent->user_path_r); if(name) { HDstrncpy(name, H5RS_get_str(ent->user_path_r), MIN(len+1,size)); if(len >= size) name[size-1]='\0'; } /* end if */ } /* end if */ } /* end if */ /* Set return value */ ret_value=(ssize_t)len; done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pget_version * * Purpose: Retrieves version information for various parts of a file. * * SUPER: The file super block. * HEAP: The global heap. * FREELIST: The global free list. * STAB: The root symbol table entry. * SHHDR: Shared object headers. * * Any (or even all) of the output arguments can be null * pointers. * * Return: Success: Non-negative, version information is returned * through the arguments. * * Failure: Negative * * Programmer: Robb Matzke * Wednesday, January 7, 1998 * * Modifications: * * Raymond Lu, Oct 14, 2001 * Change to the new generic property list. * *------------------------------------------------------------------------- */ herr_t H5Pget_version(hid_t plist_id, unsigned *super/*out*/, unsigned *freelist/*out*/, unsigned *stab/*out*/, unsigned *shhdr/*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5Pget_version, FAIL); H5TRACE5("e","ixxxx",plist_id,super,freelist,stab,shhdr); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Get values */ if (super) if(H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, super) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get superblock version"); if (freelist) if(H5P_get(plist, H5F_CRT_FREESPACE_VERS_NAME, freelist) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get free-space version"); if (stab) if(H5P_get(plist, H5F_CRT_OBJ_DIR_VERS_NAME, stab) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object directory version"); if (shhdr) if(H5P_get(plist, H5F_CRT_SHARE_HEAD_VERS_NAME, shhdr) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get shared-header version"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pget_hyper_cache * * Purpose: Reads values previously set with H5Pset_hyper_cache(). * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Monday, September 21, 1998 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pget_hyper_cache(hid_t plist_id, unsigned *cache/*out*/, unsigned *limit/*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pget_hyper_cache, FAIL); H5TRACE3("e","ixx",plist_id,cache,limit); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Return values */ if (cache) if (H5P_get(plist,H5D_XFER_HYPER_CACHE_NAME,cache)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); if (limit) if (H5P_get(plist,H5D_XFER_HYPER_CACHE_LIM_NAME,limit)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pget_buffer * * Purpose: Reads values previously set with H5Pset_buffer(). * * Return: Success: Buffer size. * * Failure: 0 * * Programmer: Robb Matzke * Monday, March 16, 1998 * * Modifications: * *------------------------------------------------------------------------- */ size_t H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/) { H5P_genplist_t *plist; /* Property list pointer */ size_t size; /* Type conversion buffer size */ size_t ret_value; /* Return value */ FUNC_ENTER_API(H5Pget_buffer, 0); H5TRACE3("z","ixx",plist_id,tconv,bkg); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, 0, "can't find object for ID"); /* Return values */ if (tconv) if(H5P_get(plist, H5D_XFER_TCONV_BUF_NAME, tconv)<0) HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get transfer type conversion buffer"); if (bkg) if(H5P_get(plist, H5D_XFER_BKGR_BUF_NAME, bkg)<0) HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get background type conversion buffer"); /* Get the size */ if(H5P_get(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0) HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, 0, "Can't set transfer buffer size"); /* Set the return value */ ret_value=size; done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pget_sym_k * * Purpose: Retrieves the symbol table B-tree 1/2 rank (IK) and the * symbol table leaf node 1/2 size (LK). See H5Pset_sym_k() for * details. Either (or even both) IK and LK may be null * pointers. * * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Wednesday, January 7, 1998 * * Modifications: * * Raymond Lu * Changed to the new generic property list. * *------------------------------------------------------------------------- */ herr_t H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out */ , unsigned *lk /*out */ ) { unsigned btree_k[H5B_NUM_BTREE_ID]; H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5Pget_sym_k, FAIL); H5TRACE3("e","ixx",plist_id,ik,lk); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Get values */ if (ik) { if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree nodes"); *ik = btree_k[H5B_SNODE_ID]; } if (lk) if(H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, lk) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for symbol table leaf nodes"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pset_istore_k * * Purpose: IK is one half the rank of a tree that stores chunked raw * data. On average, such a tree will be 75% full, or have an * average rank of 1.5 times the value of IK. * * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Tuesday, January 6, 1998 * * Modifications: * * Raymond Lu, Oct 14, 2001 * Changed to the new generic property list. * *------------------------------------------------------------------------- */ herr_t H5Pset_istore_k(hid_t plist_id, unsigned ik) { unsigned btree_k[H5B_NUM_BTREE_ID]; H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5Pset_istore_k, FAIL); H5TRACE2("e","iIu",plist_id,ik); /* Check arguments */ if (ik == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "istore IK value must be positive"); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Set value */ if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes"); btree_k[H5B_ISTORE_ID] = ik; if(H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree interanl nodes"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pget_vlen_mem_manager * * Purpose: The inverse of H5Pset_vlen_mem_manager() * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Thursday, July 1, 1999 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func/*out*/, void **alloc_info/*out*/, H5MM_free_t *free_func/*out*/, void **free_info/*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pget_vlen_mem_manager, FAIL); H5TRACE5("e","ixxxx",plist_id,alloc_func,alloc_info,free_func,free_info); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); if(alloc_func!=NULL) if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_NAME,alloc_func)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); if(alloc_info!=NULL) if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,alloc_info)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); if(free_func!=NULL) if (H5P_get(plist,H5D_XFER_VLEN_FREE_NAME,free_func)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); if(free_info!=NULL) if (H5P_get(plist,H5D_XFER_VLEN_FREE_INFO_NAME,free_info)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pset_buffer * * Purpose: Given a dataset transfer property list, set the maximum size * for the type conversion buffer and background buffer and * optionally supply pointers to application-allocated buffers. * If the buffer size is smaller than the entire amount of data * being transfered between application and file, and a type * conversion buffer or background buffer is required then * strip mining will be used. * * If TCONV and/or BKG are null pointers then buffers will be * allocated and freed during the data transfer. * * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Monday, March 16, 1998 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pset_buffer(hid_t plist_id, hsize_t _size, void *tconv, void *bkg) { H5P_genplist_t *plist; /* Property list pointer */ size_t size=(size_t)_size; /* Work around size difference */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pset_buffer, FAIL); H5TRACE4("e","ihxx",plist_id,_size,tconv,bkg); /* Check arguments */ if (size<=0) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size must not be zero"); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Update property list */ if(H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0) HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer buffer size"); if(H5P_set(plist, H5D_XFER_TCONV_BUF_NAME, &tconv)<0) HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer type conversion buffer"); if(H5P_set(plist, H5D_XFER_BKGR_BUF_NAME, &bkg)<0) HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set background type conversion buffer"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pset_userblock * * Purpose: Sets the userblock size field of a file creation property * list. * * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Tuesday, January 6, 1998 * * Modifications: * * Raymond Lu, Oct 14, 2001 * Changed to the new generic property list. * *------------------------------------------------------------------------- */ herr_t H5Pset_userblock(hid_t plist_id, hsize_t size) { unsigned i; H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pset_userblock, FAIL); H5TRACE2("e","ih",plist_id,size); /* Check that the userblock size is a power of two */ for (i=8; i<8*sizeof(hsize_t); i++) { hsize_t p2 = 8==i ? 0 : ((hsize_t)1<<i); if (size == p2) break; } if (i>=8*sizeof(hsize_t)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "userblock size is not valid"); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Set value */ if(H5P_set(plist, H5F_CRT_USER_BLOCK_NAME, &size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set user block"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Iget_file_id * * Purpose: The public version of H5I_get_file_id(), obtains the file * ID given an object ID. User has to close this ID. * * Return: Success: file ID * * Failure: a negative value * * Programmer: Raymond Lu * Oct 27, 2003 * * Modifications: * *------------------------------------------------------------------------- */ hid_t H5Iget_file_id(hid_t obj_id) { hid_t ret_value; FUNC_ENTER_API(H5Iget_file_id, FAIL); H5TRACE1("i","i",obj_id); if((ret_value = H5I_get_file_id(obj_id))<0) HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Iget_type * * Purpose: The public version of H5I_get_type(), obtains a group number * (type) when given an ID. The ID need not be the ID of an * object which currently exists because the group number is * encoded as part of the ID. * * Return: Success: Group number (type) * * Failure: H5I_BADID, a negative value * * Programmer: * * Modifications: * Robb Matzke, 1999-08-23 * Also fails if the ID has a valid group but no longer exists * in the ID tables. *------------------------------------------------------------------------- */ H5I_type_t H5Iget_type(hid_t id) { H5I_type_t ret_value = H5I_BADID; FUNC_ENTER_API(H5Iget_type, H5I_BADID); H5TRACE1("It","i",id); ret_value = H5I_get_type(id); if (ret_value <= H5I_BADID || ret_value >= H5I_NGROUPS || NULL==H5I_object(id)) HGOTO_DONE(H5I_BADID); done: FUNC_LEAVE_API(ret_value); }
/*-------------------------------------------------------------------------- NAME H5Sselect_none PURPOSE Specify that nothing is selected in the extent USAGE herr_t H5Sselect_none(dsid) hid_t dsid; IN: Dataspace ID of selection to modify RETURNS Non-negative on success/Negative on failure DESCRIPTION This function de-selects the entire extent for a dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ herr_t H5Sselect_none (hid_t spaceid) { H5S_t *space = NULL; /* Dataspace to modify selection of */ herr_t ret_value; /* return value */ FUNC_ENTER_API(H5Sselect_none, FAIL); /* Check args */ if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); /* Change to "none" selection */ if((ret_value=H5S_select_none(space))<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); done: FUNC_LEAVE_API(ret_value); } /* H5Sselect_none() */
/*------------------------------------------------------------------------- * Function: H5Iinc_ref * * Purpose: Increments the number of references outstanding for an ID. * * Return: Success: New reference count * Failure: Negative * * Programmer: Quincey Koziol * Dec 7, 2003 * * Modifications: * *------------------------------------------------------------------------- */ int H5Iinc_ref(hid_t id) { int ret_value; /* Return value */ FUNC_ENTER_API(H5Iinc_ref, FAIL); H5TRACE1("Is","i",id); /* Check arguments */ if (id<0) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID"); /* Do actual increment operation */ if((ret_value = H5I_inc_ref(id))<0) HGOTO_ERROR (H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID ref count"); done: FUNC_LEAVE_API(ret_value); } /* end H5Iinc_ref() */
/*------------------------------------------------------------------------- * Function: H5Pget_userblock * * Purpose: Queries the size of a user block in a file creation property * list. * * Return: Success: Non-negative, size returned through SIZE argument. * * Failure: Negative * * Programmer: Robb Matzke * Wednesday, January 7, 1998 * * Modifications: * * Raymond Lu, Oct 14, 2001 * Changed to the new generic property list. * *------------------------------------------------------------------------- */ herr_t H5Pget_userblock(hid_t plist_id, hsize_t *size) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pget_userblock, FAIL); H5TRACE2("e","i*h",plist_id,size); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Get value */ if (size) if(H5P_get(plist, H5F_CRT_USER_BLOCK_NAME, size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,"can't get user block"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pget_hyper_vector_size * * Purpose: Reads values previously set with H5Pset_hyper_vector_size(). * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Monday, July 9, 2001 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pget_hyper_vector_size(hid_t plist_id, size_t *vector_size/*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pget_hyper_vector_size, FAIL); H5TRACE2("e","ix",plist_id,vector_size); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Return values */ if (vector_size) if (H5P_get(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,vector_size)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); done: FUNC_LEAVE_API(ret_value); } /* end H5Pget_hyper_vector_size() */
/*------------------------------------------------------------------------- * Function: H5Pset_vlen_mem_manager * * Purpose: Sets the memory allocate/free pair for VL datatypes. The * allocation routine is called when data is read into a new * array and the free routine is called when H5Dvlen_reclaim is * called. The alloc_info and free_info are user parameters * which are passed to the allocation and freeing functions * respectively. To reset the allocate/free functions to the * default setting of using the system's malloc/free functions, * call this routine with alloc_func and free_func set to NULL. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Thursday, July 1, 1999 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, void *free_info) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pset_vlen_mem_manager, FAIL); H5TRACE5("e","ixxxx",plist_id,alloc_func,alloc_info,free_func,free_info); /* Check arguments */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); /* Update property list */ if (H5P_set_vlen_mem_manager(plist,alloc_func,alloc_info,free_func,free_info)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set values"); done: FUNC_LEAVE_API(ret_value); } /* end H5Pset_vlen_mem_manager() */
/*------------------------------------------------------------------------- * Function: H5Pset_preserve * * Purpose: When reading or writing compound data types and the * destination is partially initialized and the read/write is * intended to initialize the other members, one must set this * property to TRUE. Otherwise the I/O pipeline treats the * destination datapoints as completely uninitialized. * * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Tuesday, March 17, 1998 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pset_preserve(hid_t plist_id, hbool_t status) { H5T_bkg_t need_bkg; /* Value for background buffer type */ H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pset_preserve, FAIL); H5TRACE2("e","ib",plist_id,status); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Update property list */ need_bkg = status ? H5T_BKG_YES : H5T_BKG_NO; if (H5P_set(plist,H5D_XFER_BKGR_BUF_TYPE_NAME,&need_bkg)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pset_hyper_cache * * Purpose: Given a dataset transfer property list, indicate whether to * cache the hyperslab blocks during the I/O (which speeds * things up) and the maximum size of the hyperslab block to * cache. If a block is smaller than to limit, it may still not * be cached if no memory is available. Setting the limit to 0 * indicates no limitation on the size of block to attempt to * cache. * * The default is to cache blocks with no limit on block size * for serial I/O and to not cache blocks for parallel I/O * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Monday, September 21, 1998 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pset_hyper_cache(hid_t plist_id, unsigned cache, unsigned limit) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; FUNC_ENTER_API(H5Pset_hyper_cache, FAIL); H5TRACE3("e","iIuIu",plist_id,cache,limit); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Update property list */ cache = (cache>0) ? 1 : 0; if (H5P_set(plist,H5D_XFER_HYPER_CACHE_NAME,&cache)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to set value"); if (H5P_set(plist,H5D_XFER_HYPER_CACHE_LIM_NAME,&limit)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pset_hyper_vector_size * * Purpose: Given a dataset transfer property list, set the number of * "I/O vectors" (offset and length pairs) which are to be * accumulated in memory before being issued to the lower levels * of the library for reading or writing the actual data. * Increasing the number should give better performance, but use * more memory during hyperslab I/O. The vector size must be * greater than 1. * * The default is to use 1024 vectors for I/O during hyperslab * reading/writing. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Monday, July 9, 2001 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pset_hyper_vector_size(hid_t plist_id, size_t vector_size) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pset_hyper_vector_size, FAIL); H5TRACE2("e","iz",plist_id,vector_size); /* Check arguments */ if (vector_size<1) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "vector size too small"); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Update property list */ if (H5P_set(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value); } /* end H5Pset_hyper_vector_size() */
/*------------------------------------------------------------------------- * Function: H5Pset_sizes * * Purpose: Sets file size-of addresses and sizes. PLIST_ID should be a * file creation property list. A value of zero causes the * property to not change. * * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * Tuesday, January 6, 1998 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pset_sizes, FAIL); H5TRACE3("e","izz",plist_id,sizeof_addr,sizeof_size); /* Check arguments */ if (sizeof_addr) { if (sizeof_addr != 2 && sizeof_addr != 4 && sizeof_addr != 8 && sizeof_addr != 16) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file haddr_t size is not valid"); } if (sizeof_size) { if (sizeof_size != 2 && sizeof_size != 4 && sizeof_size != 8 && sizeof_size != 16) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file size_t size is not valid"); } /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Set value */ if (sizeof_addr) if(H5P_set(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &sizeof_addr) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for an address"); if (sizeof_size) if(H5P_set(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &sizeof_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for object "); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pget_preserve * * Purpose: The inverse of H5Pset_preserve() * * Return: Success: TRUE or FALSE * * Failure: Negative * * Programmer: Robb Matzke * Tuesday, March 17, 1998 * * Modifications: * *------------------------------------------------------------------------- */ int H5Pget_preserve(hid_t plist_id) { H5T_bkg_t need_bkg; /* Background value */ H5P_genplist_t *plist; /* Property list pointer */ int ret_value; /* return value */ FUNC_ENTER_API(H5Pget_preserve, FAIL); H5TRACE1("Is","i",plist_id); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Get value */ if (H5P_get(plist,H5D_XFER_BKGR_BUF_TYPE_NAME,&need_bkg)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); /* Set return value */ ret_value= need_bkg ? TRUE : FALSE; done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pset_edc_check * * Purpose: Enable or disable error-detecting for a dataset reading * process. This error-detecting algorithm is whichever * user chooses earlier. This function cannot control * writing process. * * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Jan 3, 2003 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pset_edc_check, FAIL); H5TRACE2("e","iZe",plist_id,check); /* Check argument */ if (check != H5Z_ENABLE_EDC && check != H5Z_DISABLE_EDC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid value"); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Update property list */ if (H5P_set(plist,H5D_XFER_EDC_NAME,&check)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pset_filter_callback * * Purpose: Sets user's callback function for dataset transfer property * list. This callback function defines what user wants to do * if certain filter fails. * * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Jan 14, 2003 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pset_filter_callback(hid_t plist_id, H5Z_filter_func_t func, void *op_data) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ H5Z_cb_t cb_struct; FUNC_ENTER_API(H5Pset_filter_callback, FAIL); H5TRACE3("e","ixx",plist_id,func,op_data); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); /* Update property list */ cb_struct.func = func; cb_struct.op_data = op_data; if (H5P_set(plist,H5D_XFER_FILTER_CB_NAME,&cb_struct)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pget_edc_check * * Purpose: Enable or disable error-detecting for a dataset reading * process. This error-detecting algorithm is whichever * user chooses earlier. This function cannot control * writing process. * * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Jan 3, 2003 * * Modifications: * *------------------------------------------------------------------------- */ H5Z_EDC_t H5Pget_edc_check(hid_t plist_id) { H5P_genplist_t *plist; /* Property list pointer */ H5Z_EDC_t ret_value; /* return value */ FUNC_ENTER_API(H5Pget_edc_check, H5Z_ERROR_EDC); H5TRACE1("Ze","i",plist_id); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_ERROR_EDC, "can't find object for ID"); /* Update property list */ if (H5P_get(plist,H5D_XFER_EDC_NAME,&ret_value)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5Z_ERROR_EDC, "unable to set value"); /* check valid value */ if (ret_value != H5Z_ENABLE_EDC && ret_value != H5Z_DISABLE_EDC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_ERROR_EDC, "not a valid value"); done: FUNC_LEAVE_API(ret_value); }