LELLattice.h

Go to the documentation of this file.
00001 //# LELLattice.h:  LELLattice
00002 //# Copyright (C) 1997,1998,1999,2000
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef LATTICES_LELLATTICE_H
00029 #define LATTICES_LELLATTICE_H
00030 
00031 
00032 //# Includes
00033 #include <casacore/casa/aips.h>
00034 #include <casacore/lattices/LEL/LELInterface.h>
00035 
00036 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00037 
00038 //# Forward Declarations
00039 template <class T> class Lattice;
00040 template <class T> class MaskedLattice;
00041 
00042 
00043 // <summary> This LEL class handles access to Lattices </summary>
00044 //
00045 // <use visibility=local>
00046 //
00047 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00048 // </reviewed>
00049 //
00050 // <prerequisite>
00051 //   <li> <linkto class="Lattice"> Lattice</linkto>
00052 //   <li> <linkto class="LatticeExpr"> LatticeExpr</linkto>
00053 //   <li> <linkto class="LatticeExprNode"> LatticeExprNode</linkto>
00054 //   <li> <linkto class="LELInterface"> LELInterface</linkto>
00055 // </prerequisite>
00056 //
00057 // <etymology>
00058 //  This derived LEL letter class handles access to the pixels in a Lattice
00059 // </etymology>
00060 //
00061 // <synopsis>
00062 // This LEL letter class is derived from LELInterface.  It
00063 // is used to construct LEL objects that access the pixels in
00064 // a Lattice. It works with Lattices of type 
00065 // Float,Double,Complex,DComplex and Bool.  
00066 //
00067 // A description of the implementation details of the LEL classes can
00068 // be found in
00069 // <a href="../notes/216.html">Note 216</a>
00070 // </synopsis> 
00071 //
00072 // <example>
00073 // Examples are not very useful as the user would never use 
00074 // these classes directly.  Look in LatticeExprNode.cc to see 
00075 // how it invokes these classes.  An example of how the user
00076 // would indirectly use this class (through the envelope) is:
00077 // <srcblock>
00078 // IPosition shape(2,5,10);
00079 // ArrayLattice<Float> x(shape); x.set(1.0);
00080 // ArrayLattice<Float> y(shape); 
00081 // y.copyData(x);                 // y = x
00082 // </srcblock>
00083 // </example>
00084 //
00085 // <motivation>
00086 // Accessing Lattices is fundamental to manipulating their pixel values
00087 // </motivation>
00088 //
00089 // <todo asof="1998/01/20">
00090 // </todo>
00091  
00092 
00093 
00094 
00095 template <class T> class LELLattice : public LELInterface<T>
00096 {
00097   //# Make members of parent class known.
00098 public:
00099   using LELInterface<T>::getAttribute;
00100 protected:
00101   using LELInterface<T>::setAttr;
00102 
00103 public: 
00104 // Constructor takes lattice to fetch from it
00105 // <group>
00106    LELLattice (const Lattice<T>& lattice);  
00107    LELLattice (const MaskedLattice<T>& lattice);  
00108 // </group>
00109 
00110 // Destructor does nothing
00111   ~LELLattice();
00112 
00113 // Evaluate the expression; this means get the chunk of the lattice.
00114    virtual void eval(LELArray<T>& result,
00115                      const Slicer& section) const;
00116    virtual void evalRef(LELArrayRef<T>& result,
00117                         const Slicer& section) const;
00118 
00119 // Getting a scalar value is not possible (throws exception).
00120    virtual LELScalar<T> getScalar() const;
00121 
00122 // Do further preparations (e.g. optimization) on the expression.
00123    virtual Bool prepareScalarExpr();
00124 
00125 // Get class name
00126    virtual String className() const;
00127 
00128   // Handle locking/syncing of a lattice in a lattice expression.
00129   // <group>
00130   virtual Bool lock (FileLocker::LockType, uInt nattempts);
00131   virtual void unlock();
00132   virtual Bool hasLock (FileLocker::LockType) const;
00133   virtual void resync();
00134   // </group>
00135 
00136 private:
00137    MaskedLattice<T>* pLattice_p;
00138 };
00139 
00140 
00141 
00142 } //# NAMESPACE CASACORE - END
00143 
00144 #ifndef CASACORE_NO_AUTO_TEMPLATES
00145 #include <casacore/lattices/LEL/LELLattice.tcc>
00146 #endif //# CASACORE_NO_AUTO_TEMPLATES
00147 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1