diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2002-11-07 15:57:53 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2002-11-07 15:57:53 (GMT) |
commit | 2c78145f74f5aab70fdd3f81106fca6a0dfc4b16 (patch) | |
tree | 2ac2928cd285fb09c688ce95dac062bbb90e16ae /src/H5D.c | |
parent | a9dea215ed696c1523fec79b4175b571600dca77 (diff) | |
download | hdf5-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/H5D.c')
-rw-r--r-- | src/H5D.c | 82 |
1 files changed, 82 insertions, 0 deletions
@@ -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 |