diff options
-rw-r--r-- | src/H5S.c | 123 | ||||
-rw-r--r-- | src/H5Sprivate.h | 1 | ||||
-rw-r--r-- | src/H5Spublic.h | 4 | ||||
-rw-r--r-- | src/H5public.h | 2 |
4 files changed, 118 insertions, 12 deletions
@@ -167,31 +167,28 @@ done: } /* end H5Screate() */ /*------------------------------------------------------------------------- - * Function: H5S_close + * Function: H5S_extent_release * - * Purpose: Releases all memory associated with a data space. + * Purpose: Releases all memory associated with a dataspace extent. * * Return: Success: SUCCEED * * Failure: FAIL * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 + * Programmer: Quincey Koziol + * Thursday, July 23, 1998 * * Modifications: * *------------------------------------------------------------------------- */ herr_t -H5S_close(H5S_t *ds) +H5S_extent_release(H5S_t *ds) { - FUNC_ENTER(H5S_close, FAIL); + FUNC_ENTER(H5S_extent_release, FAIL); assert(ds); - /* Release selection (this should come before the extent release) */ - H5S_select_release(ds); - /* release extent */ switch (ds->extent.type) { case H5S_NO_CLASS: @@ -214,6 +211,37 @@ H5S_close(H5S_t *ds) assert("unknown dataspace (extent) type" && 0); break; } + FUNC_LEAVE(SUCCEED); +} /* end H5S_extent_release() */ + +/*------------------------------------------------------------------------- + * Function: H5S_close + * + * Purpose: Releases all memory associated with a data space. + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Tuesday, December 9, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5S_close(H5S_t *ds) +{ + FUNC_ENTER(H5S_close, FAIL); + + assert(ds); + + /* Release selection (this should come before the extent release) */ + H5S_select_release(ds); + + /* Release extent */ + H5S_extent_release(ds); /* Release the main structure */ H5MM_xfree(ds); @@ -335,6 +363,46 @@ H5Scopy (hid_t space_id) /*------------------------------------------------------------------------- + * Function: H5Sextent_copy + * + * Purpose: Copies a dataspace extent. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * Thursday, July 23, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Sextent_copy (hid_t dst_id,hid_t src_id) +{ + H5S_t *src = NULL; + H5S_t *dst = NULL; + hid_t ret_value = SUCCEED; + + FUNC_ENTER (H5Scopy, FAIL); + H5TRACE2("e","ii",dst_id,src_id); + + /* Check args */ + if (H5_DATASPACE!=H5I_group (src_id) || NULL==(src=H5I_object (src_id))) { + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); + } + if (H5_DATASPACE!=H5I_group (dst_id) || NULL==(dst=H5I_object (dst_id))) { + HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); + } + + /* Copy */ + if (H5S_extent_copy(&(dst->extent),&(src->extent))<0) + HRETURN_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent"); + + FUNC_LEAVE (ret_value); +} + + +/*------------------------------------------------------------------------- * Function: H5S_extent_copy * * Purpose: Copies a dataspace extent @@ -1472,11 +1540,46 @@ H5Sextent_class (hid_t sid) ret_value=space->extent.type; - done: FUNC_LEAVE(ret_value); } +/*-------------------------------------------------------------------------- + NAME + H5Sset_extent_none + PURPOSE + Resets the extent of a dataspace back to "none" + USAGE + herr_t H5Sset_extent_none(space_id) + hid_t space_id; IN: Dataspace object to reset + RETURNS + SUCCEED/FAIL + DESCRIPTION + This function resets the type of a dataspace back to "none" with no + extent information stored for the dataspace. +--------------------------------------------------------------------------*/ +herr_t +H5Sset_extent_none (hid_t space_id) +{ + H5S_t *space = NULL; /* dataspace to modify */ + + FUNC_ENTER(H5Sset_extent_none, FAIL); + H5TRACE1("e","i",space_id); + + /* Check args */ + if ((space = H5I_object(space_id)) == NULL) { + HRETURN_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); + } + + /* Clear the previous extent from the dataspace */ + if(H5S_extent_release(space)<0) + HRETURN_ERROR(H5E_RESOURCE, H5E_CANTDELETE, FAIL, "can't release previous dataspace"); + + space->extent.type=H5S_NO_CLASS; + + FUNC_LEAVE(SUCCEED); +} /* end H5Sset_extent_none() */ + /*------------------------------------------------------------------------- * Function: H5S_debug * diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index eb1897f..611ea27 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -220,6 +220,7 @@ intn H5S_get_hyperslab (const H5S_t *ds, hssize_t offset[]/*out*/, herr_t H5S_release_simple(H5S_simple_t *simple); herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src); herr_t H5S_select_copy (H5S_t *dst, const H5S_t *src); +herr_t H5S_extent_release (H5S_t *space); herr_t H5S_select_release (H5S_t *space); herr_t H5S_sel_iter_release (const H5S_t *space,H5S_sel_iter_t *sel_iter); hsize_t H5S_select_npoints (const H5S_t *space); diff --git a/src/H5Spublic.h b/src/H5Spublic.h index 2554f7c..ff7680e 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -61,7 +61,9 @@ herr_t H5Sselect_hyperslab (hid_t space_id, H5S_seloper_t op, const hsize_t count[], const hsize_t _block[]); herr_t H5Sselect_elements (hid_t space_id, H5S_seloper_t op, size_t num_elemn, const hssize_t **coord); -H5S_class_t H5Sget_class (hid_t space_id); +H5S_class_t H5Sextent_class (hid_t space_id); +herr_t H5Sset_extent_none (hid_t space_id); +herr_t H5Sextent_copy (hid_t dst_id,hid_t src_id); #ifdef __cplusplus } diff --git a/src/H5public.h b/src/H5public.h index 5a10adf..fe73d60 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -27,7 +27,7 @@ /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 0 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 34 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 35 /* For tweaks, bug-fixes, or development */ #define H5check() H5vers_check(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) |