Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Previous: NF_INQ_ENUM_MEMBER, Up: Enum Type



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
 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690