Table of contents
CSPICE_APPNDI appends an item or list of items to an integer cell.
Given:
item an integer value which is to be appended to `cell'.
help, item
LONG = Scalar or LONG = Array[N]
cell an integer SPICE cell to which `item' will be appended.
help, cell
STRUCT = cspice_celli(N)
The user must create `cell' using cspice_celli.
the call:
cspice_appndi, item, cell
returns:
cell the input cell with `item' appended.
help, cell
STRUCT = cspice_celli(N)
`item' is the last member of `cell'.
If `cell' is actually a SPICE set on input and ceases to
qualify as a set as result of the requested append
operation, the `isSet' member of cell will be set to
False.
None.
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
1) Create a cell for fifteen elements, add a first element to
it and then append several more integer numbers. Validate
the cell into a set and print the result. Finally, append
another integer number. After each operation, check if the
cell constitutes a set or not.
Example code begins here.
PRO appndi_ex1
;;
;; Create a cell for fifteen elements.
;;
SIZE = 15
cell = cspice_celli( SIZE )
;;
;; Add a single item to the new cell
;;
cspice_appndi, 0L, cell
;;
;; Now insert a list of items.
;;
items = [ 1L, 1, 2, 3, 5, 8, 13, 21, 34 ]
cspice_appndi, items, cell
;;
;; Output the contents of 'set'. Recall
;; set data begins at 'set.base[ set.data + 0 ]'.
;;
print, 'Items in original cell A:'
for i=0, cspice_card(cell)-1 do begin
print, FORMAT='(I6,$)', cell.base[ cell.data + i]
endfor
print, ' '
;;
;; After the append, does the cell key as a set?
;;
if( cell.isset ) then print, "Cell is a set after first append"
if( ~cell.isset ) then print, "Cell is not a set after first append"
;;
;; Validate the cell as a set.
;;
cspice_valid, SIZE, SIZE, cell
print, ' '
print, 'Items in cell A after cspice_valid:'
for i=0, cspice_card(cell)-1 do begin
print, FORMAT='(I6,$)', cell.base[ cell.data + i]
endfor
print, ' '
if( cell.isset ) then print, "Cell is a set after cspice_valid"
if( ~cell.isset ) then print, "Cell is not a set cspice_valid"
;;
;; Append a new value to the cell, the value being less than all
;; other set values.
;;
cspice_appndi, -22L, cell
print, ' '
print, 'Items in cell A after second append:'
for i=0, cspice_card(cell)-1 do begin
print, FORMAT='(I6,$)', cell.base[ cell.data + i]
endfor
print, ' '
;;
;; The data array does not satisfy the requirements for a set,
;; check the 'isset' flag indicates the change.
;;
if( cell.isset ) then print, "Cell is a set after second append"
if( ~cell.isset ) then print, "Cell is not a set after second append"
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Items in original cell A:
0 1 1 2 3 5 8 13 21 34
Cell is not a set after first append
Items in cell A after cspice_valid:
0 1 2 3 5 8 13 21 34
Cell is a set after cspice_valid
Items in cell A after second append:
0 1 2 3 5 8 13 21 34 -22
Cell is not a set after second append
Note that if the cell is not big enough to accommodate the
addition of an item, an error is signaled. In this case, the
cell is not altered.
The user must create any needed cell structures with cspice_celld or
cspice_celli prior to use regardless of whether the routine
uses the cell as input or returns it as output.
1) If the cell is not big enough to accommodate the addition of a
new element, the error SPICE(CELLTOOSMALL) is signaled by a
routine in the call tree of this routine.
2) If any of the input arguments, `item' or `cell', is undefined,
an error is signaled by the IDL error handling system.
3) If any of the input arguments, `item' or `cell', is not of the
expected type, or it does not have the expected dimensions and
size, an error is signaled by the Icy interface.
None.
None.
ICY.REQ
CELLS.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.4, 26-AUG-2021 (JDR)
Edited the header to comply with NAIF standard. Added example's
problem statement and reformatted example's output.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.0.3, 13-JUN-2010 (EDW)
Minor edit to code comments eliminating typo.
-Icy Version 1.0.2, 19-JAN-2009 (EDW)
Edits to header text and spelling correction.
-Icy Version 1.0.0, 03-OCT-2006 (EDW)
append an item to an integer cell
|