IN: Location identifier; may be a file, group, dataset, named datatype, or attribute
IN: Identifier of the datatype to use when creating the dataset
IN: Identifier of the dataspace to use when creating the dataset
IN: Dataset creation property list identifier
IN: Dataset access property list identifier
H5D_CREATE_ANON creates a dataset in the file specified by loc_id.
loc_id may be a file, group, dataset, named datatype or attribute. If an attribute, dataset, or named datatype is specified for loc_id then the dataset will be created at the location where the attribute, dataset, or named datatype is attached.
The dataset’s datatype and dataspace are specified by type_id and space_id, respectively. These are the datatype and dataspace of the dataset as it will exist in the file, which may differ from the datatype and dataspace in application memory.
Dataset creation properties are specified in the dataset creation property list dcpl_id. Dataset access properties are specified in the dataset access property list dapl_id.
H5D_CREATE_ANON returns a new dataset identifier. Using this identifier, the new dataset must be linked into the HDF5 file structure with H5O_LINK or it will be deleted from the file when the file is closed.
See H5D_CREATE for further details and considerations on the use of H5D_CREATE and H5D_CREATE_ANON.
The differences between this function and H5D_CREATE are as follows:
H5D_CREATE_ANON explicitly includes a dataset access property list. H5Dcreate always uses default dataset access properties.
H5D_CREATE_ANON neither provides the new dataset’s name nor links it into the HDF5 file structure; those actions must be performed separately through a call to H5O_LINK, which offers greater control over linking.
A dataset created with this function should be closed with H5D_CLOSE when the dataset is no longer needed so that resource leaks will not develop.
Returns a dataset identifier if successful; otherwise returns a negative value.
H5O_LINK— Creates a hard link to an object in an HDF5 file
H5D_CREATE— Creates a new dataset and links it to a location in the file
SUBROUTINE h5dcreate_f(loc_id, name, type_id, space_id, dset_id, &
hdferr, dcpl_id, lcpl_id, dapl_id)
INTEGER(HID_T), INTENT(IN) :: loc_id ! File or group identifier
CHARACTER(LEN=*), INTENT(IN) :: name ! Name of the dataset
INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier
INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier
INTEGER(HID_T), INTENT(OUT) :: dset_id ! Dataset identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code
! 0 on success and -1 on failure
INTEGER(HID_T), OPTIONAL, INTENT(IN) :: dcpl_id
! Dataset creation property list
INTEGER(HID_T), OPTIONAL, INTENT(IN) :: lcpl_id
! Link creation property list
INTEGER(HID_T), OPTIONAL, INTENT(IN) :: dapl_id
! Dataset access property list
END SUBROUTINE h5dcreate_f
H5D_CREATE is a macro that is mapped to either H5D_CREATE1 or H5D_CREATE2, depending on the needs of the application.
Such macros are provided to facilitate application compatibility. Their use and mappings are fully described in API Compatibility Macros in HDF5; we urge you to read that document closely.
When both the HDF5 library and the application are built and installed with no specific compatibility flags, H5D_CREATE is mapped to the most recent version of the function, currently H5D_CREATE2. If the library and/or application is compiled for Release 1.6 emulation, H5D_CREATE will be mapped to H5D_CREATE1. Function-specific flags are available to override these settings on a function-by-function basis when the application is compiled.
Specific compile-time compatibility flags and the resulting mappings are as follows:
No compatibility flag
Enable deprecated symbols
Disable deprecated symbols
Emulate Release 1.6 interface
H5Dcreate_vers = 2
H5Dcreate_vers = 1
A dataset created with this macro should be closed with H5D_CLOSE when the dataset is no longer needed so that resource leaks will not develop.