Index Page elemc_c

A B C D E F G H I J K L M N O P Q R S T U V W X

Procedure Abstract Required_Reading Keywords Brief_I/O Detailed_Input | Detailed_Output Parameters Exceptions Files Particulars Examples | Restrictions Literature_References Author_and_Institution Version Index_Entries

#### Procedure

       SpiceBoolean elemc_c ( ConstSpiceChar  * item,
                              SpiceCell       * set   )

#### Abstract

       Determine whether an item is an element of a character set.

#### Required_Reading

       SETS

#### Keywords

       CELLS, SETS

#### Brief_I/O

       VARIABLE  I/O  DESCRIPTION
       --------  ---  --------------------------------------------------
       item       I   Item to be tested.
       set        I   Set to be tested.

       The function returns SPICETRUE if item is an element of set.

#### Detailed_Input

       item        is an item which may or may not be an element of
                   the input set. Trailing blanks in item are not
                   significant.

       set         is a CSPICE set.  set must be declared as a character
                   SpiceCell.  Trailing blanks in the members of set are
                   not significant.

#### Detailed_Output

       The function returns SPICETRUE if item is a member of the specified
       set, and returns SPICEFALSE otherwise.

       The comparison between item and members of set is case-sensitive.
       Trailing blanks are ignored.

#### Parameters

       None.

#### Exceptions

       1) If the input set argument does not qualify as a CSPICE set,
          the error SPICE(NOTASET) will be signaled.  CSPICE sets have
          their data elements sorted in increasing order and contain
          no duplicate data elements.

       2) If the input set does not have character data type, the error
          SPICE(TYPEMISMATCH will be signaled.

       3) If the input string pointer is null, the error SPICE(NULLPOINTER)
          is signaled.

#### Files

       None.

#### Particulars

       The functions

          elemc_c
          elemd_c
          elemi_c

       provide a convenient shorthand notation for a binary search
       on a set's data array for the item of interest.

#### Examples

       Let the character sets planets and asteroids contain the
       following elements.

          planets            asteroids
          --------           ----------
          "Earth"            "Apollo"
          "Mars"             "Ceres"
          "Pluto"
          "Venus"

       Then all of the following expressions are SPICETRUE.

          elemc_c ( "Earth",  &planets   )
          elemc_c ( "Pluto",  &planets   )
          elemc_c ( "Ceres",  &asteroids )

       And all of the following expressions are SPICEFALSE.

          elemc_c ( "saturn", &planets   )
          elemc_c ( "pluto",  &asteroids )
          elemc_c ( "ceres",  &asteroids )

#### Restrictions

       1) String comparisons performed by this routine are Fortran-style:
          trailing blanks in the input array or key value are ignored.
          This gives consistent behavior with CSPICE code generated by
          the f2c translator, as well as with the Fortran SPICE Toolkit.

          Note that this behavior is not identical to that of the ANSI
          C library functions strcmp and strncmp.

#### Literature_References

       None.

#### Author_and_Institution

       N.J. Bachman    (JPL)
       C.A. Curzon     (JPL)
       H.A. Neilan     (JPL)
       W.L. Taber      (JPL)
       I.M. Underwood  (JPL)

#### Version

       -CSPICE Version 1.0.0, 21-AUG-2002 (NJB) (CAC) (HAN) (WLT) (IMU)

#### Index_Entries

       element of a character set

#### Link to routine elemc_c source file elemc_c.c

    Wed Apr  5 17:54:34 2017