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