SpiceBoolean set_c ( SpiceCell * a,
ConstSpiceChar * op,
SpiceCell * b )
Given a relational operator, compare two sets of any data type.
CELLS, SETS
CELLS, SETS
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
a I First set.
op I Comparison operator.
b I Second set.
The function returns the result of the comparison: a (op) b.
a is a CSPICE set. a must be declared as a character,
double precision, or integer SpiceCell.
op is a comparison operator, indicating the way in
which the input sets are to be compared. op may
be any of the following:
Operator Meaning
-------- -------------------------------------
"=" a = b is true if a and b are equal
(contain the same elements).
"<>" a <> b is true if a and b are not
equal.
"<=" a <= b is true if a is a subset of b.
"<" a < b is true if a is a proper subset
of b.
">=" a >= b is true if b is a subset of a.
">" a > b is true if b is a proper subset
of a.
"&" a & b is true if a and b have one or more
elements in common (the intersection of
the two sets in non-empty.)
"~" a ~ b is true if a and b are disjoint
sets.
When comparing elements of character sets, this routine
ignores trailing blanks.
b is a CSPICE set of the same data type as a.
The function returns the result of the comparison: a (op) b.
None.
1) If the set relational operator is not recognized, the error
SPICE(INVALIDOPERATION) is signaled.
2) The error SPICE(EMPTYSTRING) is signaled if the input operator
string does not contain at least one character, since this
input string cannot be converted to a Fortran-style string
in this case.
3) The error SPICE(NULLPOINTER) is signalled if the input operator
string pointer is null.
4) If the input set arguments don't have identical data types,
the error SPICE(TYPEMISMATCH) is signaled.
5) If either of the input set arguments may be unordered or contain
duplicates, the error SPICE(NOTASET) is signaled.
None.
None.
1) In the following code fragment, set_c is used to repeat an operation
for as long as the integer set finished remains a proper
subset of the integer set planned.
#include "SpiceUsr.h"
.
.
.
while ( set_c( &finished, "<", &planned ) )
{
.
.
.
}
2) In the following example, let the integer sets a, b, and c
contain the elements listed below. Let e be an empty integer
set.
a b c
--- --- ---
1 1 1
2 3 3
3
4
Then all of the following expressions are SPICETRUE.
set_c ( b, "=", c ) "b is equal to c"
set_c ( a, "<>", c ) "a is not equal to c"
set_c ( a, ">", b ) "a is a proper superset of b"
set_c ( b, "<=", c ) "b is a subset of c"
set_c ( c, "<=", b ) "c is a subset of b"
set_c ( a, "<=", a ) "a is a subset of a"
set_c ( e, "<=", b ) "e is a subset of b"
set_c ( e, "<", b ) "e is a proper subset of b"
set_c ( e, "<=", e ) "e is a subset of e"
set_c ( a, "&", b ) "a has elements in common with b."
set_c ( b, "&", c ) "b has elements in common with c."
And all of the following are SPICEFALSE.
set_c ( b, "<>", c ) "b is not equal to c"
set_c ( a, "=", c ) "a is equal to c"
set_c ( a, "<", b ) "a is a proper subset of b"
set_c ( b, "<", c ) "b is a proper subset of c"
set_c ( b, ">=", a ) "b is a superset of a"
set_c ( a, ">", a ) "a is a proper superset of a"
set_c ( e, ">=", a ) "e is a superset of a"
set_c ( e, "<", e ) "e is a proper subset of e"
set_c ( a, "~", b ) "a and b are disjoint sets."
1) String comparisons performed by this routine are Fortran-style:
trailing blanks in the input sets 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)
H.A. Neilan (JPL)
W.L. Taber (JPL)
I.M. Underwood (JPL)
-CSPICE Version 1.1.0, 15-FEB-2005 (NJB)
Bug fix: loop bound changed from 1 to 2 in loop used
to free dynamically allocated arrays.
-CSPICE Version 1.0.0, 08-AUG-2002 (NJB) (CAC) (WLT) (IMU)
compare sets
Link to routine set_c source file set_c.c
|