Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.stsci.edu/~sontag/spicedocs/cspice/card_c.html
Дата изменения: Sat Dec 17 06:08:32 2005 Дата индексирования: Sun Apr 10 22:51:30 2016 Кодировка: |
Return the cardinality (current number of elements) in a cell of any data type.
CELLS
VARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- cell I Input cell. The function returns the cardinality of the input cell.
cell is a cell of character, double precision, or integer data type.
The function returns the cardinality of (current number of elements in) the input cell.
None.
This is a generic function which may be used on SpiceCells of character, double precision, or integer data type.
The cardinality function card_c is typically used to process each of the elements of a cell. In the following example, cardc_c is used to step through the individual elements of the character cell names. #include "SpiceUsr.h" . . . /. Declare the cell names with string length LNSIZE and maximum number of strings SIZE. ./ SPICECHAR_CELL ( names, SIZE, LNSIZE ); . . . for ( i = 0; i < card_c(&names); i++ ) { . . . } In conjunction with the size_c function, card_c may be used to predict (and subsequently avoid) overflows when manipulating cells. In the following example, size_c is used to determine whether the integer cell original can be safely copied into the integer cell save before actually attempting the operation. If original contains more elements than save can hold, then the operation would fail. if ( card_c(&original) <= size_c(&save) ) { copy_c ( &original, &save ); } else { . . . }
None.
1) If the input cell has invalid cardinality, the error SPICE(INVALIDCARDINALITY) is signaled. card_c returns an unspecified value in this case. 2) If the input array has invalid size, the error SPICE(INVALIDSIZE) is signaled. card_c returns an unspecified value in this case.
None.
N.J. Bachman (JPL) C.A. Curzon (JPL) H.A. Neilan (JPL) W.L. Taber (JPL) I.M. Underwood (JPL)
None.
-CSPICE Version 1.0.0, 06-AUG-2002 (NJB) (CAC) (HAN) (WLT) (IMU)
cardinality of an integer cell