summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2002-11-07 15:57:53 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2002-11-07 15:57:53 (GMT)
commit2c78145f74f5aab70fdd3f81106fca6a0dfc4b16 (patch)
tree2ac2928cd285fb09c688ce95dac062bbb90e16ae /src
parenta9dea215ed696c1523fec79b4175b571600dca77 (diff)
downloadhdf5-2c78145f74f5aab70fdd3f81106fca6a0dfc4b16.zip
hdf5-2c78145f74f5aab70fdd3f81106fca6a0dfc4b16.tar.gz
hdf5-2c78145f74f5aab70fdd3f81106fca6a0dfc4b16.tar.bz2
[svn-r6062]
Purpose: New function. Description: H5Dget_offset returns the offset of a dataset's data relative to the beginning of a file. Platforms tested: arabica(simple function, one test should be enough.) Misc. update: RELEASE.txt
Diffstat (limited to 'src')
-rw-r--r--src/H5D.c82
-rw-r--r--src/H5Dprivate.h1
-rw-r--r--src/H5Dpublic.h1
3 files changed, 84 insertions, 0 deletions
diff --git a/src/H5D.c b/src/H5D.c
index cb53178..89656a8 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -3689,6 +3689,88 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Dget_offset
+ *
+ * Purpose: Returns the address of dataset in file.
+ *
+ * Return: Success: the address of dataset
+ *
+ * Failure: Zero
+ *
+ * Programmer: Raymond Lu
+ * November 6, 2002
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+haddr_t
+H5Dget_offset(hid_t dset_id)
+{
+ H5D_t *dset=NULL;
+ haddr_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(H5Dget_offset, 0);
+ H5TRACE1("h","i",dset_id);
+
+ /* Check args */
+ if (NULL==(dset=H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataset");
+
+ /* Set return value */
+ ret_value = H5D_get_offset(dset);
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_get_offset
+ *
+ * Purpose: Private function for H5D_get_offset. Returns the address
+ * of dataset in file.
+ *
+ * Return: Success: the address of dataset
+ *
+ * Failure: Zero
+ *
+ * Programmer: Raymond Lu
+ * November 6, 2002
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+haddr_t
+H5D_get_offset(H5D_t *dset)
+{
+ haddr_t ret_value;
+
+ FUNC_ENTER_NOAPI(H5D_get_offset, HADDR_UNDEF);
+
+ switch(dset->layout.type) {
+ case H5D_CHUNKED:
+ case H5D_COMPACT:
+ ret_value = HADDR_UNDEF;
+ break;
+
+ case H5D_CONTIGUOUS:
+ /* If dataspace hasn't been allocated or dataset is stored in
+ * an external file, the value will be HADDR_UNDEF. */
+ ret_value = dset->layout.addr;
+ break;
+
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a dataset type");
+ }
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: H5Diterate
*
* Purpose: This routine iterates over all the elements selected in a memory
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index 3526e3c..d4a9f91 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -173,6 +173,7 @@ H5_DLL H5S_t *H5D_get_space(H5D_t *dset);
H5_DLL H5D_t * H5D_open_oid(H5G_entry_t *ent);
H5_DLL H5F_t * H5D_get_file(const H5D_t *dset);
H5_DLL hsize_t H5D_get_storage_size(H5D_t *dset);
+H5_DLL haddr_t H5D_get_offset(H5D_t *dset);
H5_DLL void *H5D_vlen_get_buf_size_alloc(size_t size, void *info);
H5_DLL herr_t H5D_vlen_get_buf_size(void *elem, hid_t type_id, hsize_t ndim,
hssize_t *point, void *op_data);
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index 8bf09e1..3e969a3 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -80,6 +80,7 @@ H5_DLL herr_t H5Dget_space_status(hid_t dset_id,
H5_DLL hid_t H5Dget_type (hid_t dset_id);
H5_DLL hid_t H5Dget_create_plist (hid_t dset_id);
H5_DLL hsize_t H5Dget_storage_size(hid_t dset_id);
+H5_DLL haddr_t H5Dget_offset(hid_t dset_id);
H5_DLL herr_t H5Dread (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, void *buf/*out*/);
H5_DLL herr_t H5Dwrite (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,