[svn-r538] Added H5Sset_extent_none and H5Sextent_copy functions. They are wrappers

around features already tested.
This commit is contained in:
Quincey Koziol 1998-07-23 16:28:22 -05:00
parent c8d2f1e17a
commit 451404ceee
4 changed files with 131 additions and 25 deletions

149
src/H5S.c
View File

@ -166,6 +166,54 @@ done:
FUNC_LEAVE(ret_value); FUNC_LEAVE(ret_value);
} /* end H5Screate() */ } /* end H5Screate() */
/*-------------------------------------------------------------------------
* Function: H5S_extent_release
*
* Purpose: Releases all memory associated with a dataspace extent.
*
* Return: Success: SUCCEED
*
* Failure: FAIL
*
* Programmer: Quincey Koziol
* Thursday, July 23, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
herr_t
H5S_extent_release(H5S_t *ds)
{
FUNC_ENTER(H5S_extent_release, FAIL);
assert(ds);
/* release extent */
switch (ds->extent.type) {
case H5S_NO_CLASS:
/*nothing needed */
break;
case H5S_SCALAR:
/*nothing needed */
break;
case H5S_SIMPLE:
H5S_release_simple(&(ds->extent.u.simple));
break;
case H5S_COMPLEX:
/* nothing yet */
break;
default:
assert("unknown dataspace (extent) type" && 0);
break;
}
FUNC_LEAVE(SUCCEED);
} /* end H5S_extent_release() */
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* Function: H5S_close * Function: H5S_close
* *
@ -192,28 +240,8 @@ H5S_close(H5S_t *ds)
/* Release selection (this should come before the extent release) */ /* Release selection (this should come before the extent release) */
H5S_select_release(ds); H5S_select_release(ds);
/* release extent */ /* Release extent */
switch (ds->extent.type) { H5S_extent_release(ds);
case H5S_NO_CLASS:
/*nothing needed */
break;
case H5S_SCALAR:
/*nothing needed */
break;
case H5S_SIMPLE:
H5S_release_simple(&(ds->extent.u.simple));
break;
case H5S_COMPLEX:
/* nothing yet */
break;
default:
assert("unknown dataspace (extent) type" && 0);
break;
}
/* Release the main structure */ /* Release the main structure */
H5MM_xfree(ds); H5MM_xfree(ds);
@ -333,6 +361,46 @@ H5Scopy (hid_t space_id)
FUNC_LEAVE (ret_value); FUNC_LEAVE (ret_value);
} }
/*-------------------------------------------------------------------------
* 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 * Function: H5S_extent_copy
@ -1472,10 +1540,45 @@ H5Sextent_class (hid_t sid)
ret_value=space->extent.type; ret_value=space->extent.type;
done:
FUNC_LEAVE(ret_value); 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 * Function: H5S_debug

View File

@ -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_release_simple(H5S_simple_t *simple);
herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src); 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_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_select_release (H5S_t *space);
herr_t H5S_sel_iter_release (const H5S_t *space,H5S_sel_iter_t *sel_iter); 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); hsize_t H5S_select_npoints (const H5S_t *space);

View File

@ -61,7 +61,9 @@ herr_t H5Sselect_hyperslab (hid_t space_id, H5S_seloper_t op,
const hsize_t count[], const hsize_t _block[]); const hsize_t count[], const hsize_t _block[]);
herr_t H5Sselect_elements (hid_t space_id, H5S_seloper_t op, size_t num_elemn, herr_t H5Sselect_elements (hid_t space_id, H5S_seloper_t op, size_t num_elemn,
const hssize_t **coord); 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 #ifdef __cplusplus
} }

View File

@ -27,7 +27,7 @@
/* Version numbers */ /* Version numbers */
#define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */
#define H5_VERS_MINOR 0 /* For minor 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, \ #define H5check() H5vers_check(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE) H5_VERS_RELEASE)