Creating a Registered Query Routine

A query routine inspects a specified file and attempts to determine whether the file is of a particular file type. While a query routine can provide any type of information about the inspected file, for the purposes of custom file readers registered for use by the IOPEN procedure and the File → Open menu item in the IDL Workbench, query routines simply report whether the specified file is of the particular type.

Tip
See the documentation for QUERY_IMAGE or any of the other QUERY_* routines for additional information about query routines.

In order for a query routine to be use alongside a registered file reader, it must meet the following criteria:

  1. It must have the routine signature described below.
  2. The query routine's .pro file must be present in a directory included in IDL's !PATH system variable.
  3. It must be added to the idlextenions.xml file as described in Registering Custom File Readers.

You do not need to create a query routine in order to register your file reader routine for use with the IOPEN procedure and the File → Open menu item in the IDL Workbench. If no query routine is specified to correspond to a particular file reader routine, that file reader routine will always be used when the specified file has an extension that matches the list specified for the file reader. Query routines are useful, however, if the data files have file extensions that are not specified in the idlextenions.xml file, or no file extension at all. See File Reader Search Algorithm for details.

See Example: A Workbench NetCDF Reader for an example of a custom query routine.

Query Routine Signature

A query routine should be an IDL function with the following signature:

Result = QUERY_ROUTINE(File) 

where:

Result

An integer 1 (one) if the query was successful (the file was recognized as being of the specified type) or 0 (zero) if the query failed.

Note - The query routine should not generate errors, but simply quietly return 0 (failure) if an error occurs.

File

A string containing the name of the file to be queried.