casacore
Loading...
Searching...
No Matches
LELArray.h
Go to the documentation of this file.
1//# LELArray.h: Hold an array with a mask in LEL
2//# Copyright (C) 1999
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: casa-feedback@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#ifndef LATTICES_LELARRAY_H
27#define LATTICES_LELARRAY_H
28
29
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/lattices/LEL/LELArrayBase.h>
33
34
35namespace casacore { //# NAMESPACE CASACORE - BEGIN
36
37// <summary>
38// This LEL class holds an array with a mask.
39// </summary>
40
41// <use visibility=local>
42
43// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
44// </reviewed>
45
46// <synopsis>
47// This LEL class holds an array with a mask.
48// The mask can be a single Bool valid for all elements of the array.
49// Otherwise it is a full mask with the same shape as the array.
50// </synopsis>
51
52// <motivation>
53// It makes it possible to handle an array with its mask as a single object.
54// </motivation>
55
56// <todo asof="1998/01/20">
57// </todo>
58
59
60template <class T> class LELArray : public LELArrayBase
61{
62public:
63// Constructor takes value.
64// Its mask is set to all True.
66 : itsValue (value) {}
67
68// Constructor takes value and mask.
71
72// Constructor takes shape.
73// Its mask is set to all True.
75
76// Copy constructor (reference semantics).
77 LELArray (const LELArray<T>& other);
78
80
81 // Assignment (reference semantics).
83
84// Get shape (of the value).
85 const IPosition& shape() const
86 { return itsValue.shape(); }
87
88// Get value.
89// <group>
90 const Array<T>& value() const
91 { return itsValue; }
93 { return itsValue; }
94// </group>
95
96private:
98};
99
100
101
102
103// <summary>
104// This LEL class holds a possible referenced array with a mask.
105// </summary>
106
107// <use visibility=local>
108
109// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
110// </reviewed>
111
112// <synopsis>
113// This LEL class is derived from LELArray.
114// Its purpose is to provide only const access to the array value, so
115// the array can be a reference to another array.
116// It is meant for optimization, so references can safely be used
117// when evaluating a subexpression.
118// </synopsis>
119
120// <motivation>
121// It makes it possible to use the function evalRef in a safe way.
122// It would be unsafe to use a LELArray object, because that
123// gives non-const access to the value.
124// </motivation>
125
126// <todo asof="1998/01/20">
127// </todo>
128
129
130template <class T> class LELArrayRef : public LELArray<T>
131{
132public:
133// Constructor takes shape.
134// Its mask is set to all True.
136 : LELArray<T> (shape) {}
137
139 {}
140
141// Get value.
142 const Array<T>& value() const
143 { return LELArray<T>::value(); }
144
145private:
146// Copy constructor is not needed.
148// Assignment is not needed.
150};
151
152
153
154} //# NAMESPACE CASACORE - END
155
156#ifndef CASACORE_NO_AUTO_TEMPLATES
157#include <casacore/lattices/LEL/LELArray.tcc>
158#endif //# CASACORE_NO_AUTO_TEMPLATES
159#endif
const Array< Bool > & mask() const
Get mask.
This LEL class holds a possible referenced array with a mask.
Definition LELArray.h:131
const Array< T > & value() const
Get value.
Definition LELArray.h:142
LELArrayRef(const LELArrayRef< T > &other)
Copy constructor is not needed.
LELArrayRef< T > & operator=(const LELArrayRef< T > &other)
Assignment is not needed.
LELArrayRef(const IPosition &shape)
Constructor takes shape.
Definition LELArray.h:135
LELArray(const LELArray< T > &other)
Copy constructor (reference semantics).
LELArray(const IPosition &shape)
Constructor takes shape.
const Array< T > & value() const
Get value.
Definition LELArray.h:90
LELArray(const Array< T > &value, const Array< Bool > &mask)
Constructor takes value and mask.
Definition LELArray.h:69
Array< T > & value()
Definition LELArray.h:92
LELArray< T > & operator=(const LELArray< T > &other)
Assignment (reference semantics).
LELArray(const Array< T > &value)
Constructor takes value.
Definition LELArray.h:65
Array< T > itsValue
Definition LELArray.h:97
const IPosition & shape() const
Get shape (of the value).
Definition LELArray.h:85
this file contains all the compiler specific defines
Definition mainpage.dox:28