;+
; Select data from the given io object and return the array of
; matching indices.
;
; Currently, the selection criteria are passed directly to the io
; class's get_index function via the _EXTRA parameter. Eventually, a
; more specific detailed interface will be found here.
;
; See the line index's
; search_index or
; continuum index's search_index
; for the full set of parameters that are available.
;
; @param io_object {in}{optional}{type=sdfits io object} The io object
; on which the selection is performed
;
; @keyword count {out}{optional}{type=integer} The number of matches found.
;
; @returns an array of indicies. Returns a value of -1 if no match
; was found.
;
; @version $Id: select_data.pro,v 1.4 2005/05/18 17:06:40 bgarwood Exp $
;-
FUNCTION select_data, io_object, count=count, _EXTRA=ex
compile_opt idl2
result = -1
count = 0
if (io_object->is_data_loaded()) then begin
result = io_object->get_index(_EXTRA=ex)
if result[0] ne -1 then count = n_elements(result)
endif else begin
message, 'There is no data to select from', /info
endelse
return, result
END