Page tree

The license could not be verified: License Certificate has expired!

 

JAVA

FORTRAN

C++

C

 

Link

H5L_GET_INFO2

Returns information about a link

Procedure:

H5L_GET_INFO2 ( loc_id, name, linfo, lapl_id )

Signature:

herr_t H5Lget_info2 ( hid_t loc_id, const char *name, H5L_info2_t *linfo /*out*/, hid_t lapl_id )

SUBROUTINE h5lget_info_f(link_loc_id, link_name, &
       cset, corder, f_corder_valid, link_type, token, val_size, &
       hdferr, lapl_id)
    IMPLICIT NONE

    INTEGER(HID_T), INTENT(IN) :: link_loc_id ! File or group identifier.
    CHARACTER(LEN=*), INTENT(IN) :: link_name ! Name of the link for which information is being sought

! OUTPUTS  NOTE: In C these are contained in the structure H5L_info2_t
    INTEGER, INTENT(OUT) :: cset ! Indicates the character set used for the link’s name.
    INTEGER, INTENT(OUT) :: corder ! Specifies the link’s creation order position.
    LOGICAL, INTENT(OUT) :: f_corder_valid ! Indicates whether the value in corder is valid.
    INTEGER, INTENT(OUT) :: link_type ! Specifies the link class:
                                      !  H5L_TYPE_HARD_F      - Hard link
                                      !  H5L_TYPE_SOFT_F      - Soft link
                                      !  H5L_TYPE_EXTERNAL_F  - External link
                                      !  H5L_TYPE_ERROR _F    - Error
    TYPE(H5O_TOKEN_T_F), INTENT(OUT), TARGET :: token ! If the link is a hard link, token specifies the object token that the link points to
    INTEGER(SIZE_T), INTENT(OUT) :: val_size ! If the link is a symbolic link, val_size will be the length of the link value, e.g.,
                                             ! the length of the name of the pointed-to object with a null terminator.
    INTEGER, INTENT(OUT) :: hdferr       ! Error code:
                                         ! 0 on success and -1 on failure
    INTEGER(HID_T), OPTIONAL, INTENT(IN) :: lapl_id  ! Link access property list
!*****
    INTEGER(SIZE_T) :: link_namelen
    INTEGER(HID_T) :: lapl_id_default
    INTEGER :: corder_valid
END SUBROUTINE h5lget_info_f

Parameters:
hid_t loc_idIN: Location identifier; may be a file, group, dataset, named datatype or attribute identifier
const char *nameIN: Name of the link for which information is being sought
H5L_info2_t *linfo  
OUT: Buffer in which link information is returned
hid_t lapl_idIN: Link access property list identifier

Description:

H5L_GET_INFO2 returns information about the specified link through the  linfo argument.

The location identifier, loc_id, specifies the location of the link. A link name, name, interpreted relative to loc_id, specifies the link being queried.

lapl_id is the link access property list associated with the link name. In the general case, when default link access properties are acceptable, this can be passed in as H5P_DEFAULT. An example of a situation that requires a non-default link access property list is when the link is an external link; an external link may require that a link prefix be set in a link access property list (see H5P_SET_ELINK_PREFIX).

H5L_GET_INFO2 returns information about name in the data structure H5L_info2_t, which is described below and defined in H5Lpublic.h. This structure is returned in the buffer linfo.

         typedef struct {    
H5L_type_t type;           /* Type of link                   */ hbool_t             corder_valid;   /* Indicate if creation order is valid */ int64_t             corder;         /* Creation order                 */ H5T_cset_t          cset;           /* Character set of link name     */ union { H5O_token_t     token;          /* Token of location that hard link points to */ size_t          val_size;       /* Size of a soft link or UD link value */    } u; } H5L_info2_t;

In the above struct, type specifies the link class. Valid values include the following:

H5L_TYPE_HARDHard link
H5L_TYPE_SOFTSoft link
H5L_TYPE_EXTERNAL    External link
H5L_TYPE_ERRORError

There will be additional valid values if user-defined links have been registered.

corder specifies the link’s creation order position while corder_valid indicates whether the value in corder is valid.

If corder_valid is TRUE, the value in corder is known to be valid; if corder_valid is FALSE, the value in corder is presumed to be invalid;

corder starts at zero (0) and is incremented by one (1) as new links are created. But higher-numbered entries are not adjusted when a lower-numbered link is deleted; the deleted link’s creation order position is simply left vacant. In such situations, the value of corder for the last link created will be larger than the number of links remaining in the group.

cset specifies the character set in which the link name is encoded. Valid values include the following:

H5T_CSET_ASCIIUS ASCII
H5T_CSET_UTF8    UTF-8 Unicode encoding

This value is set with H5P_SET_CHAR_ENCODING.

token is the location that a hard link points to, and val_size is the size of a soft link or user defined link value. H5O_token_t is used in the VOL layer. It is defined in H5public.h as:

   typedef struct H5O_token_t {
        uint8_t __data[H5O_MAX_TOKEN_SIZE];
   } H5O_token_t;
          

If the link is a symbolic link, val_size will be the length of the link value, e.g., the length of the name of the pointed-to object with a null terminator.

Returns:

Returns a non-negative value if successful, with the fields of linfo (if non-null) initialized. Otherwise returns a negative value.

Example:

examples / h5_extlink.c [360:364]  hdf5_1_12  HDFFV/hdf5
    /* Since hard links link by object address, we'll need to retrieve
     * the target group's address. We do this by calling H5Lget_info
     * on a hard link to the object.
     */
    H5Lget_info2(file_id, TARGET_GROUP, &li, H5P_DEFAULT);

History:
Release    Change
1.12.0Function introduced in this release.

--- Last Modified: February 12, 2020 | 10:49 AM