casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LELLattice.h
Go to the documentation of this file.
1 //# LELLattice.h: LELLattice
2 //# Copyright (C) 1997,1998,1999,2000
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef LATTICES_LELLATTICE_H
29 #define LATTICES_LELLATTICE_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 //# Forward Declarations
39 template <class T> class Lattice;
40 template <class T> class MaskedLattice;
41 
42 
43 // <summary> This LEL class handles access to Lattices </summary>
44 //
45 // <use visibility=local>
46 //
47 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
48 // </reviewed>
49 //
50 // <prerequisite>
51 // <li> <linkto class="Lattice"> Lattice</linkto>
52 // <li> <linkto class="LatticeExpr"> LatticeExpr</linkto>
53 // <li> <linkto class="LatticeExprNode"> LatticeExprNode</linkto>
54 // <li> <linkto class="LELInterface"> LELInterface</linkto>
55 // </prerequisite>
56 //
57 // <etymology>
58 // This derived LEL letter class handles access to the pixels in a Lattice
59 // </etymology>
60 //
61 // <synopsis>
62 // This LEL letter class is derived from LELInterface. It
63 // is used to construct LEL objects that access the pixels in
64 // a Lattice. It works with Lattices of type
65 // Float,Double,Complex,DComplex and Bool.
66 //
67 // A description of the implementation details of the LEL classes can
68 // be found in
69 // <a href="../notes/216.html">Note 216</a>
70 // </synopsis>
71 //
72 // <example>
73 // Examples are not very useful as the user would never use
74 // these classes directly. Look in LatticeExprNode.cc to see
75 // how it invokes these classes. An example of how the user
76 // would indirectly use this class (through the envelope) is:
77 // <srcblock>
78 // IPosition shape(2,5,10);
79 // ArrayLattice<Float> x(shape); x.set(1.0);
80 // ArrayLattice<Float> y(shape);
81 // y.copyData(x); // y = x
82 // </srcblock>
83 // </example>
84 //
85 // <motivation>
86 // Accessing Lattices is fundamental to manipulating their pixel values
87 // </motivation>
88 //
89 // <todo asof="1998/01/20">
90 // </todo>
91 
92 
93 
94 
95 template <class T> class LELLattice : public LELInterface<T>
96 {
97  //# Make members of parent class known.
98 public:
100 protected:
102 
103 public:
104 // Constructor takes lattice to fetch from it
105 // <group>
106  LELLattice (const Lattice<T>& lattice);
107  LELLattice (const MaskedLattice<T>& lattice);
108 // </group>
109 
110 // Destructor does nothing
111  ~LELLattice();
112 
113 // Evaluate the expression; this means get the chunk of the lattice.
114  virtual void eval(LELArray<T>& result,
115  const Slicer& section) const;
116  virtual void evalRef(LELArrayRef<T>& result,
117  const Slicer& section) const;
118 
119 // Getting a scalar value is not possible (throws exception).
120  virtual LELScalar<T> getScalar() const;
121 
122 // Do further preparations (e.g. optimization) on the expression.
123  virtual Bool prepareScalarExpr();
124 
125 // Get class name
126  virtual String className() const;
127 
128  // Handle locking/syncing of a lattice in a lattice expression.
129  // <group>
130  virtual Bool lock (FileLocker::LockType, uInt nattempts);
131  virtual void unlock();
132  virtual Bool hasLock (FileLocker::LockType) const;
133  virtual void resync();
134  // </group>
135 
136 private:
138 };
139 
140 
141 
142 } //# NAMESPACE CASACORE - END
143 
144 #ifndef CASACORE_NO_AUTO_TEMPLATES
145 #include <casacore/lattices/LEL/LELLattice.tcc>
146 #endif //# CASACORE_NO_AUTO_TEMPLATES
147 #endif
This LEL class holds an array with a mask.
Definition: LELInterface.h:44
virtual void eval(LELArray< T > &result, const Slicer &section) const
Evaluate the expression; this means get the chunk of the lattice.
A templated, abstract base class for array-like objects with masks.
LELLattice(const Lattice< T > &lattice)
Constructor takes lattice to fetch from it.
This LEL class holds a possible referenced array with a mask.
Definition: LELInterface.h:45
virtual void resync()
virtual void evalRef(LELArrayRef< T > &result, const Slicer &section) const
This LEL class handles access to Lattices.
Definition: LELLattice.h:95
virtual String className() const
Get class name.
This base class provides the interface for Lattice expressions.
Definition: LELInterface.h:150
A templated, abstract base class for array-like objects.
~LELLattice()
Destructor does nothing.
virtual Bool lock(FileLocker::LockType, uInt nattempts)
Handle locking/syncing of a lattice in a lattice expression.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual Bool prepareScalarExpr()
Do further preparations (e.g.
virtual void unlock()
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:289
virtual LELScalar< T > getScalar() const
Getting a scalar value is not possible (throws exception).
String: the storage and methods of handling collections of characters.
Definition: String.h:223
LockType
Define the possible lock types.
Definition: FileLocker.h:95
virtual Bool hasLock(FileLocker::LockType) const
MaskedLattice< T > * pLattice_p
Definition: LELLattice.h:137
unsigned int uInt
Definition: aipstype.h:51
This LEL class holds a scalar with a mask.
Definition: LELInterface.h:43
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42