SpiceBoolean elemc_c ( ConstSpiceChar * item,
SpiceCell * set )
Determine whether an item is an element of a character set.
SETS
CELLS, SETS
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.
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.
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.
None.
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.
None.
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.
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 )
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.
None.
N.J. Bachman (JPL)
C.A. Curzon (JPL)
H.A. Neilan (JPL)
W.L. Taber (JPL)
I.M. Underwood (JPL)
-CSPICE Version 1.0.0, 21-AUG-2002 (NJB) (CAC) (HAN) (WLT) (IMU)
element of a character set
Link to routine elemc_c source file elemc_c.c
|