Help us improve by taking our short survey: https://www.hdfgroup.org/website-survey/

| HDF5 Last Updated on 2026-03-23 The HDF5 Field Guide

Loading...
Searching...
No Matches
Link Traversal
Links (H5L)

## Detailed Description

Traverse through links

## Macros
#define | H5Literate H5Literate2
#define | H5Literate_by_name H5Literate_by_name2
#define | H5Lvisit H5Lvisit2
#define | H5Lvisit_by_name H5Lvisit_by_name2

## Functions
herr_t | H5Literate1 (hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5L_iterate1_t op, void *op_data)
| Iterates over links in a group, with user callback routine, according to the order within an index.
herr_t | H5Literate2 (hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5L_iterate2_t op, void *op_data)
| Iterates over links in a group, with user callback routine, according to the order within an index.
herr_t | H5Literate_by_name1 (hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5L_iterate1_t op, void *op_data, hid_t lapl_id)
| Iterates through links in a group by its name.
herr_t | H5Literate_by_name2 (hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5L_iterate2_t op, void *op_data, hid_t lapl_id)
| Iterates through links in a group.
herr_t | H5Lvisit1 (hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate1_t op, void *op_data)
| Recursively visits all links starting from a specified group.
herr_t | H5Lvisit2 (hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate2_t op, void *op_data)
| Recursively visits all links starting from a specified group.
herr_t | H5Lvisit_by_name1 (hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate1_t op, void *op_data, hid_t lapl_id)
| Recursively visits all links starting from a specified group.
herr_t | H5Lvisit_by_name2 (hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate2_t op, void *op_data, hid_t lapl_id)
| Recursively visits all links starting from a specified group.

## Macro Definition Documentation

## ◆ H5Literate

#define H5Literate H5Literate2

H5Literate() is a macro that is mapped to either H5Literate1() or H5Literate2().

See also
  API Compatibility Macros

## ◆ H5Literate_by_name

#define H5Literate_by_name H5Literate_by_name2

H5Literate_by_name() is a macro that is mapped to either H5Literate_by_name1() or H5Literate_by_name2().

See also
  API Compatibility Macros

## ◆ H5Lvisit

#define H5Lvisit H5Lvisit2

H5Lvisit() is a macro that is mapped to either H5Lvisit1() or H5Lvisit2().

See also
  API Compatibility Macros

## ◆ H5Lvisit_by_name

#define H5Lvisit_by_name H5Lvisit_by_name2

H5Lvisit_by_name() is a macro that is mapped to either H5Lvisit_by_name1() or H5Lvisit_by_name2().

See also
  API Compatibility Macros

## Function Documentation

## ◆ H5Literate1()

herr_t H5Literate1 | ( | hid_t | grp_id,
|  | H5_index_t | idx_type,
|  | H5_iter_order_t | order,
|  | hsize_t * | idx,
|  | H5L_iterate1_t | op,
|  | void * | op_data )

Iterates over links in a group, with user callback routine, according to the order within an index.

Parameters

  [in] | grp_id | Group identifier
  [in] | idx_type | Index type
  [in] | order | Iteration order
  [in,out] | idx | Pointer to an iteration index to allow continuing a previous iteration
  [in] | op | Callback function
  [in,out] | op_data | User-defined callback function context

Returns
  Success: The return value of the first operator that returns non-zero, or zero if all members were processed with no operator returning non-zero.
  Failure: Negative if an error occurs in the library, or the negative value returned by one of the operators.

Deprecated
  Deprecated in favor of H5Literate2().

H5Literate1() iterates through the links in a file or group, `group_id`, in the order of the specified index, `idx_type`, using a user-defined callback routine `op`. H5Literate1() does not recursively follow links into subgroups of the specified group.

Three parameters are used to manage progress of the iteration: `idx_type`, `order`, and `idx_p`.

