HDF5 Tutorial:   Advanced Topics
Iterating over Group Members (HDF5 1.6)

Contents:


How to Iterate over Group Members Using C

This section discusses how to find names and object types of HDF5 group members using C.

The HDF5 Group interface includes the H5Giterate function, which iterates over the group members.

Operations on each group member can be performed during the iteration process by passing the operator function and its data to the iterator as parameters. There are no restrictions on what kind of operations can be performed on group members during the iteration procedure.

The following steps are involved:

  1. Write an operator function which will be used during the iteration process. The HDF5 library defines the operator function signature and return values.
  2. Open the group to iterate through.
  3. Iterate through the group or just a few members of the group.

How to Iterate Over Group Members using FORTRAN

There is no FORTRAN call to iterate over group members. Instead, this functionality is provided by two FORTRAN calls:

Programming Example

Description

In this example we iterate through the members of the root group. For details on compiling an HDF5 application: [ click here ]

Following is the output from these examples:

Output from C Example

  Objects in the root group are:

  Object with name Dataset1 is a dataset 
  Object with name Datatype1 is a named datatype 
  Object with name Group1 is a group 
Output from FORTRAN Example
 Number of root group member is 1
 MyGroup             1
 Number of group MyGroup member  is 2
 Group_A             1
 dset1               2
 Number of group MyGroup/Group_A member  is 1
 dset2               2

Remarks for C Example

Remarks for FORTRAN Example