>  Docs Center  >  Libraries  >  ASTROLIB  >  MRD_STRUCT
Libraries

MRD_STRUCT

MRD_STRUCT

Name


      MRD_STRUCT

Purpose


      Return a structure as defined in the names and values data.

Calling Sequence


      struct = MRD_STRUCT(NAMES, VALUES, NROW, STRUCTYP='name' )

Input Parameters


      NAMES = A string array of names of structure fields.
      VALUES = A string array giving the values of the structure
                fields. See examples below.
      NROW = The number of elements in the structure array.
     

Returns


      A structure as described in the parameters or 0 if an error
      is detected.
  OPTIONAL KEYWORD PARAMETERS:
      /NO_EXECUTE - If set then the use of the EXECUTE() statement is avoided.
                  By default, the NO_EXECUTE pathway is used if IDL is
                  running under the Virtual Machine. Note if /NO_EXECUTE
                  is set, then the user cannot supply arbitary values, but
                  all possible values used by MRDFITS will be allowed.
      STRUCTYP = The structure type. Since IDL does not allow the
                  redefinition of a named structure it is an error
                  to call MRD_STRUCT with different parameters but
                  the same STRUCTYP in the same session. If this
                  keyword is not set an anonymous structure is created.

Common Blocks


      MRD_COMMON

Side Effects


      May create a temporary file if the structure definition is too long
      for the EXECUTE function and using old style structures

Restrictions


      By default, the program defines the structure in a long string
      which is executed with CREATE_STRUCT within a single EXECUTE statement.
      If program is being run in the IDL Virtual machine (EXECUTE statement
      not allowed), then a separate CREATE_STRUCT statement is called
      for each tag. This mode does not have the full capabilities of the
      normal mode, but should be sufficient for use with MRDFITS().

Procedure


      A structure definition is created using the parameter values.
      MRD_NSTRUCT is called and generates the structure in pieces using the
      execute and create_struct keywords.

Examples


      (1) str = mrd_struct(['fld1', 'fld2'], ['0','dblarr(10,10)'],3)
          print, str(0).fld2(3,3)
      Note that "0" is always considered short integer even if the default
      integer is set to long.
         
      (2) str = mrd_struct(['a','b','c','d'],['1', '1.', '1.d0', "'1'"],1)
              ; returns a structure with integer, float, double and string
              ; fields.

Procedure Calls


      GETTOK() - needed for virtual machine mode only

Modification History


      Created by T. McGlynn October, 1994.
      Modified by T. McGlynn September, 1995.
          Added capability to create substructures so that structure
          may contain up to 4096 distinct elements. [This can be
          increased by futher iteration of the process used if needed.]
      Removed V4.0 reference to common block October 1997
      Allowed unlimited number of structure elements if the version
      is greater than 5.0. Put back in code to handle prior versions.
      The [] will need to be translated back to () for this to
      work. T. McGlynn December 15 1998.
      Add MRD_NSTRUCT since IDL has mysterious problems compiling
      very large structures.
      Removed TEMPDIR and OLD_STRUCT keywords W. Landsman October 2003
      Alternate pathway without EXECUTE for V6.0 virtual machine, D. Lindler
      Removed limit on EXECUTE statement. W. Landsman October 2003
      Restore EXECUTE limit (sigh...), added NO_EXECUTE keyword
                        W. Landsman July 2004
      Fix use of STRUCTYP with /NO_EXECUTE W. Landsman June 2005
      Assume since V6.0 (lmgr function available), remove 131 string length
            limit for execute W. Landsman Jun 2009
      Restore EXECUTE limit (sigh...) W. Landsman July 2009
      Make sure "0" is a short integer even with compile_opt idl2 July 2010
      Added "0.0", "0.0d", "0u", "0ul", and "0ull" as valid tags
            for /NO_EXECUTE E. Rykoff May 2012



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