`idx_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 unnecessary, so the iteration may begin more quickly. Valid values include the following:

H5_INDEX_NAME | Lexicographic order on name
H5_INDEX_CRT_ORDER | Index on creation order

`order` specifies the order in which objects are to be inspected along the index `idx_type`. Valid values include the following:

H5_ITER_INC | Increasing order
H5_ITER_DEC | Decreasing order
H5_ITER_NATIVE | Fastest available order

`idx_p` tracks the iteration and allows an iteration to be resumed if it was stopped before all members were processed. It is passed in by the application with a starting point and returned by the library with the point at which the iteration stopped.

`op_data` 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. `op` is invoked for each link encounter.

`op_data` is passed to and from each iteration and can be used to supply or aggregate information across iterations.

Remarks
  Same pattern of behavior as H5Giterate().

Note
  This function is also available through the H5Literate() macro.

Warning
  The behavior of H5Literate1() is undefined if the link membership of `group_id` changes during the iteration. This does not limit the ability to change link destinations while iterating, but caution is advised.

Attention
  Leaving callback functions:
  The callback function must return normally, even in the case of error. Returning with H5_ITER_ERROR, instead of leaving by means of exceptions, exit() function, etc... will allow the HDF5 library to manage its resources and maintain a consistent state. See C++ Developers using HDF5 C-API functions warning for detail.

Version
  1.12.0 Function was deprecated in this release.

Since
  1.8.0

See also
  H5Literate_by_name2(), H5Lvisit2(), H5Lvisit_by_name2()

## ◆ H5Literate2()

herr_t H5Literate2 | ( | hid_t | grp_id,
|  | H5_index_t | idx_type,
|  | H5_iter_order_t | order,
|  | hsize_t * | idx,
|  | H5L_iterate2_t | op,
|  | void * | op_data )

Iterates over links in a group, with user callback routine, according to the order within an index.

Parameters

  [in] | grp_id | Group identifier
  [in] | idx_type | Index type
  [in] | order | Iteration order
  [in,out] | idx | Pointer to an iteration index to allow continuing a previous iteration
  [in] | op | Callback function
  [in,out] | op_data | User-defined callback function context

Returns
  Success: The return value of the first operator that returns non-zero, or zero if all members were processed with no operator returning non-zero.
  Failure: Negative if an error occurs in the library, or the negative value returned by one of the operators.

H5Literate2() iterates through the links in a file or group, `group_id`, in the order of the specified index, `idx_type`, using a user-defined callback routine `op`. H5Literate2() does not recursively follow links into subgroups of the specified group.

Three parameters are used to manage progress of the iteration: `idx_type`, `order`, and `idx_p`.

`idx_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 unnecessary, so the iteration may begin more quickly. Valid values include the following:

H5_INDEX_NAME | Lexicographic order on name
H5_INDEX_CRT_ORDER | Index on creation order

`order` specifies the order in which objects are to be inspected along the index `idx_type`. Valid values include the following:

H5_ITER_INC | Increasing order
H5_ITER_DEC | Decreasing order
H5_ITER_NATIVE | Fastest available order

`idx_p` tracks the iteration and allows an iteration to be resumed if it was stopped before all members were processed. It is passed in by the application with a starting point and returned by the library with the point at which the iteration stopped.

`op_data` 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. `op` is invoked for each link encounter.

`op_data` is passed to and from each iteration and can be used to supply or aggregate information across iterations.

Remarks
  Same pattern of behavior as H5Giterate().

Note
  This function is also available through the H5Literate() macro.

Warning
  The behavior of H5Literate2() is undefined if the link membership of `group_id` changes during the iteration. This does not limit the ability to change link destinations while iterating, but caution is advised.

Attention
  Leaving callback functions:
  The callback function must return normally, even in the case of error. Returning with H5_ITER_ERROR, instead of leaving by means of exceptions, exit() function, etc... will allow the HDF5 library to manage its resources and maintain a consistent state. See C++ Developers using HDF5 C-API functions warning for detail.

Since
  1.12.0

See also
  H5Literate_by_name2(), H5Lvisit2(), H5Lvisit_by_name2()

## ◆ H5Literate_by_name1()

