; $Id: davedat__get.pro,v 1.7 2005/02/08 17:17:34 azuah Exp $
;###############################################################################
;
; CLASS NAME:
;   DaveDat
;
; PURPOSE:
;   This class encapsulates a DAVE formated dataset
;
; CATEGORY:
;   Data Browser
;
; SUPERCLASSES:
;
; PUBLIC METHODS:
;   Get
;   Set
;   ResetData
;
; 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.
;
;###############################################################################



;===============================================================================
; DaveDat::get
;
; PURPOSE:
;   Main get method for class. Used to retrieve class variables (all
;   class variables are 'private' in IDL)
;
; PARAMETERS:
;
; KEYWORDS:
;   filename [out] - Return filename as string; an empty string is
;                    return if the objects filename is undefined.
;
;   nameTag [out] - A string name tag for object
;
;   davePtr [out] - Return a pointer to a _copy_ of the object's
;                   davePtr if present
;
;   scalefactor [out] - Return scalefactor as a float.
;
;   descriPtr [out] - Return a pointer to a _copy_ of the object's
;                     descriPtr structure if present.
;
;   instrument [out] - Return the instrument name; an empty string is
;                      returned if instrument is undefined.
;
;   xVal [out] - returns a float 1D vector containing the x-axis values.
;
;   xLabel [out] - returns x-axis label as string
;
;   xType [out] - returns x-axis type as string
;
;   xUnits [out] - returns x-axis units as string
;
;   zVal [out] - returns a float 1D/2D array containing the z-axis
;                values.
;
;   zErr [out] - returns a float 1D/2D array containing the z-axis
;                errors.
;
;   zLabel [out] - returns z-axis label as string
;
;   zUnits [out] - returns z-axis units as string
;
;   treatment [out] - returns a string (array) containing a record of
;                     operations performed so far on the data.
;
;   nameTag [out] - returns a string name tag for object
;
;   nReferences [out] - number of references being made to the current
;                       object.
;
;   xDir [out] - a flag indicating whether the x-axis is increasing (=0) or
;                decreasing (=1) in value.
;
; RETURN VALUE:
;   0 => failure
;   1 => success
;
function DaveDat::get, filename=filename,davePtr=davePtr,descriPtr=descriPtr, $
                scalefactor=scalefactor, instrument=instrument, xVal=xval, xLabel=xlabel, $
                xType=xtype, xUnits=xunits, zVal=zval, zErr=zerr, zLabel=zlabel, zUnits=zunits, $
                treatment=treatment,nameTag=nameTag,nReferences=nReferences, xDir=xDir

; 
if (arg_present(xDir)) then begin
    xDir = self.xDir
endif

; filename keyword
if (arg_present(filename)) then begin
    filename = self.filename
endif

; Return name tag
if (arg_present(nameTag)) then begin
    nameTag = self.nameTag
endif

if (arg_present(nReferences)) then begin
    nReferences = self.nReferences
endif

; get original davePtr
if (arg_present(davePtr)) then begin
    if (ptr_valid(davePtr)) then heap_free, davePtr ; delete the heap variable if defined already
    if (ptr_valid(self.davePtr)) then dave_beast_ops,'dup',self.davePtr,davePtr
endif

;
if (arg_present(descriPtr)) then begin
    if (ptr_valid(descriPtr)) then ptr_free, descriPtr ; delete the heap variable if defined already
    if (ptr_valid(self.descriPtr)) then descriPtr = ptr_new(*self.descriPtr)
endif

;
if (arg_present(scalefactor)) then begin
    scalefactor = self.scalefactor
endif

;
if (arg_present(instrument)) then begin
    instrument = self.instrument
endif

;
if (arg_present(xval)) then begin
    if (ptr_valid(self.xvPtr)) then xval = (*self.xvPtr)
endif

;
if (arg_present(xlabel)) then begin
    xlabel = self.xLabel
endif

;
if (arg_present(xtype)) then begin
    xtype = self.xType
endif

;
if (arg_present(xunits)) then begin
    xunits = self.xUnits
endif

;
if (arg_present(zval)) then begin
    if (ptr_valid(self.zvPtr)) then zval = (*self.zvPtr)*(self.scalefactor)
endif

;
if (arg_present(zerr)) then begin
    if (ptr_valid(self.zePtr)) then zerr = (*self.zePtr)*(self.scalefactor)
endif

;
if (arg_present(zlabel)) then begin
    zlabel = self.zLabel
endif

;
if (arg_present(zunits)) then begin
    zunits = self.zUnits
endif

;
if (arg_present(treatment)) then begin
    if (ptr_valid(self.treatPtr)) then begin
        if (n_elements(*self.treatPtr) ne 0) then begin
            treatment = (*self.treatPtr)
        endif else begin
            treatment = ''
        endelse
    endif
endif

return, 1
end
