5.8.5 Learn the Name of a Enum Type: NF_INQ_ENUM_IDENT
Get the name which is associated with an enum member value.
This is similar to NF_INQ_ENUM_MEMBER, but instead of using the index
of the member, you use the value of the member.
Usage
INTEGER FUNCTION NF_INQ_ENUM_IDENT(INTEGER NCID, INTEGER XTYPE,
INTEGER VALUE, CHARACTER*(*) IDENTIFIER)
NCID- The groupid where this enum type exists.
XTYPE- The typeid for this enum type.
VALUE- The value for which an identifier is sought.
IDENTIFIER- A character array that will get the identifier. It will have a maximum
length of NF_MAX_NAME.
Return Code
NF_NOERR- No error.
NF_EBADTYPEID- Bad type id, or not an enum type.
NF_EHDFERR- An error was reported by the HDF5 layer.
NF_EINVAL- The value was not found in the enum.
Example
In this example from nf_test/ftst_vars3.F, the values for 0 and 1 are
checked in an enum.
retval = nf_inq_enum_ident(ncid, typeids(1), 0, member_name)
if (retval .ne. nf_noerr) call handle_err(retval)
if (member_name(1:len(zero_name)) .ne. zero_name) stop 2
retval = nf_inq_enum_ident(ncid, typeids(1), 1, member_name)
if (retval .ne. nf_noerr) call handle_err(retval)
if (member_name(1:len(one_name)) .ne. one_name) stop 2