herr_t H5Literate_by_name1 | ( | hid_t | loc_id,
|  | const char * | group_name,
|  | H5_index_t | idx_type,
|  | H5_iter_order_t | order,
|  | hsize_t * | idx,
|  | H5L_iterate1_t | op,
|  | void * | op_data,
|  | hid_t | lapl_id )

Iterates through links in a group by its name.

Parameters

  [in] | loc_id | Location identifier
  [in] | group_name | Group name
  [in] | idx_type | Index type
  [in] | order | Iteration order
  [in,out] | idx | iteration position at which to start (IN) or position at which an interrupted iteration may be restarted (OUT)
  [in] | op | Callback function
  [in,out] | op_data | User-defined callback function context
  [in] | lapl_id | Link access property list identifier

Returns
  Success: The return value of the first operator that returns non-zero, or zero if all members were processed with no operator returning non-zero.
  Failure: Negative if an error occurs in the library, or the negative value returned by one of the operators.

Deprecated
  As of HDF5-1.12 this function has been deprecated in favor of the function H5Literate_by_name2() or the macro H5Literate_by_name().

H5Literate_by_name1() iterates through the links in a group specified by `loc_id` and `group_name`, in the order of the specified index, `idx_type`, using a user-defined callback routine `op`. H5Literate_by_name1() does not recursively follow links into subgroups of the specified group.

`idx_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 unnecessary, so the iteration may begin more quickly. Valid values include the following:

H5_INDEX_NAME | Lexicographic order on name
H5_INDEX_CRT_ORDER | Index on creation order

`order` specifies the order in which objects are to be inspected along the index specified in `idx_type`. Valid values include the following:

H5_ITER_INC | Increasing order
H5_ITER_DEC | Decreasing order
H5_ITER_NATIVE | Fastest available order

`idx` allows an interrupted iteration to be resumed; it is passed in by the application with a starting point and returned by the library with the point at which the iteration stopped.

Warning
  H5Literate_by_name1() assumes that the membership of the group being iterated over remains unchanged through the iteration; if any of the links in the group change during the iteration, the function's behavior is undefined. Note, however, that objects pointed to by the links can be modified.

Note
  H5Literate_by_name1() is not recursive. In particular, if a member of `group_name` is found to be a group, call it `subgroup_a`, H5Literate_by_name1() does not examine the members of `subgroup_a`. When recursive iteration is required, the application must handle the recursion, explicitly calling H5Literate_by_name1() on discovered subgroups.

Attention
  Leaving callback functions:
  The callback function must return normally, even in the case of error. Returning with H5_ITER_ERROR, instead of leaving by means of exceptions, exit() function, etc... will allow the HDF5 library to manage its resources and maintain a consistent state. See C++ Developers using HDF5 C-API functions warning for detail.

Note
  H5Literate_by_name1() is the same as H5Giterate(), except that H5Giterate() always proceeds in lexicographic order.

Version
  1.12.0 Function H5Literate_by_name() was renamed to H5Literate_by_name1() and deprecated.
  1.8.8 Fortran subroutine added.

Since
  1.8.0

## ◆ H5Literate_by_name2()

herr_t H5Literate_by_name2 | ( | hid_t | loc_id,
|  | const char * | group_name,
|  | H5_index_t | idx_type,
|  | H5_iter_order_t | order,
|  | hsize_t * | idx,
|  | H5L_iterate2_t | op,
|  | void * | op_data,
|  | hid_t | lapl_id )

Iterates through links in a group.

Parameters

  [in] | loc_id | Location identifier
  [in] | group_name | Group name
  [in] | idx_type | Index type
  [in] | order | Iteration order
  [in,out] | idx | iteration position at which to start (IN) or position at which an interrupted iteration may be restarted (OUT)
  [in] | op | Callback function
  [in,out] | op_data | User-defined callback function context
  [in] | lapl_id | Link access property list identifier

Returns
  Success: The return value of the first operator that returns non-zero, or zero if all members were processed with no operator returning non-zero.
  Failure: Negative if an error occurs in the library, or the negative value returned by one of the operators.

H5Literate_by_name2() iterates through the links in a group specified by `loc_id` and `group_name`, in the order of the specified index, `idx_type`, using a user-defined callback routine `op`. H5Literate_by_name2() does not recursively follow links into subgroups of the specified group.

`idx_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 unnecessary, so the iteration may begin more quickly. Valid values include the following:

