>  Docs Center  >  Libraries  >  Motley  >  MGH_VECTOR__DEFINE

MGH_VECTOR__DEFINE

MGH_VECTOR__DEFINE

Class Name


  MGH_Vector

Purpose


  This class implements a random-access container for heterogeneous
  data. It is implemented using an array of pointers.

Properties


  COUNT (Get):
    The number of items currently stored in the vector.
  SIZE (Init, Get, Set):
    The capacity of the vector, i.e. the size of the pointer array
    used to keep track of the items. The size can be changed via the
    SetProperty method. If it is increased then the array is padded
    with blank pointers; if it is reduced then any items beyond the
    new size are deleted and their pointers freed.

Methods


  In addition to the usual suspects (Init, Cleanup, GetProperty,
  SetProperty):
    Add (Procedure):
      This method adds a single item at the end of the vector and
      increments the COUNT property. If this would exceed the
      capacity of the vector, then the SIZE is increased; the
      increase is always done in reasonably large chunks to avoid
      performance degradation.
    Count (Function):
      This method takes no arguments and returns the COUNT property.
    Get (Function):
      This method retrieves a single item from a position specified
      by the POSITION keyword. The default is POSITION=0. The item
      is not removed from the vector. (There is no way of removing
      items other than by reducing the SIZE).
    Put (Procedure):
      This method puts a new value into a position specified by the
      POSITION keyword (default is POSITION=0). There must already
      be a value stored at this location.
###########################################################################
  This software is provided subject to the following conditions:
  1. NIWA makes no representations or warranties regarding the
    accuracy of the software, the use to which the software may
    be put or the results to be obtained from the use of the
    software. Accordingly NIWA accepts no liability for any loss
    or damage (whether direct of indirect) incurred by any person
    through the use of or reliance on the software.
  2. NIWA is to be acknowledged as the original author of the
    software where the software is used or presented in any form.
###########################################################################

Modification History


  Mark Hadfield, 1999-10:
    Written.
  Mark Hadfield, 2000-11:
    Added the Array method, which returns an array holding the
    data.
  Mark Hadfield, 2009-09:
    The Add method now supports the NO_COPY keyword.
  Mark Hadfield, 2011-07:
    - The Add method now supports the EXTRACT keyword, specifying
      that the contents of arrays should be extracted and added one
      by one (cf. the List object introduced in IDL version 8). A
      hidden method called AddItem. Has been added to support
      it. Note that leaving arrays entire is generally much more
      efficient.
    - The Array method has been renamed ToArray (cf. the List object
      introduced in IDL version 8) and now returns values, not
      pointers, by default. It now handles stored arrays in the same
      way as the List object, with an additional FLATTEN keyword that
      causes it to produce a 1D array.
  Mark Hadfield, 2011-07-25:
    - Added a NO_COPY keyword to the ToArray method.
    - The old Values method has been deleted, as it can now be
      replaced by ToArray(/POINTER, /NO_COPY).
  Mark Hadfield, 2011-07-28:
    - The Add method now does nothing when supplied with undefined
      values: in this it differs from the List object, which stores
      a !NULL in their place.
  Mark Hadfield, 2011-08:
    - The result array is now created with the REPLICATE function
      rather than the MAKE_ARRAY function. This is necessary for
      structure types, as you can't create an array of generic structures.



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