; $Id: davedat1d__define.pro,v 1.6 2005/02/08 17:17:34 azuah Exp $
;###############################################################################
;
; CLASS NAME:
;   DaveDat1D
;
; PURPOSE:
;   This class encapsulates a DAVE formated dataset containing 1D
;   data.
;
; CATEGORY:
;   Data Browser
;
; SUPERCLASSES:
;   DaveDat
;
; PUBLIC METHODS:
;   Clone
;   Get
;   Print
;   Rebin
;   ResetData
;   Restore
;   Set
;
; AUTHOR:
;   Richard Tumanjong Azuah
;   NIST Center for Neutron Research
;   100 Bureau Drive, Gaithersburg, MD 20899
;   United States
;   azuah@nist.gov; (301) 9755604
;   Oct, 2002
;
; LICENSE:
;  The software in this file is written by an employee of 
;  National Institute of Standards and Technology 
;  as part of the DAVE software project.
;
;  The DAVE software package is not subject to copyright protection
;  and is in the public domain. It should be considered as an
;  experimental neutron scattering data reduction, visualization, and
;  analysis system. As such, the authors assume no responsibility
;  whatsoever for its use, and make no guarantees, expressed or
;  implied, about its quality, reliability, or any other
;  characteristic. The use of certain trade names or commercial
;  products does not imply any endorsement of a particular product,
;  nor does it imply that the named product is necessarily the best
;  product for the stated purpose. We would appreciate acknowledgment
;  if the DAVE software is used or if the code in this file is
;  included in another product.
;
;###############################################################################



;===============================================================================
; DaveDat1D::cleanup
;
; PURPOSE:
;   Cleanup method for objects of this class
;
; PARAMETERS:
;
; KEYWORDS:
;
pro DaveDat1D::cleanup

; call the base class cleanup method
self->DaveDat::cleanup

end
;-------------------------------------------------------------------------------



;===============================================================================
; DaveDat1D::Init
;
; PURPOSE:
;   Initialization method for objects of this class
;
; PARAMETERS:
;
; KEYWORDS:
;   offset [in] - An additive offset to be applied to an objects
;                 data before being displayed or saved.
;
;   _EXTRA [in] - Allows keywords to be passed to the base class (see
;                 DaveDat::init).
;
; RETURN VALUE:
;     0 => failure 
;     1 => success.
;
function DaveDat1D::init, offset=oset, _EXTRA=etc

on_error, 2
catch, theError
if (theError ne 0) then begin
    catch, /cancel
    message, /reissue_last
    return, 0
endif

; call the base class init method
if (self->DaveDat::init(_EXTRA=etc) ne 1) then return, 0

; ensure data is 1D and not 2D
if (ptr_valid(self.zvPtr)) then begin
    if ((size(*(self.zvPtr)))[0] gt 1) then begin
        *(self.zvPtr) = (*(self.zvPtr))[*,1]
    endif
endif
if (ptr_valid(self.zePtr)) then begin
    if ((size(*(self.zePtr)))[0] gt 1) then begin
        *(self.zePtr) = (*(self.zePtr))[*,1]
    endif
endif

if (n_elements(oset) gt 0) then begin
    self.offset = oset
endif

return, 1
end
;-------------------------------------------------------------------------------



;===============================================================================
; DaveDat1D__define
;
; PURPOSE:
;   Class structure definition procedure
;
; PARAMETERS:
;
; KEYWORDS:
;
pro DaveDat1D__define

void = {DaveDat1D, $
        offset:0.0, $           ; additive offset for data
        inherits DaveDat $      ; inherits from DaveDat class
       }

end