H5_INDEX_NAME | Lexicographic order on name
H5_INDEX_CRT_ORDER | Index on creation order

`order` specifies the order in which objects are to be inspected along the index specified in `idx_type`. Valid values include the following:

H5_ITER_INC | Increasing order
H5_ITER_DEC | Decreasing order
H5_ITER_NATIVE | Fastest available order

`idx_p` allows an interrupted iteration to be resumed; it is passed in by the application with a starting point and returned by the library with the point at which the iteration stopped.

Warning
  H5Literate_by_name2() assumes that the membership of the group being iterated over remains unchanged through the iteration; if any of the links in the group change during the iteration, the function's behavior is undefined. Note, however, that objects pointed to by the links can be modified.

Note
  H5Literate_by_name2() is not recursive. In particular, if a member of `group_name` is found to be a group, call it `subgroup_a`, H5Literate_by_name2() does not examine the members of `subgroup_a`. When recursive iteration is required, the application must handle the recursion, explicitly calling H5Literate_by_name2() on discovered subgroups.
  H5Literate_by_name2() is the same as H5Literate2(), except that H5Literate2() always proceeds in alphanumeric order.

Attention
  Leaving callback functions:
  The callback function must return normally, even in the case of error. Returning with H5_ITER_ERROR, instead of leaving by means of exceptions, exit() function, etc... will allow the HDF5 library to manage its resources and maintain a consistent state. See C++ Developers using HDF5 C-API functions warning for detail.

Since
  1.12.0

See also
  H5Literate(), H5Lvisit()

## ◆ H5Lvisit1()

herr_t H5Lvisit1 | ( | hid_t | grp_id,
|  | H5_index_t | idx_type,
|  | H5_iter_order_t | order,
|  | H5L_iterate1_t | op,
|  | void * | op_data )

Recursively visits all links starting from a specified group.

Parameters

  [in] | grp_id | Group identifier
  [in] | idx_type | Index type
  [in] | order | Iteration order
  [in] | op | Callback function
  [in,out] | op_data | User-defined callback function context

Returns
  Success: The return value of the first operator that returns non-zero, or zero if all members were processed with no operator returning non-zero.
  Failure: Negative if an error occurs in the library, or the negative value returned by one of the operators.

Deprecated
  As of HDF5-1.12 this function has been deprecated in favor of the function H5Lvisit2() or the macro H5Lvisit().

H5Lvisit1() 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 H5Literate1().

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

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

`idx_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 unnecessary, so the iteration may begin more quickly. Valid values include the following:

H5_INDEX_NAME | Lexicographic order on name
H5_INDEX_CRT_ORDER | Index on creation order

Note that the index type passed in `idx_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 lexicographic 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 `idx_type`. Valid values include the following:

H5_ITER_INC | Increasing order
H5_ITER_DEC | Decreasing order
H5_ITER_NATIVE | Fastest available order

`op` is a callback function of type H5L_iterate1_t that is invoked for each link encountered.

typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_t *info, void *op_data);

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

typedef struct {
H5L_type_t type;
bool corder_valid;
int64_t corder;
H5T_cset_t cset;
union {
haddr_t address;
size_t val_size;
} u;
} H5L_info1_t;

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

- Zero causes the visit iterator to continue, returning zero when all group members have been processed.
- A positive value causes the visit iterator to immediately return that positive value, indicating short-circuit success.
- A negative value causes the visit iterator to immediately return that value, indicating failure.

