casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
LELAttribute.h
Go to the documentation of this file.
00001 //# LELAttribute.h: Ancillary information for the LEL letter classes
00002 //# Copyright (C) 1997,1998,1999,2000,2001,2003
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: LELAttribute.h 18093 2004-11-30 17:51:10Z ddebonis $
00027 
00028 #ifndef LATTICES_LELATTRIBUTE_H
00029 #define LATTICES_LELATTRIBUTE_H
00030 
00031 
00032 //# Includes
00033 #include <casa/Arrays/IPosition.h>
00034 #include <lattices/Lattices/LELCoordinates.h>
00035 
00036 
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 
00039 // <summary>
00040 // Ancillary information for the LEL letter classes.
00041 // </summary>
00042 //
00043 // <use visibility=local>
00044 //
00045 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00046 // </reviewed>
00047 //
00048 // <prerequisite>
00049 //   <li> <linkto class="Lattice"> Lattice</linkto>
00050 //   <li> <linkto class="LatticeExpr"> LatticeExpr</linkto>
00051 //   <li> <linkto class="LatticeExprNode"> LatticeExprNode</linkto>
00052 //   <li> <linkto class="LELInterface"> LELInterface</linkto> and
00053 //        derived classes
00054 // </prerequisite>
00055 //
00056 // <etymology>
00057 // Holds attribute information for the Lattice Expression 
00058 // Language letter classes.
00059 // </etymology>
00060 
00061 // <synopsis>
00062 // The Lattice Expression Language letter classes provide
00063 // expression objects. There is ancilliary information or 
00064 // attributes associated with these objects:
00065 // <ul>
00066 // <li> Scalar or lattice (i.e. array) or region.
00067 // <li> In case of an array, is it a reduced array. I.e. is it an array
00068 //      that has to be calculated beforehand (e.g. partialMax).
00069 //      A scalar is always reduced.
00070 // <li> Shape and tile shape of a lattice. This can be undefined.
00071 // <li> Is the lattice masked?
00072 // <li> Optionally coordinates of the lattice.
00073 // </ul>
00074 // Two attribute objects can be combined mirroring the combination of two
00075 // expressions (like the addition of two lattices).
00076 // Regions cannot be combined.
00077 // </synopsis> 
00078 
00079 
00080 class LELAttribute
00081 {
00082 public:
00083 // Default constructor sets it as a scalar.
00084    LELAttribute();
00085 
00086 // Constructor sets it as lattice with given attributes.
00087 // An empty shape indicates that the shape is not known.
00088    LELAttribute(Bool isMasked,
00089                 const IPosition& shape,
00090                 const IPosition& tileShape,
00091                 const LELCoordinates& coordinates,
00092                 Bool isReduced = False);
00093 
00094 // Constructor sets it as a region with given attributes.
00095    explicit LELAttribute(uInt regionNdim);
00096 
00097 // Copy constructor (copy semantics)
00098    LELAttribute(const LELAttribute& attr);
00099 
00100 // Constructor that combines the two attributes given.
00101 // An array can be combined with a scalar.
00102 // If matchAxes is True and if two arrays are given, the shapes and
00103 // coordinates have to match exactly, otherwise one can be a subset of
00104 // the other (and LEL will auto-extend).
00105    LELAttribute(const LELAttribute& attrLeft,
00106                 const LELAttribute& attrRight,
00107                 Bool matchAxes = True);
00108 
00109 // Destructor
00110    ~LELAttribute();
00111 
00112 // Assignment (copy semantics)
00113    LELAttribute& operator= (const LELAttribute& other);
00114 
00115 // Is expression a scalar?
00116    Bool isScalar() const { return isScalar_p; }
00117 
00118 // Is expression a reduced array? A scalar is always reduced.
00119    Bool isReduced() const { return isReduced_p; }
00120 
00121 // Is expression a region?
00122    Bool isRegion() const { return isRegion_p; }
00123 
00124 // Is the expression result masked?
00125    Bool isMasked() const { return isMasked_p; }
00126 
00127 // What is the shape of the expression?
00128    const IPosition& shape() const { return shape_p; }
00129 
00130 // What is the tile shape of the expression?
00131    const IPosition& tileShape() const { return tileShape_p; }
00132 
00133 // What are the coordinates of the expression?
00134    const LELCoordinates& coordinates() const { return coords_p; }
00135 
00136 // Compare the coordinates and shapes to see if this is a subset of other.
00137    Int compareCoord (const LELAttribute& other) const;
00138 
00139 private:
00140    Bool      isScalar_p;
00141    Bool      isReduced_p;
00142    Bool      isRegion_p;
00143    Bool      isMasked_p;
00144    IPosition shape_p;
00145    IPosition tileShape_p;
00146    LELCoordinates coords_p;
00147 };
00148 
00149 
00150 
00151 } //# NAMESPACE CASA - END
00152 
00153 #endif