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