diff options
author | Robb Matzke <matzke@llnl.gov> | 1997-12-11 18:49:02 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1997-12-11 18:49:02 (GMT) |
commit | efc14a5341042f5d04f0578bd9820495f1e11d79 (patch) | |
tree | 2318e5300df1c05642694790b352d03dbe90283c /src/H5P.c | |
parent | 250ff23f4f9854b65c4c7b51d2db9f0e11768b87 (diff) | |
download | hdf5-efc14a5341042f5d04f0578bd9820495f1e11d79.zip hdf5-efc14a5341042f5d04f0578bd9820495f1e11d79.tar.gz hdf5-efc14a5341042f5d04f0578bd9820495f1e11d79.tar.bz2 |
[svn-r142] ./src/H5C.c
./src/H5Cprivate.h
Changed H5Csetparm() to H5Cset_prop() and changed it to pass
property values by value instead of reference. Changed
H5Cgetparm() to H5Cget_prop(). Changed data types of file
creation properties so the application can use `int' or
`size_t' for most properties. Properties and their types are
documented in H5Cget_prop().
Changed H5C_class() to H5Cget_class() to make the naming more
uniform across packages.
./src/H5Cpublic.h
Changed names of properties to make them more uniform across
packages: H5F_USERBLOCK_SIZE became H5F_SIZEOF_USERBLOCK,
H5F_OFFSET_SIZE became H5F_SIZEOF_ADDR, H5F_LENGTH_SIZE became
H5F_SIZEOF_SIZE.
./src/H5D.c
./src/H5Dprivate.h
Added support for chunked data storage. There still isn't any
support for data type conversion or data space conversion, so
chunked storage doesn't do much at this time.
./src/H5E.c
./src/H5Epublic.h
Added the H5E_TEMPLATE major error number. I'm about the
change the HGOTO_ERROR() and HRETURN_ERROR() macros to take an
error string as an additional argument instead of specifying
it as a comment.
./src/H5Fistore.c
Added `const' to the `buf' argument of H5F_istore_write()
although this temporarily causes a compiler warning.
./src/H5Fprivate.h
Changed data types of certain file-related variables from
types like `uint8' to `uintn' since the library data types
should not depend on the file data types.
./src/H5P.c
./src/H5Pprivate.h
./src/H5Ppublic.h
Moved H5Pget_lrank() to H5Pget_ndims(), and H5Pget_ldims() to
H5Pget_dims() to make naming more uniform. Dimensions should
always be of type `size_t'. Similarly for H5P_get_lrank() and
H5P_get_ldims().
Diffstat (limited to 'src/H5P.c')
-rw-r--r-- | src/H5P.c | 359 |
1 files changed, 185 insertions, 174 deletions
@@ -379,7 +379,7 @@ H5P_get_npoints (const H5P_t *ds) HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, 0); default: - /* unknown data space class */ + assert ("unknown data space class" && 0); HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, 0); } @@ -388,6 +388,190 @@ H5P_get_npoints (const H5P_t *ds) /*------------------------------------------------------------------------- + * Function: H5Pget_ndims + * + * Purpose: Determines the dimensionality of a data space. + * + * Return: Success: The number of dimensions in a data space. + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Thursday, December 11, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +intn +H5Pget_ndims (hid_t space_id) +{ + H5P_t *ds = NULL; + size_t ret_value = 0; + + FUNC_ENTER(H5Pget_ndims, FAIL); + H5ECLEAR; + + /* check args */ + if (H5_DATASPACE!=H5Aatom_group (space_id) || + NULL==(ds=H5Aatom_object (space_id))) { + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data space*/ + } + + ret_value = H5P_get_ndims (ds); + + FUNC_LEAVE (ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5P_get_ndims + * + * Purpose: Returns the number of dimensions in a data space. + * + * Return: Success: Non-negative number of dimensions. Zero + * implies a scalar. + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Thursday, December 11, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +intn +H5P_get_ndims (const H5P_t *ds) +{ + intn ret_value = FAIL; + + FUNC_ENTER (H5P_get_ndims, FAIL); + + /* check args */ + assert (ds); + + switch (ds->type) { + case H5P_SCALAR: + ret_value = 0; + break; + + case H5P_SIMPLE: + ret_value = ds->u.simple.rank; + break; + + case H5P_COMPLEX: + /* complex data spaces are not supported yet */ + HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL); + + default: + assert ("unknown data space class" && 0); + HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL); + } + + FUNC_LEAVE (ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5Pget_dims + * + * Purpose: Returns the size in each dimension of a data space DS through + * the DIMS argument. + * + * Return: Success: Number of dimensions, the same value as + * returned by H5Pget_ndims(). + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Thursday, December 11, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +intn +H5Pget_dims (hid_t space_id, size_t dims[]/*out*/) +{ + + H5P_t *ds = NULL; + size_t ret_value = 0; + + FUNC_ENTER(H5Pget_dims, FAIL); + H5ECLEAR; + + /* check args */ + if (H5_DATASPACE!=H5Aatom_group (space_id) || + NULL==(ds=H5Aatom_object (space_id))) { + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL); /*not a data space*/ + } + if (!dims) { + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL); /*no output buffer*/ + } + + + ret_value = H5P_get_dims (ds, dims); + + FUNC_LEAVE (ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5P_get_dims + * + * Purpose: Returns the size in each dimension of a data space. This + * function may not be meaningful for all types of data spaces. + * + * Return: Success: Number of dimensions. Zero implies scalar. + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Thursday, December 11, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +intn +H5P_get_dims (const H5P_t *ds, size_t dims[]) +{ + intn ret_value = FAIL; + intn i; + + FUNC_ENTER (H5P_get_dims, FAIL); + + /* check args */ + assert (ds); + assert (dims); + + switch (ds->type) { + case H5P_SCALAR: + ret_value = 0; + break; + + case H5P_SIMPLE: + ret_value = ds->u.simple.rank; + for (i=0; i<ret_value; i++) { + dims[i] = ds->u.simple.size[i]; + } + break; + + case H5P_COMPLEX: + /* complex data spaces are not supported yet */ + HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL); + + default: + assert ("unknown data space class" && 0); + HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL); + } + + FUNC_LEAVE (ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5P_modify * * Purpose: Updates a data space by writing a message to an object @@ -542,179 +726,6 @@ H5P_cmp (const H5P_t *ds1, const H5P_t *ds2) FUNC_LEAVE (0); } -/*-------------------------------------------------------------------------- - NAME - H5P_get_lrank - PURPOSE - Return the logical rank of a dataspace (internal) - USAGE - intn H5P_get_lrank(sdim) - H5P_t *sdim; IN: Pointer to dataspace object to query - RETURNS - The logical rank of a dataspace on success, UFAIL on failure - DESCRIPTION - This function determines the number of logical dimensions in a - dataspace. The logical rank is the actual number of dimensions of the - dataspace, not the dimensionality of the space its embedded in. - UFAIL is returned on an error, otherwise the rank is returned. ---------------------------------------------------------------------------*/ -intn -H5P_get_lrank (const H5P_simple_t *sdim) -{ - intn ret_value = UFAIL; - - FUNC_ENTER(H5P_get_lrank, UFAIL); - - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; - - assert(sdim); - ret_value=sdim->rank; - -#ifdef LATER -done: -#endif /* LATER */ - if(ret_value == UFAIL) - { /* Error condition cleanup */ - - } /* end if */ - - /* Normal function cleanup */ - - FUNC_LEAVE(ret_value); -} - -/*-------------------------------------------------------------------------- - NAME - H5Pget_lrank - PURPOSE - Return the logical rank of a dataspace - USAGE - intn H5P_get_lrank(sid) - hid_t sid; IN: ID of dataspace object to query - RETURNS - The logical rank of a dataspace on success, UFAIL on failure - DESCRIPTION - This function determines the number of logical dimensions in a - dataspace. The logical rank is the actual number of dimensions of the - dataspace, not the dimensionality of the space its embedded in. - UFAIL is returned on an error, otherwise the rank is returned. ---------------------------------------------------------------------------*/ -intn -H5Pget_lrank (hid_t sid) -{ - H5P_t *space=NULL; /* dataspace to modify */ - intn ret_value = UFAIL; - - FUNC_ENTER(H5Pget_lrank, UFAIL); - - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; - - if((space=H5Aatom_object(sid))==NULL) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL); - - ret_value=H5P_get_lrank(&(space->u.simple)); - -done: - if(ret_value == UFAIL) - { /* Error condition cleanup */ - - } /* end if */ - - /* Normal function cleanup */ - - FUNC_LEAVE(ret_value); -} - -/*-------------------------------------------------------------------------- - NAME - H5P_get_ldims - PURPOSE - Return the logical dimensions of a dataspace (internal) - USAGE - herr_t H5P_get_ldims(sdim, dims) - H5P_simple_t *sdim; IN: Pointer to dataspace object to query - intn *dims; OUT: Pointer to array to store dimensions in - RETURNS - SUCCEED/FAIL - DESCRIPTION - This function determines the sizes of the logical dimensions in a - dataspace. The logical dimensions are the actual sizes of the - dataspace, not the size of the space it is embedded in. ---------------------------------------------------------------------------*/ -herr_t -H5P_get_ldims (const H5P_simple_t *sdim, intn *dims) -{ - herr_t ret_value = FAIL; - - FUNC_ENTER(H5P_get_ldims, UFAIL); - - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; - - assert(sdim); - assert(dims); - HDmemcpy(dims, sdim->size,sdim->rank*sizeof(intn)); - ret_value=SUCCEED; - -#ifdef LATER -done: -#endif /* LATER */ - if(ret_value == FAIL) - { /* Error condition cleanup */ - - } /* end if */ - - /* Normal function cleanup */ - - FUNC_LEAVE(ret_value); -} - -/*-------------------------------------------------------------------------- - NAME - H5P_get_ldims - PURPOSE - Return the logical dimensions of a dataspace - USAGE - herr_t H5P_get_ldims(sdim, dims) - hid_t sid; IN: ID of dataspace object to query - intn *dims; OUT: Pointer to array to store dimensions in - RETURNS - SUCCEED/FAIL - DESCRIPTION - This function determines the sizes of the logical dimensions in a - dataspace. The logical dimensions are the actual sizes of the - dataspace, not the size of the space it is embedded in. ---------------------------------------------------------------------------*/ -herr_t H5Pget_ldims(hid_t sid, intn *dims) -{ - H5P_t *space=NULL; /* dataspace to modify */ - intn ret_value = UFAIL; - - FUNC_ENTER(H5Pget_lrank, UFAIL); - - /* Clear errors and check args and all the boring stuff. */ - H5ECLEAR; - - if((space=H5Aatom_object(sid))==NULL) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL); - - if(dims==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL); - - ret_value=H5P_get_ldims(&(space->u.simple),dims); - -done: - if(ret_value == FAIL) - { /* Error condition cleanup */ - - } /* end if */ - - /* Normal function cleanup */ - - FUNC_LEAVE(ret_value); -} /*-------------------------------------------------------------------------- NAME |