Previous SAXO Documentation Assistant: Overview Next

ToBeReviewed/STRUCTURE/

chkstru.pro

check validity of a structure and test if necessary fields are contained

chkstru Utilities

result = chkstru(structure, fields, INDEX=string, VERBOSE=VERBOSE, EXTRACT=EXTRACT)

Return value

1 if successful, otherwise 0.

Parameters

structure        in required type: struct

The structure to be tested. If STRUCTURE is not of type structure, the function will return 0

fields        in required type: string

A string or string array with field names to be contained in STRUCTURE. CHKSTRU returns 1 (true) only if all field names are contained in STRUCTURE. The entries of FIELDS may be upper or lowercase.

Keywords

INDEX        type: string

A named variable that will contain the indices of the required field names in the structure. They can then be assessed through structure.(index[i]). Index will contain -1 for all fields entries that are not in the structure.

VERBOSE       

set this keyword to return an error message in case of an error.

EXTRACT       

set this keyword to extract a field from the structure. -1 is return if field or structure are incorrect.

Examples


   IDL> test = { a:1, b:2, c:3 }
   IDL> required = ['a','c']
   IDL> if CHKSTRU(test,required) then print,'found a and c.'
   IDL> print, CHKSTRU(test,'b')
           1
   IDL> print, CHKSTRU(test,'b',/extract)
               2

    

Version history

Version

$Id: chkstru.pro 375 2008-08-08 15:55:40Z pinsard $ Copyright (C) 1998, Martin Schultz, Harvard University This software is provided as is without any warranty whatsoever. It may be freely used, copied or distributed for non-commercial purposes. This copyright notice must be kept with any copy of this software. If this software shall be used commercially or sold as part of a larger package, please contact the author to arrange payment. Bugs and comments should be directed to mgs@io.harvard.edu with subject "IDL routine chkstru"

History

- mgs, 02 Mar 1998: VERSION 1.00 - mgs, 07 Apr 1998: - second parameter (FIELDS) now optional - 12 Jan 2001: EXTRACT keyword by S. Masson (smasson@lodyc.jussieu.fr)

 


  Produced by IDLdoc 2.0.