;+
; NAME:
;	SMEI_JOIN
;
;
; PURPOSE:
;	To join two SMEI sequences into a single sequence.
;
;
; CATEGORY:
;	CLI
;
;
; CALLING SEQUENCE:
;	smei_join, seq1, seq2
;
;
; INPUTS:
;	seq1	objref	Reference to the first sequence. On return
;			this will be the concatenated sequence.
;	seq2	objref	Reference to the second sequence. On return
;			this will be a null object, unless the
;			preserve keyword is set..
;
;
; KEYWORD_PARAMETERS:
;	/preserve	If set then copy the second sequence images
;			rather than moving them.
;	/sort		If set, then sort the resultant sequence after
;			concatenation.
;
; SIDE EFFECTS:
;	The first sequence is extended and the second is destroyed
;	(unless preserve is set).
;
;
; MODIFICATION HISTORY:
;	Original: 8/1/03; SJT
;	Added preserve option: 9/1/03; SJT
;	Added sort keyword: 13/1/03; SJT
;-

pro smei_join, seq1, seq2, preserve = preserve, sort = sort, help = $
               help

if keyword_set(help) then begin
    self_help
    return
endif

if not (obj_valid(seq1) and obj_valid(seq2)) then begin
    smei_msg, /warn, ['Both arguments to SMEI_JOIN must be valid', $
                      'object references']
    return
endif

if not (obj_isa(seq1, 'SMEI_SEQUENCE') and $
        obj_isa(seq2, 'SMEI_SEQUENCE')) then begin
    smei_msg, /warn, ['Both arguments to SMEI_JOIN must be SMEI_SEQUENCE', $
                      'object references']
    return
endif

seq1 -> concatenate, seq2, preserve = preserve, sort = sort

end
