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

Table of contents

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

       scard_c ( Set the cardinality of a cell )

       void scard_c (  SpiceInt      card,
                       SpiceCell   * cell  )

#### Abstract

       Set the cardinality of a SPICE cell of any data type.

#### Required_Reading

       CELLS

#### Keywords

       CELLS

#### Brief_I/O

       VARIABLE  I/O  DESCRIPTION
       --------  ---  --------------------------------------------------
       card       I   Cardinality of (number of elements in) the cell.
       cell       O   The cell.

#### Detailed_Input

       card        is the cardinality of (number of elements in) the cell.

#### Detailed_Output

       cell        is a SpiceCell of any data type. On output, the cardinality of
                   the cell is `card'. The data portion of the cell is left
                   unchanged.

                   If the cardinality is set to zero, the cell becomes a SPICE
                   set: the cell's "is a set?" attribute becomes true. The cell
                   then can be used as an input to the SPICE set routines such as
                   insrtX_c.

                   `cell' must be declared as a character, double precision or
                   integer SpiceCell.

                   CSPICE provides the following macros, which declare and
                   initialize the cell

                      SPICECHAR_CELL          ( cell, CELLSZ, CELLMLEN );
                      SPICEDOUBLE_CELL        ( cell, CELLSZ );
                      SPICEINT_CELL           ( cell, CELLSZ );

                   where CELLSZ is the maximum capacity of `cell' and CELLMLEN is
                   the maximum length of any member in the character cell.

#### Parameters

       None.

#### Exceptions

       1)  If the `cell' cell arguments does not have a recognized data
           type, the error SPICE(NOTSUPPORTED) is signaled.

       2)  If the cardinality value supplied is less than 0 or greater
           than the cell size, the error SPICE(INVALIDCARDINALITY) is
           signaled.

#### Files

       None.

#### Particulars

       The set cardinality (scard_c) and set size (ssize_c) routines are
       typically used to initialize cells for subsequent use.

       The set cardinality routines are also used by library routines which
       manipulate cells (including set and window routines) to reset the
       cardinalities of cells as they gain or lose elements.

#### Examples

       1) Declare an integer cell. Populate the cell, then reset
          the cardinality to zero to effectively make room in the
          cell.

             #include "SpiceUsr.h"
                   .
                   .
                   .

             #define SIZE          10

             Spiceint              i;

             /.
             Declare a cell with room for SIZE integers.
             ./
             SPICEINT_CELL         ( icell, SIZE );

             /.
             Fill in the cell with integers 0 through 9.
             ./

             for ( i = 0;  i < SIZE;  i++ )
             {
                appndi_c ( i, &icell );
             }
                   .
                   .
                   .
             /.
             Make room in the cell.
             ./
             scard_c ( 0, &icell );
                   .
                   .
                   .

#### Restrictions

       None.

#### Literature_References

       None.

#### Author_and_Institution

       N.J. Bachman        (JPL)
       C.A. Curzon         (JPL)
       J. Diaz del Rio     (ODC Space)
       W.L. Taber          (JPL)
       I.M. Underwood      (JPL)

#### Version

       -CSPICE Version 1.0.1, 24-NOV-2021 (JDR)

           Edited the header to comply with NAIF standard.

           Extended description of argument "cell" in -Detailed_Output to include
           type and preferred declaration method.

           Added entry #1 in -Exceptions section.

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

#### Index_Entries

       set the cardinality of an integer cell

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

    Fri Dec 31 18:41:11 2021