Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Content Layer
id1195548671
Content Column
width50.00001%
id1195578110
classrm_pagetree_col mobile-hide
Content Block
id1195578111
 
Content Column
width50.00001%
id1195548673
classhdf-rm-main-column
Content Block
id1195548672

Include Content
render-without-blockstrue
page.rm-navbar
HTML Wrap
classhdf-print-only

Page Title

HTML Wrap
classhdf-rm-summary-block

Hdf rm anchor
AnchorNamesummary

Excerpt

Recursively visits all objects accessible from a specified object

Note

 As of HDF5-1.12 this function has been deprecated in favor of the function H5O_VISIT3 or the macro H5O_VISIT.

HTML Wrap
classhdf-rm-content-block

Hdf rm anchor
AnchorNameprocedure

Procedure:
HTML Wrap
classhdf-rm-section
HTML Wrap
classhdf_procedure

H5O_VISIT1 ( obj_id, idx_type, order, op, op_data )

Hdf rm anchor
AnchorNamesignature

Signature:
HTML Wrap
classhdf-rm-section
HTML Wrap
classhdf-togglebox hdf-c

HTML Add Class
hdf-togglebutton-visible
hdf-togglebutton-visible
selector.hdf-togglebutton.hdf-c

HTML
<pre><code class="language-c">herr_t H5Ovisit1 ( hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op, void *op_data )</code></pre>
HTML Wrap
classhdf-togglebox hdf-fortran hdf-togglebox-hidden

HTML Add Class
hdf-togglebutton-visible
hdf-togglebutton-visible
selector.hdf-togglebutton.hdf-fortran

HTML
<pre><code class="language-fortran">SUBROUTINE h5ovisit_f(object_id, index_type, order, op, op_data, &
            return_value, hdferr)
    INTEGER(HID_T), INTENT(IN) :: object_id
    INTEGER, INTENT(IN) :: index_type 
    INTEGER, INTENT(IN) :: order

    TYPE(C_FUNPTR):: op
    TYPE(C_PTR)   :: op_data
    INTEGER, INTENT(OUT) :: return_value
    INTEGER, INTENT(OUT) :: hdferr</code></pre>

Hdf rm anchor
AnchorNameparameters

Parameters:
HTML Wrap
classhdf-rm-section
hid_t obj_idIN: Location identifier of the object at which the recursive iteration begins; may be a file, group, dataset, named datatype or attribute identifier
H5_index_t idx_typeIN: 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
H5O_iterate1_t opIN: Callback function passing data regarding the object to the calling application
void *op_dataIN: User-defined pointer to data required by the application for its processing of the object

Hdf rm anchor
AnchorNamedescription

Description:
HTML Wrap
classhdf-rm-section

H5O_VISIT1 is a recursive iteration function to visit the object obj_id and, if obj_id 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.

If obj_id is a group identifier, that group serves as the root of a recursive iteration. If obj_id is a file identifier, that file’s root group serves as the root of the recursive iteration. If obj_id is any other type of object, such as a dataset or named datatype, there is no iteration.

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

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:

H5_INDEX_NAMEAlpha-numeric index 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 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:

H5_ITER_INCIncreasing order
H5_ITER_DECDecreasing order
H5_ITER_NATIVE    Fastest available order

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

typedef herr_t (*H5O_iterate1_t)(hid_t obj, const char *name, const H5O_info1_t *info, void *op_data);

The parameters of this callback function have the following values or meanings:

objObject that serves as root of the iteration; same value as the H5O_VISIT1  obj_id parameter
nameName of object, relative to obj, being examined at current step of the iteration
info   
H5O_info1_t struct containing information regarding that object
op_dataUser-defined pointer to data required by the application in processing the object; a pass-through of the op_data pointer provided with the H5Ovisit_by_name function call

The H5O_info1_t struct is defined in H5Opublic.h:

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/hdf5_1_12
projectKeyHDFFV
filepathsrc/H5Opublic.h
fileEncodingUS-ASCII
lineStart255
progLangplain
lineEnd273
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

The return values from an operator are:

  • 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 H5O_VISIT1 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 op_data parameter. 

H5L_VISIT1 and H5O_VISIT1 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. These functions assume 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 resulting behavior is undefined.

Note

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.

Hdf rm anchor
AnchorNamereturns

Returns:
HTML Wrap
classhdf-rm-section

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.

Hdf rm anchor
AnchorNameexample

Example:
HTML Wrap
classhdf-rm-section
Comment
HTML Wrap
classhdf-togglebox hdf-c

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/1.10/master
projectKeyHDFFV
filepathexamples/h5_subset.c
showLineNumberstrue
lineStart32
progLangcpp
lineEnd42
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

HTML Wrap
classhdf-togglebox hdf-fortran hdf-togglebox-hidden

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/1.10/master
projectKeyHDFFV
filepathfortran/examples/compound.f90
showLineNumberstrue
lineStart25
progLangplain
lineEnd35
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

Hdf rm anchor
AnchorNamehistory

History:
HTML Wrap
classhdf-rm-section
Release    Change
1.10.5The macro H5O_VISIT was removed and the function H5O_VISIT1 was copied to H5O_VISIT
1.10.3Function H5O_VISIT was copied to H5O_VISIT1, and the macro H5O_VISIT was created.
1.8.8Fortran subroutine and data structure added.
1.8.0C function introduced.