>  Docs Center  >  Libraries  >  JHU/APL/S1R  >  AARR






      Simulate an associative array (key / value pairs).


Calling Sequence

      val = aarr(arr, key)


      arr = Input array. in
            See notes below.
      key = Key into array. in

Keyword Parameters


        /IGNORE_CASE means ignore case for normal or reverse
        INDEX=in Index of key for given operation.
          For /ADD in is the index of the added or updated key.
          For /DROP in is the index where the dropped key was.
          For Value by Key, in is the index of the Key.
          For Key by Value, in is the index of the Key.
        VALUE=val For this keyword the corresponding key
          is returned as the function value (only arg is arr).
        /ADD add a new key/value pair to the array.
            Give both the key and value with this keyword:
            arr2 = aarr(arr,key,value=val,/add)
            If new, the key and value are added to the array.
            For an exising key the value is updated unless
            /NO_UPDATE is used.
        /NO_UPDATE means do not update the value when adding a key
            that was already there.
        /DROP drop the specified key/value pair from the array.
            Give either the key or value with this keyword:
            arr = aarr(arr,key,/drop) or
            arr = aarr(arr,value=val,/drop)
            The updated array is returned or original if error.
        COUNT=cnt Number of elements in modified array for a
            successful /drop (Only returned for /DROP). If all
            elements dropped a null string is returned, check cnt.
            COUNT is 2 times the number of entries in the array.
        ERROR=err Error flag: 0=ok.
        /QUIET do not give error message.
        VERR=verr Value to return on an error (def='').


      val = Returned value for given key. out
        Reverse lookup, do not give key for this case.

Common Blocks


      Notes: The keys and values for a given array will all be the
      same data type, probably text. They must be in the array
      as adjacent elements with key first. Keys should be unique,
      if not, the first found will be used.

Modification History

      R. Sterner, 2006 Jul 06
      R. Sterner, 2006 Dec 15 --- Now defines arr for first /add.
      R. Sterner, 2006 Dec 15 --- Added /UPDATE, /QUIET, ERROR=err.
      R. Sterner, 2006 Dec 18 --- Dropped /UPDATE, /ADD now updates.
      R. Sterner, 2006 Dec 18 --- Made INDEX always be for key.
      R. Sterner, 2007 May 14 --- Added VERR.
      R. Sterner, 2009 Jan 13 --- Added /IGNORE_CASE. Fixed reverse lookup.
      R. Sterner, 2010 Apr 30 --- Converted arrays from () to [].
  Copyright (C) 2006, Johns Hopkins University/Applied Physics Laboratory
  This software may be used, copied, or redistributed as long as it is not
  sold and this copyright notice is reproduced on each copy made. This
  routine is provided as is without any express or implied warranties
  whatsoever. Other limitations apply as described in the file disclaimer.txt.

© 2020 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us