summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-01-28 16:50:09 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-01-28 16:50:09 (GMT)
commitc0cfc4421ad7c95c46c2a654f8c06bff8db3588f (patch)
treed874539e4492511c07ebd682172c257a32c49055 /src/H5D.c
parent538069b3e0d262ac058cad2d4370eb30b9e6cee9 (diff)
downloadhdf5-c0cfc4421ad7c95c46c2a654f8c06bff8db3588f.zip
hdf5-c0cfc4421ad7c95c46c2a654f8c06bff8db3588f.tar.gz
hdf5-c0cfc4421ad7c95c46c2a654f8c06bff8db3588f.tar.bz2
[svn-r185] Changes since 19980128
---------------------- ./src/H5D.c ./src/H5Dpublic.c Added H5Dget_space(). ./src/H5Gstab.c ./src/H5H.c Fixed a comparison with size_t against <0. ./src/H5P.c ./src/H5Pprivate.h ./src/H5Ppublic.h Changed `intn' to `int' for public function args and returns. H5Pget_hyperslab() returns the dimensionality. ./test/testhdf5.h Clears error stack more frequently. ./src/H5Psimp.c ./test/cmpd_dset.c Impelementing data space conversion.
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 7f3bf78..460a903 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -38,7 +38,7 @@ struct H5D_t {
H5G_entry_t ent; /*cached object header stuff */
H5T_t *type; /*datatype of this dataset */
H5P_t *space; /*dataspace of this dataset */
- H5D_create_t create_parms; /*creation parameters */
+ H5D_create_t create_parms; /*creation parameters */
H5O_layout_t layout; /*data layout */
};
@@ -314,6 +314,54 @@ H5Dclose(hid_t dataset_id)
}
/*-------------------------------------------------------------------------
+ * Function: H5Dget_space
+ *
+ * Purpose: Returns a copy of the file data space for a dataset.
+ *
+ * Return: Success: ID for a copy of the data space. The data
+ * space should be released by calling
+ * H5Dclose().
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, January 28, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Dget_space (hid_t dataset_id)
+{
+ H5D_t *dataset = NULL;
+ H5P_t *copied_space = NULL;
+ hid_t ret_value = FAIL;
+
+ FUNC_ENTER (H5Dget_space, FAIL);
+
+ /* Check args */
+ if (H5_DATASET!=H5A_group (dataset_id) ||
+ NULL==(dataset=H5A_object (dataset_id))) {
+ HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset");
+ }
+
+ /* Copy the data space */
+ if (NULL==(copied_space=H5P_copy (dataset->space))) {
+ HRETURN_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
+ "unable to copy the data space");
+ }
+
+ /* Create an atom */
+ if ((ret_value=H5A_register (H5_DATASPACE, copied_space))<0) {
+ HRETURN_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL,
+ "unable to register data space");
+ }
+
+ FUNC_LEAVE (ret_value);
+}
+
+/*-------------------------------------------------------------------------
* Function: H5Dread
*
* Purpose: Reads (part of) a DATASET from the file into application