Index Page
size_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

   SpiceInt size_c ( SpiceCell  * cell )


Abstract

 
   Return the size (maximum cardinality) of a SPICE cell of any 
   data type. 
 

Required_Reading

 
   CELLS 
 

Keywords

 
   CELLS 
 

Brief_I/O

 
   VARIABLE  I/O  DESCRIPTION 
   --------  ---  -------------------------------------------------- 
   cell       I   Input cell. 
 
   The function returns the size of the input cell. 
 

Detailed_Input

 
 
    cell        is a CSPICE cell of any data type.  Cell must be
                declared as a character, double precision, or 
                integer SpiceCell.
 

Detailed_Output

 
   The function returns the size of (maximum number of elements in) 
   the input cell. 
 

Parameters

 
   None. 
 

Exceptions

 
   1)  If the input array has invalid cardinality, the error 
       SPICE(INVALIDCARDINALITY) is signaled.  size_c returns 
       an unspecified value in this case. 
 
   2)  If the input array has invalid size, the error 
       SPICE(INVALIDSIZE) is signaled.  size_c returns 
       an unspecified value in this case. 
 

Files

 
   None. 
 

Particulars

 
   None. 
 

Examples

 
   The size_c function is typically used in conjunction 
   with the card_c function 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 is capable of holding, then the operation 
   will fail.) 
 
      #include "SpiceUsr.h"
           . 
           . 
           . 
      /.
      Declare the cells original and save with string length
      LNSIZE and maximum  number of strings SIZE1 and SIZE2
      respectively.
      ./
      SPICECHAR_CELL ( original, SIZE1, LNSIZE );
      SPICECHAR_CELL ( save,     SIZE2, LNSIZE );
           . 
           . 
           . 
      if ( card_c(&original) <= size_c(&save) )
      {
         copy_c ( &original, &save );
      }
      else
      {
         [ Handle overflow case ]
           . 
           . 
           . 
      }
          
 

Restrictions

 
   None. 
 

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, 06-AUG-2002 (NJB) (CAC) (HAN) (WLT) (IMU)

Index_Entries

 
   size of a cell 
 
Wed Apr  5 17:54:43 2017