18.4.2 Creating the Groups that Contain the Dataset

Topic Version1Published09/11/2015
For StandardRESQML v2.0.1

Groups are handled slightly differently when writing to a file: HDF5 does not create groups automatically when a Dataset path is supplied. Your application must do one of the following:

  • If a group doesn’t yet exist, explicitly create each group.
  • If a group does exist, open it before creating the dataset.

With the current HDF5 format, only two groups are required:

  • The top-level RESQML group.
  • A group for the object being stored, which has the object’s GUID as its name.

The top-level group is created using the FileID:


hid_t RESQMLGroup = H5Gcreate2(FileID, “RESQML”, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);

The object group is created using the RESQMLGroupID:


hid_t ObjectGroupID = H5Gcreate2(RESQMLGroup, ObjectGuidString, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);

Remember to close these IDs when you are finished with them.