Last modified: 24 August 2012
Name: H5Lvisit
Signature:
herr_t H5Lvisit( hid_t group_id, H5_index_t index_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data )

Purpose:
Recursively visits all links starting from a specified group.

Description:
H5Lvisit is a recursive iteration function to visit all links in and below a group in an HDF5 file, thus providing a mechanism for an application to perform a common set of operations across all of those links or a dynamically selected subset. For non-recursive iteration across the members of a group, see H5Literate.

The group serving as the root of the iteration is specified by its group identifier, group_id.

Two parameters are used to establish the iteration: index_type and order.

index_type specifies the index to be used. If the links have not been indexed by the index type, they will first be sorted by that index then the iteration will begin; if the links have been so indexed, the sorting step will be unnecesary, so the iteration may begin more quickly. Valid values include the following:
     H5_INDEX_NAME Alpha-numeric index on name
     H5_INDEX_CRT_ORDER     Index on creation order

Note that the index type passed in index_type is a best effort setting. If the application passes in a value indicating iteration in creation order and a group is encountered that was not tracked in creation order, that group will be iterated over in alpha-numeric order by name, or name order. (Name order is the native order used by the HDF5 Library and is always available.)

order specifies the order in which objects are to be inspected along the index specified in index_type. Valid values include the following:
     H5_ITER_INC Increasing order
     H5_ITER_DEC Decreasing order
     H5_ITER_NATIVE     Fastest available order

The protoype of the callback function op is as follows (as defined in the source code file H5Lpublic.h):

herr_t (*H5L_iterate_t)( hid_t g_id, const char *name, const H5L_info_t *info, void *op_data)

The parameters of this callback function have the following values or meanings:
     g_id Group that serves as root of the iteration; same value as the H5Lvisit group_id parameter
     name Name of link, relative to g_id, being examined at current step of the iteration
     info H5L_info_t struct containing information regarding that link
     op_data     User-defined pointer to data required by the application in processing the link; a pass-through of the op_data pointer provided with the H5Lvisit function call

The H5L_info_t struct is defined (in H5Lpublic.h) as follows:

    typedef struct {
        H5L_type_t     type;         /* Type of link                   */
        hbool_t        corder_valid; /* Indicates whether creation     */
                                     /* order is valid                 */
        int64_t        corder;       /* Creation order                 */
        H5T_cset_t     cset;         /* Character set of link name     */
        union {
            haddr_t    address;      /* Address hard link points to    */
            size_t     val_size;     /* Size of soft link or           */
                                     /* user-defined link value        */
        } u;
    } H5L_info_t;

The possible return values from the callback function, and the effect of each, are as follows:

The H5Lvisit op_data parameter is a user-defined pointer to the data required to process links in the course of the iteration. This pointer is passed back to each step of the iteration in the op callback function’s op_data parameter.
 

H5Lvisit and H5Ovisit are companion functions: one for examining and operating on links; the other for examining and operating on the objects that those links point to. Both functions ensure that by the time the function completes successfully, every link or object below the specified point in the file has been presented to the application for whatever processing the application requires.

Parameters:
hid_t group_id IN: Identifier of the group at which the recursive iteration begins.
H5_index_t index_type IN: Type of index; valid values include:
         H5_INDEX_NAME
         H5_INDEX_CRT_ORDER
H5_iter_order_t order     IN: Order in which index is traversed; valid values include:
         H5_ITER_DEC
         H5_ITER_INC
         H5_ITER_NATIVE
H5L_iterate_t op IN: Callback function passing data regarding the link to the calling application
void *op_data IN: User-defined pointer to data required by the application for its processing of the link

Returns:
On success, returns the return value of the first operator that returns a positive value, or zero if all members were processed with no operator returning non-zero.

On failure, returns a negative value if something goes wrong within the library, or the first negative value returned by an operator.

Fortran90 Interface:
None.

History:
Release     C
1.8.0 Function introduced in this release.