Opens an object using its address within an HDF5 file

Procedure:

H5O_OPEN_BY_ADDR(loc_id, addr)

Signature:

<pre><code class="language-c">hid_t H5Oopen_by_addr( hid_t loc_id, haddr_t addr )</code></pre>

<pre><code class="language-fortran">SUBROUTINE h5oopen_by_addr_f(loc_id, addr, obj_id, hdferr)
    IMPLICIT NONE
    INTEGER(HID_T)  , INTENT(IN)  :: loc_id
    INTEGER(HADDR_T), INTENT(IN)  :: addr
    INTEGER(HID_T)  , INTENT(OUT) :: obj_id
    INTEGER         , INTENT(OUT) :: hdferr</code></pre>

Parameters:
hid_t loc_idIN: Location identifier; may be a file, group, dataset, named datatype, or attribute identifier
haddr_t addr    IN: Object’s address in the file

Description:

H5O_OPEN_BY_ADDR opens a group, dataset, or committed (named) datatype using its address within an HDF5 file, addr. The resulting opened object is identical to an object opened with H5O_OPEN and should be closed with H5O_CLOSE or an object-type-specific closing function (such as H5G_CLOSE) when no longer needed.

loc_id is a location identifier in the file.

The object’s address within the file, addr, is the byte offset of the first byte of the object header from the beginning of the HDF5 file space, i.e., from the beginning of the super block (see the “HDF5 Storage Model” section of the The HDF5 Data Model and File Structure chapter of the HDF5 User's Guide.

addr can be obtained via either of two function calls. H5G_GET_OBJINFO returns the object’s address in the objno field of the H5G_stat_t struct; H5L_GET_INFO returns the address in the address field of the H5L_linkinfo_t struct.

Warning: This function must be used with care! 
Improper use can lead to inaccessible data, wasted space in the file, or file corruption. 

This function is dangerous if called on an invalid address. The risk can be safely overcome by retrieving the object address with H5G_GET_OBJINFO  or H5L_GET_LINKINFO immediately before calling H5O_OPEN_BY_ADDR. The immediacy of the operation can be important; if time has elapsed and the object has been deleted from the file, the address will be invalid and file corruption can result.

The address of the HDF5 file on a physical device has no effect on H5O_OPEN_BY_ADDR , nor does the use of any file driver. As stated above, the object address is its offset within the HDF5 file; HDF5’s file drivers will transparently map this to an address on a storage device.

Returns:

Returns an object identifier for the opened object if successful; otherwise returns a negative value.

Example:

Coming Soon!

History:
Release    Change
1.8.0Function introduced in this release.
1.8.4Fortran subroutine added in this release.