H5O_VISIT_BY_NAME1 is a recursive iteration function to visit the object specified by the
obj_name parameter pair and, if that object is a group, all objects in and below it in an HDF5 file, thus providing a mechanism for an application to perform a common set of operations across all of those objects or a dynamically selected subset. For non-recursive iteration across the members of a group, see H5L_ITERATE1 .
The object serving as the root of the iteration is specified by the
obj_name parameter pair.
loc_id specifies a file or an object in a file;
obj_name specifies either an object in the file (with an absolute name based in the file’s root group) or an object name relative to
loc_id fully specifies the object that is to serve as the root of the iteration,
obj_name should be
'.' (a dot). (Note that when
loc_id fully specifies the the object that is to serve as the root of the iteration, the user may wish to consider using H5O_VISIT1 instead of H5O_VISIT_BY_NAME1.)
Two parameters are used to establish the iteration:
idx_type specifies the index to be used. If the links in a group 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:
|Alpha-numeric index on name|
|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 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
idx_type. Valid values include the following:
|Fastest available order|
op callback function and the effect of the callback function’s return value on the application are described in H5O_VISIT1.
The H5O_info1_t struct is defined in
H5Opublic.h and described in the H5O_GET_INFO1 function entry.
op_data parameter is a user-defined pointer to the data required to process objects in the course of the iteration. This pointer is passed back to each step of the iteration in the callback function’s
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 H5P_SET_ELINK_PREFIX).
H5L_VISIT_BY_NAME1 and H5O_VISIT_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.
Programming Note for C++ Developers Using C Functions:
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 H5P_SET_ELINK_CB and H5P_SET_TYPE_CONV_CB and functions such as H5T_CONVERT and H5E_WALK2.
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.