The H5Lvisit1() `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.

H5Lvisit1() and H5Ovisit1() 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.

Attention
  Leaving callback functions:
  The callback function must return normally, even in the case of error. Returning with H5_ITER_ERROR, instead of leaving by means of exceptions, exit() function, etc... will allow the HDF5 library to manage its resources and maintain a consistent state. See C++ Developers using HDF5 C-API functions warning for detail.

Version
  1.12.0 Function was renamed from H5Lvisit() to H5Lvisit1() and deprecated.

Since
  1.8.0

## ◆ H5Lvisit2()

herr_t H5Lvisit2 | ( | hid_t | grp_id,
|  | H5_index_t | idx_type,
|  | H5_iter_order_t | order,
|  | H5L_iterate2_t | op,
|  | void * | op_data )

Recursively visits all links starting from a specified group.

Parameters

  [in] | grp_id | Group identifier
  [in] | idx_type | Index type
  [in] | order | Iteration order
  [in] | op | Callback function
  [in,out] | op_data | User-defined callback function context

Returns
  Success: The return value of the first operator that returns non-zero, or zero if all members were processed with no operator returning non-zero.
  Failure: Negative if an error occurs in the library, or the negative value returned by one of the operators.

H5Lvisit2() 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 H5Literate2().

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

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

`idx_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 unnecessary, so the iteration may begin more quickly. Valid values include the following:

H5_INDEX_NAME | Lexicographic order on name
H5_INDEX_CRT_ORDER | Index on creation order

Note that the index type passed in `idx_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 lexicographic 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 `idx_type`. Valid values include the following:

H5_ITER_INC | Increasing order
H5_ITER_DEC | Decreasing order
H5_ITER_NATIVE | Fastest available order

`op` is a callback function of type H5L_iterate2_t that is invoked for each link encountered.

typedef herr_t (*H5L_iterate2_t)(hid_t group, const char *name, const H5L_info2_t *info, void *op_data);

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

typedef struct {
H5L_type_t type;
bool corder_valid;
int64_t corder;
H5T_cset_t cset;
union {
H5O_token_t token;
size_t val_size;
} u;
} H5L_info2_t;

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

- Zero causes the visit iterator to continue, returning zero when all group members have been processed.
- A positive value causes the visit iterator to immediately return that positive value, indicating short-circuit success.
- A negative value causes the visit iterator to immediately return that value, indicating failure.

The H5Lvisit2() `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.

H5Lvisit2() and H5Ovisit2() 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.

Attention
  Leaving callback functions:
  The callback function must return normally, even in the case of error. Returning with H5_ITER_ERROR, instead of leaving by means of exceptions, exit() function, etc... will allow the HDF5 library to manage its resources and maintain a consistent state. See C++ Developers using HDF5 C-API functions warning for detail.

Since
  1.12.0

See also
  H5Literate()

## ◆ H5Lvisit_by_name1()

herr_t H5Lvisit_by_name1 | ( | hid_t | loc_id,
|  | const char * | group_name,
|  | H5_index_t | idx_type,
|  | H5_iter_order_t | order,
|  | H5L_iterate1_t | op,
|  | void * | op_data,
|  | hid_t | lapl_id )

Recursively visits all links starting from a specified group.

Parameters

  [in] | loc_id | Location identifier
  [in] | group_name | Group name
  [in] | idx_type | Index type
  [in] | order | Iteration order
  [in] | op | Callback function
  [in,out] | op_data | User-defined callback function context
  [in] | lapl_id | Link access property list identifier

Returns
  Success: The return value of the first operator that returns non-zero, or zero if all members were processed with no operator returning non-zero.
  Failure: Negative if an error occurs in the library, or the negative value returned by one of the operators.

Deprecated
  As of HDF5-1.12 this function has been deprecated in favor of the function H5Lvisit_by_name2() or the macro H5Lvisit_by_name().

H5Lvisit_by_name1() 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 H5Literate1().

