>  Docs Center  >  Libraries  >  ASTROLIB  >  COPY_STRUCT_INX
Libraries

COPY_STRUCT_INX

COPY_STRUCT_INX

Name


COPY_STRUCT_INX

Purpose


Copy matching tags & specified indices from one structure to another

Explanation


  Copy all fields with matching tag names (except for "except_Tags")
from one structure array to another structure array of different type.
This allows copying of tag values when equating the structures of
different types is not allowed, or when not all tags are to be copied.
Can also recursively copy from/to structures nested within structures.
This procedure is same as copy_struct with option to
specify indices (subscripts) of which array elements to copy from/to.

Calling Sequence



copy_struct_inx, struct_From, struct_To, NT_copied, INDEX_FROM=subf
copy_struct_inx, struct_From, struct_To, INDEX_FROM=subf, INDEX_TO=subto

Inputs


struct_From = structure array to copy from.
struct_To = structure array to copy values to.

Keywords



INDEX_FROM = indices (subscripts) of which elements of array to copy.
(default is all elements of input structure array)
INDEX_TO = indices (subscripts) of which elements to copy to.
(default is all elements of output structure array)
EXCEPT_TAGS = string array of Tag names to ignore (to NOT copy).
Used at all levels of recursion.
SELECT_TAGS = Tag names to copy (takes priority over EXCEPT).
This keyword is not passed to recursive calls in order
to avoid the confusion of not copying tags in sub-structures.
/RECUR_FROM = search for sub-structures in struct_From, and then
call copy_struct recursively for those nested structures.
/RECUR_TO = search for sub-structures of struct_To, and then
call copy_struct recursively for those nested structures.
/RECUR_TANDEM = call copy_struct recursively for the sub-structures
with matching Tag names in struct_From and struct_To
(for use when Tag names match but sub-structure types differ).

Outputs


struct_To = structure array to which new tag values are copied.
NT_copied = incremented by total # of tags copied (optional)
  INTERNAL:
Recur_Level = # of times copy_struct_inx calls itself.
This argument is for internal recursive execution only.
The user call is 1, subsequent recursive calls increment it,
and the counter is decremented before returning.
The counter is used just to find out if argument checking
should be performed, and to set NT_copied = 0 first call.

External Calls


pro match (when keyword SELECT_TAGS is specified)

Procedure


Match Tag names and then use corresponding Tag numbers,
apply the sub-indices during = and recursion.

History


adapted from copy_struct: 1991 Frank Varosi STX @ NASA/GSFC
mod Aug.95 by F.V. to fix match of a single selected tag.
mod Mar.97 by F.V. do not pass the SELECT_TAGS keyword in recursion,
and check validity of INDEX_FROM and INDEX_TO in more detail.
Converted to IDL V5.0 W. Landsman September 1997
      Use long integers W. Landsman May 2001



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us