mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-25 17:00:45 +08:00
[svn-r5872] Purpose:
Code cleanup Description: Move get/set routines for each type of property list (file creation, dataset creation, file access and dataset transfer) into their own source code module. Platforms tested: FreeBSD 4.6 (sleipnir)
This commit is contained in:
parent
5112232ddf
commit
c85063bfad
4
MANIFEST
4
MANIFEST
@ -861,6 +861,10 @@
|
||||
./src/H5Oshared.c
|
||||
./src/H5Ostab.c
|
||||
./src/H5P.c
|
||||
./src/H5Pdcpl.c
|
||||
./src/H5Pdxpl.c
|
||||
./src/H5Pfapl.c
|
||||
./src/H5Pfcpl.c
|
||||
./src/H5Ppkg.h
|
||||
./src/H5Pprivate.h
|
||||
./src/H5Ppublic.h
|
||||
|
1172
src/H5Pdcpl.c
Normal file
1172
src/H5Pdcpl.c
Normal file
File diff suppressed because it is too large
Load Diff
750
src/H5Pdxpl.c
Normal file
750
src/H5Pdxpl.c
Normal file
@ -0,0 +1,750 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
||||
* of the source code distribution tree; Copyright.html can be found at the *
|
||||
* root level of an installed copy of the electronic HDF5 document set and *
|
||||
* is linked from the top-level documents page. It can also be found at *
|
||||
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
|
||||
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#define H5P_PACKAGE /*suppress error about including H5Ppkg */
|
||||
|
||||
/* Private header files */
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Dprivate.h" /* Datasets */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5Ppkg.h" /* Property lists */
|
||||
|
||||
/* Pablo mask */
|
||||
#define PABLO_MASK H5Pdxpl_mask
|
||||
|
||||
/* Interface initialization */
|
||||
#define INTERFACE_INIT NULL
|
||||
static int interface_initialize_g = 0;
|
||||
|
||||
/* Local datatypes */
|
||||
|
||||
/* Static function prototypes */
|
||||
|
||||
#ifdef H5_WANT_H5_V1_4_COMPAT
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* 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(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:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
hsize_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 */
|
||||
hsize_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(H5Pget_buffer, 0);
|
||||
H5TRACE3("h","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=(hsize_t)size;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
#else /* H5_WANT_H5_V1_4_COMPAT */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* 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, size_t size, void *tconv, void *bkg)
|
||||
{
|
||||
H5P_genplist_t *plist; /* Property list pointer */
|
||||
herr_t ret_value=SUCCEED; /* return value */
|
||||
|
||||
FUNC_ENTER_API(H5Pset_buffer, FAIL);
|
||||
H5TRACE4("e","izxx",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(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(ret_value);
|
||||
}
|
||||
|
||||
#endif /* H5_WANT_H5_V1_4_COMPAT */
|
||||
|
||||
#ifdef H5_WANT_H5_V1_4_COMPAT
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* 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 (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(ret_value);
|
||||
}
|
||||
#endif /* H5_WANT_H5_V1_4_COMPAT */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* 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(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_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(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(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(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P_set_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
|
||||
H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func,
|
||||
void *alloc_info, H5MM_free_t free_func, void *free_info)
|
||||
{
|
||||
herr_t ret_value=SUCCEED; /* return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5P_set_vlen_mem_manager, FAIL);
|
||||
|
||||
assert(plist);
|
||||
|
||||
/* Update property list */
|
||||
if (H5P_set(plist,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
|
||||
if (H5P_set(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
|
||||
if (H5P_set(plist,H5D_XFER_VLEN_FREE_NAME,&free_func)<0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
|
||||
if (H5P_set(plist,H5D_XFER_VLEN_FREE_INFO_NAME,&free_info)<0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* end H5P_set_vlen_mem_manager() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* 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(ret_value);
|
||||
} /* end H5Pset_vlen_mem_manager() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* 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(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(ret_value);
|
||||
} /* end H5Pset_hyper_vector_size() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* 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(ret_value);
|
||||
} /* end H5Pget_hyper_vector_size() */
|
||||
|
1287
src/H5Pfapl.c
Normal file
1287
src/H5Pfapl.c
Normal file
File diff suppressed because it is too large
Load Diff
609
src/H5Pfcpl.c
Normal file
609
src/H5Pfcpl.c
Normal file
@ -0,0 +1,609 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
||||
* of the source code distribution tree; Copyright.html can be found at the *
|
||||
* root level of an installed copy of the electronic HDF5 document set and *
|
||||
* is linked from the top-level documents page. It can also be found at *
|
||||
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
|
||||
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#define H5P_PACKAGE /*suppress error about including H5Ppkg */
|
||||
|
||||
/* Private header files */
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Bprivate.h" /* B-tree subclass names */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5Fprivate.h" /* Files */
|
||||
#include "H5Ppkg.h" /* Property lists */
|
||||
|
||||
/* Pablo mask */
|
||||
#define PABLO_MASK H5Pfcpl_mask
|
||||
|
||||
/* Interface initialization */
|
||||
#define INTERFACE_INIT NULL
|
||||
static int interface_initialize_g = 0;
|
||||
|
||||
/* Local datatypes */
|
||||
|
||||
/* Static function prototypes */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_version
|
||||
*
|
||||
* Purpose: Retrieves version information for various parts of a file.
|
||||
*
|
||||
* BOOT: The file boot 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, int *boot/*out*/, int *freelist/*out*/,
|
||||
int *stab/*out*/, int *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,boot,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 (boot)
|
||||
if(H5P_get(plist, H5F_CRT_BOOT_VERS_NAME, boot) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get boot 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(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(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* 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(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* 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(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* 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(ret_value);
|
||||
}
|
||||
|
||||
#ifdef H5_WANT_H5_V1_4_COMPAT
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_sym_k
|
||||
*
|
||||
* Purpose: IK is one half the rank of a tree that stores a symbol
|
||||
* table for a group. Internal nodes of the symbol table are on
|
||||
* average 75% full. That is, the average rank of the tree is
|
||||
* 1.5 times the value of IK.
|
||||
*
|
||||
* LK is one half of the number of symbols that can be stored in
|
||||
* a symbol table node. A symbol table node is the leaf of a
|
||||
* symbol table tree which is used to store a group. When
|
||||
* symbols are inserted randomly into a group, the group's
|
||||
* symbol table nodes are 75% full on average. That is, they
|
||||
* contain 1.5 times the number of symbols specified by LK.
|
||||
*
|
||||
* Either (or even both) of IK and LK can be zero in which case
|
||||
* that value is left unchanged.
|
||||
*
|
||||
* 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_sym_k(hid_t plist_id, int ik, int lk)
|
||||
{
|
||||
int btree_k[H5B_NUM_BTREE_ID];
|
||||
H5P_genplist_t *plist; /* Property list pointer */
|
||||
herr_t ret_value=SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(H5Pset_sym_k, FAIL);
|
||||
H5TRACE3("e","iIsIs",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");
|
||||
|
||||
/* Set values */
|
||||
if (ik > 0) {
|
||||
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_SNODE_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 nodes");
|
||||
}
|
||||
if (lk > 0)
|
||||
if(H5P_set(plist, H5F_CRT_SYM_LEAF_NAME, &lk) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for symbol table leaf nodes");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(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, int *ik /*out */ , int *lk /*out */ )
|
||||
{
|
||||
int 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(ret_value);
|
||||
}
|
||||
#else /* H5_WANT_H5_V1_4_COMPAT */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_sym_k
|
||||
*
|
||||
* Purpose: IK is one half the rank of a tree that stores a symbol
|
||||
* table for a group. Internal nodes of the symbol table are on
|
||||
* average 75% full. That is, the average rank of the tree is
|
||||
* 1.5 times the value of IK.
|
||||
*
|
||||
* LK is one half of the number of symbols that can be stored in
|
||||
* a symbol table node. A symbol table node is the leaf of a
|
||||
* symbol table tree which is used to store a group. When
|
||||
* symbols are inserted randomly into a group, the group's
|
||||
* symbol table nodes are 75% full on average. That is, they
|
||||
* contain 1.5 times the number of symbols specified by LK.
|
||||
*
|
||||
* Either (or even both) of IK and LK can be zero in which case
|
||||
* that value is left unchanged.
|
||||
*
|
||||
* 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_sym_k(hid_t plist_id, int ik, unsigned lk)
|
||||
{
|
||||
int btree_k[H5B_NUM_BTREE_ID];
|
||||
H5P_genplist_t *plist; /* Property list pointer */
|
||||
herr_t ret_value=SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(H5Pset_sym_k, FAIL);
|
||||
H5TRACE3("e","iIsIu",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");
|
||||
|
||||
/* Set values */
|
||||
if (ik > 0) {
|
||||
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_SNODE_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 nodes");
|
||||
}
|
||||
if (lk > 0)
|
||||
if(H5P_set(plist, H5F_CRT_SYM_LEAF_NAME, &lk) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for symbol table leaf nodes");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(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, int *ik /*out */ , unsigned *lk /*out */ )
|
||||
{
|
||||
int 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(ret_value);
|
||||
}
|
||||
#endif /* H5_WANT_H5_V1_4_COMPAT */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* 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, int ik)
|
||||
{
|
||||
int 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","iIs",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(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_istore_k
|
||||
*
|
||||
* Purpose: Queries the 1/2 rank of an indexed storage B-tree. See
|
||||
* H5Pset_istore_k() for details. The argument IK may be the
|
||||
* null pointer.
|
||||
*
|
||||
* Return: Success: Non-negative, size returned through IK
|
||||
*
|
||||
* 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_istore_k(hid_t plist_id, int *ik /*out */ )
|
||||
{
|
||||
int btree_k[H5B_NUM_BTREE_ID];
|
||||
H5P_genplist_t *plist; /* Property list pointer */
|
||||
herr_t ret_value=SUCCEED; /* return value */
|
||||
|
||||
FUNC_ENTER_API(H5Pget_istore_k, FAIL);
|
||||
H5TRACE2("e","ix",plist_id,ik);
|
||||
|
||||
/* 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 (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 interanl nodes");
|
||||
*ik = btree_k[H5B_ISTORE_ID];
|
||||
}
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
@ -25,9 +25,10 @@ LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5D.c H5E.c H5F.c H5Farray.c H5Fcontig.c \
|
||||
H5FDstream.c H5FL.c H5G.c H5Gent.c H5Gnode.c H5Gstab.c H5HG.c H5HL.c H5I.c \
|
||||
H5MF.c H5MM.c H5O.c H5Oattr.c H5Ocomp.c H5Ocont.c H5Odtype.c H5Oefl.c \
|
||||
H5Ofill.c H5Olayout.c H5Omtime.c H5Oname.c H5Onull.c H5Osdspace.c \
|
||||
H5Oshared.c H5Ostab.c H5P.c H5R.c H5S.c H5Sall.c H5Shyper.c \
|
||||
H5Smpio.c H5Snone.c H5Spoint.c H5Sselect.c H5T.c H5Tbit.c H5Tconv.c \
|
||||
H5Tinit.c H5Tvlen.c H5TB.c H5TS.c H5V.c H5Z.c H5Zdeflate.c
|
||||
H5Oshared.c H5Ostab.c H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5R.c \
|
||||
H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c H5Sselect.c H5T.c \
|
||||
H5Tbit.c H5Tconv.c H5Tinit.c H5Tvlen.c H5TB.c H5TS.c H5V.c H5Z.c \
|
||||
H5Zdeflate.c
|
||||
|
||||
|
||||
LIB_OBJ=$(LIB_SRC:.c=.lo)
|
||||
|
Loading…
x
Reference in New Issue
Block a user