H5Lvisit_by_name
(
hid_t loc_id
,
const char *group_name
,
H5_index_t index_type
,
H5_iter_order_t order
,
H5L_iterate_t op
,
void *op_data
,
hid_t lapl_id
)
H5Lvisit_by_name
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
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 the
group that is to serve as the root of the iteration,
the user may wish to consider using
H5Lvisit
instead of H5Lvisit_by_name
.)
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 op
callback funtion,
the related H5L_info_t struct,
and the effect that the callback function’s return value has
on the application are described in
H5Lvisit
.
The H5Lvisit_by_name
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_name
and
H5Ovisit_by_name
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.
If a C routine that takes a function pointer as an argument is called from within C++ code, the C routine should be returned from normally.
Examples of this kind of routine include callbacks such as
H5Pset_elink_cb
and H5Pset_type_conv_cb
and functions such as H5Tconvert
and
H5Ewalk2
.
Exiting the routine in its normal fashion allows the HDF5 C Library to clean up its work properly. In other words, if the C++ application jumps out of the routine back to the C++ “catch” statement, the library is not given the opportunity to close any temporary data structures that were set up when the routine was called. The C++ application should save some state as the routine is started so that any problem that occurs might be diagnosed.
hid_t loc_id
|
IN: Identifier of a file or group |
const char *name
|
IN: Name of the group,
generally relative to loc_id ,
that will serve as root of the iteration
|
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 |
hid_t lapl_id
|
IN: Link access property list identifier |
On failure, returns a negative value if something goes wrong within the library, or the first negative value returned by an operator.
Release | C |
1.8.0 | Function introduced in this release. |