summaryrefslogtreecommitdiffstats
path: root/src/H5S.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>1998-07-23 21:28:22 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>1998-07-23 21:28:22 (GMT)
commit451404ceeeb7bae6cad56a856d097a8ed3f69576 (patch)
tree6a34094bd46e4e626b48ab5ca9023856f50c982d /src/H5S.c
parentc8d2f1e17a828016487bb7661f3eff4135c92226 (diff)
downloadhdf5-451404ceeeb7bae6cad56a856d097a8ed3f69576.zip
hdf5-451404ceeeb7bae6cad56a856d097a8ed3f69576.tar.gz
hdf5-451404ceeeb7bae6cad56a856d097a8ed3f69576.tar.bz2
[svn-r538] Added H5Sset_extent_none and H5Sextent_copy functions. They are wrappers
around features already tested.
Diffstat (limited to 'src/H5S.c')
-rw-r--r--src/H5S.c123
1 files changed, 113 insertions, 10 deletions
diff --git a/src/H5S.c b/src/H5S.c
index 524d19b..3a46423 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -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
*