casacore
LELAttribute.h
Go to the documentation of this file.
1 //# LELAttribute.h: Ancillary information for the LEL letter classes
2 //# Copyright (C) 1997,1998,1999,2000,2001,2003
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_LELATTRIBUTE_H
29 #define LATTICES_LELATTRIBUTE_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 #include <casacore/casa/Arrays/IPosition.h>
35 #include <casacore/lattices/LEL/LELCoordinates.h>
36 
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 // <summary>
41 // Ancillary information for the LEL letter classes.
42 // </summary>
43 //
44 // <use visibility=local>
45 //
46 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
47 // </reviewed>
48 //
49 // <prerequisite>
50 // <li> <linkto class="Lattice"> Lattice</linkto>
51 // <li> <linkto class="LatticeExpr"> LatticeExpr</linkto>
52 // <li> <linkto class="LatticeExprNode"> LatticeExprNode</linkto>
53 // <li> <linkto class="LELInterface"> LELInterface</linkto> and
54 // derived classes
55 // </prerequisite>
56 //
57 // <etymology>
58 // Holds attribute information for the Lattice Expression
59 // Language letter classes.
60 // </etymology>
61 
62 // <synopsis>
63 // The Lattice Expression Language letter classes provide
64 // expression objects. There is ancilliary information or
65 // attributes associated with these objects:
66 // <ul>
67 // <li> Scalar or lattice (i.e. array) or region.
68 // <li> In case of an array, is it a reduced array. I.e. is it an array
69 // that has to be calculated beforehand (e.g. partialMax).
70 // A scalar is always reduced.
71 // <li> Shape and tile shape of a lattice. This can be undefined.
72 // <li> Is the lattice masked?
73 // <li> Optionally coordinates of the lattice.
74 // </ul>
75 // Two attribute objects can be combined mirroring the combination of two
76 // expressions (like the addition of two lattices).
77 // Regions cannot be combined.
78 // </synopsis>
79 
80 
82 {
83 public:
84 // Default constructor sets it as a scalar.
86 
87 // Constructor sets it as lattice with given attributes.
88 // An empty shape indicates that the shape is not known.
90  const IPosition& shape,
91  const IPosition& tileShape,
93  Bool isReduced = False);
94 
95 // Constructor sets it as a region with given attributes.
96  explicit LELAttribute(uInt regionNdim);
97 
98 // Copy constructor (copy semantics)
99  LELAttribute(const LELAttribute& attr);
100 
101 // Constructor that combines the two attributes given.
102 // An array can be combined with a scalar.
103 // If matchAxes is True and if two arrays are given, the shapes and
104 // coordinates have to match exactly, otherwise one can be a subset of
105 // the other (and LEL will auto-extend).
106  LELAttribute(const LELAttribute& attrLeft,
107  const LELAttribute& attrRight,
108  Bool matchAxes = True);
109 
110 // Destructor
112 
113 // Assignment (copy semantics)
115 
116 // Is expression a scalar?
117  Bool isScalar() const { return isScalar_p; }
118 
119 // Is expression a reduced array? A scalar is always reduced.
120  Bool isReduced() const { return isReduced_p; }
121 
122 // Is expression a region?
123  Bool isRegion() const { return isRegion_p; }
124 
125 // Is the expression result masked?
126  Bool isMasked() const { return isMasked_p; }
127 
128 // What is the shape of the expression?
129  const IPosition& shape() const { return shape_p; }
130 
131 // What is the tile shape of the expression?
132  const IPosition& tileShape() const { return tileShape_p; }
133 
134 // What are the coordinates of the expression?
135  const LELCoordinates& coordinates() const { return coords_p; }
136 
137 // Compare the coordinates and shapes to see if this is a subset of other.
138  Int compareCoord (const LELAttribute& other) const;
139 
140 private:
148 };
149 
150 
151 
152 } //# NAMESPACE CASACORE - END
153 
154 #endif
Bool isRegion() const
Is expression a region?
Definition: LELAttribute.h:123
const LELCoordinates & coordinates() const
What are the coordinates of the expression?
Definition: LELAttribute.h:135
LELAttribute(const LELAttribute &attrLeft, const LELAttribute &attrRight, Bool matchAxes=True)
Constructor that combines the two attributes given.
LELAttribute()
Default constructor sets it as a scalar.
~LELAttribute()
Destructor.
LELAttribute(Bool isMasked, const IPosition &shape, const IPosition &tileShape, const LELCoordinates &coordinates, Bool isReduced=False)
Constructor sets it as lattice with given attributes.
LELAttribute(const LELAttribute &attr)
Copy constructor (copy semantics)
Int compareCoord(const LELAttribute &other) const
Compare the coordinates and shapes to see if this is a subset of other.
LELAttribute & operator=(const LELAttribute &other)
Assignment (copy semantics)
LELAttribute(uInt regionNdim)
Constructor sets it as a region with given attributes.
LELCoordinates coords_p
Definition: LELAttribute.h:147
Bool isScalar() const
Is expression a scalar?
Definition: LELAttribute.h:117
Bool isReduced() const
Is expression a reduced array? A scalar is always reduced.
Definition: LELAttribute.h:120
const IPosition & tileShape() const
What is the tile shape of the expression?
Definition: LELAttribute.h:132
Bool isMasked() const
Is the expression result masked?
Definition: LELAttribute.h:126
const IPosition & shape() const
What is the shape of the expression?
Definition: LELAttribute.h:129
this file contains all the compiler specific defines
Definition: mainpage.dox:28
const Bool False
Definition: aipstype.h:44
unsigned int uInt
Definition: aipstype.h:51
int Int
Definition: aipstype.h:50
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool True
Definition: aipstype.h:43