The group serving as the root of the iteration is specified by the `loc_id` / `group_name` parameter pair. `loc_id` specifies a file or group; group_name specifies either a group in the file (with an absolute name based in the file's root group) or a group relative to `loc_id`. If `loc_id` fully specifies the group that is to serve as the root of the iteration, group_name should be '.' (a dot). (Note that when `loc_id` fully specifies the group that is to serve as the root of the iteration, the user may wish to consider using H5Lvisit1() instead of H5Lvisit_by_name1().)

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

`idx_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 unnecessary, so the iteration may begin more quickly. Valid values include the following:

H5_INDEX_NAME | Lexicographic order on name
H5_INDEX_CRT_ORDER | Index on creation order

Note that the index type passed in `idx_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 lexicographic 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 `idx_type`. Valid values include the following:

H5_ITER_INC | Increasing order
H5_ITER_DEC | Decreasing order
H5_ITER_NATIVE | Fastest available order

The `op` callback function, the related H5L_info1_t `struct`, and the effect that the callback function's return value has on the application are described in H5Lvisit1().

The H5Lvisit_by_name1() `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 callback function's `op_data` parameter.

`lapl_id` is a link access property list. 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 H5Pset_elink_prefix()).

H5Lvisit_by_name1() and H5Ovisit_by_name1() 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.

Attention
  Leaving callback functions:
  The callback function must return normally, even in the case of error. Returning with H5_ITER_ERROR, instead of leaving by means of exceptions, exit() function, etc... will allow the HDF5 library to manage its resources and maintain a consistent state. See C++ Developers using HDF5 C-API functions warning for detail.

Version
  1.12.0 Function renamed from H5Lvisit_by_name() to H5Lvisit_by_name1() and deprecated.

Since
  1.8.0

## ◆ H5Lvisit_by_name2()

herr_t H5Lvisit_by_name2 | ( | hid_t | loc_id,
|  | const char * | group_name,
|  | H5_index_t | idx_type,
|  | H5_iter_order_t | order,
|  | H5L_iterate2_t | op,
|  | void * | op_data,
|  | hid_t | lapl_id )

Recursively visits all links starting from a specified group.

Parameters

  [in] | loc_id | Location identifier
  [in] | group_name | Group name
  [in] | idx_type | Index type
  [in] | order | Iteration order
  [in] | op | Callback function
  [in,out] | op_data | User-defined callback function context
  [in] | lapl_id | Link access property list identifier

Returns
  Returns a non-negative value if successful; otherwise, returns a negative value.

H5Lvisit_by_name2() 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 H5Literate2().

The group serving as the root of the iteration is specified by the `loc_id` / `group_name` parameter pair. `loc_id` specifies a file or group; group_name specifies either a group in the file (with an absolute name based in the file's root group) or a group relative to `loc_id`. If `loc_id` fully specifies the group that is to serve as the root of the iteration, group_name should be '.' (a dot). (Note that when `loc_id` fully specifies the group that is to serve as the root of the iteration, the user may wish to consider using H5Lvisit2() instead of H5Lvisit_by_name2().)

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

`idx_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 unnecessary, so the iteration may begin more quickly. Valid values include the following:

H5_INDEX_NAME | Lexicographic order on name
H5_INDEX_CRT_ORDER | Index on creation order

Note that the index type passed in `idx_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 lexicographic 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 `idx_type`. Valid values include the following:

H5_ITER_INC | Increasing order
H5_ITER_DEC | Decreasing order
H5_ITER_NATIVE | Fastest available order

The `op` callback function, the related H5L_info2_t `struct`, and the effect that the callback function's return value has on the application are described in H5Lvisit2().

The H5Lvisit_by_name2() `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 callback function's `op_data` parameter.

`lapl_id` is a link access property list. 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 H5Pset_elink_prefix()).

H5Lvisit_by_name2() and H5Ovisit_by_name2() 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.

Attention
  Leaving callback functions:
  The callback function must return normally, even in the case of error. Returning with H5_ITER_ERROR, instead of leaving by means of exceptions, exit() function, etc... will allow the HDF5 library to manage its resources and maintain a consistent state. See C++ Developers using HDF5 C-API functions warning for detail.

Since
  1.12.0