casacore
Loading...
Searching...
No Matches
LELArrayBase.h
Go to the documentation of this file.
1// # LELArrayBase.h: Base class for LELArray holding the mask
2// # Copyright (C) 1999,2001
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_LELARRAYBASE_H
27#define LATTICES_LELARRAYBASE_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/Array.h>
32
33namespace casacore { // # NAMESPACE CASACORE - BEGIN
34
35// <summary>
36// Base class for LELArray holding the 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 maskes 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
58 public:
59 // Default constructor sets to mask all true.
61
62 // Constructor takes mask.
64
65 // Copy constructor (reference semantics).
67
69
70 // Assignment (reference semantics).
72
73 // Does the value have a mask?
74 Bool isMasked() const { return (itsMaskPtr != 0); }
75
76 // Get mask.
77 // <group>
78 const Array<Bool>& mask() const { return *itsMaskPtr; }
79 Array<Bool>& mask() { return *itsMaskPtr; }
80 // </group>
81
82 // Remove the mask.
83 void removeMask();
84
85 // Set the mask from given array (takes reference).
86 void setMask(const Array<Bool>& other);
87
88 // Set the mask from the mask of the other value.
89 void setMask(const LELArrayBase& other);
90
91 // Set the mask from given array (takes reference).
92 void setMask(Array<Bool>& other);
93
94 // Set the mask by combining the masks of both values.
95 void setMask(const LELArrayBase& left, const LELArrayBase& right) {
96 setMask(left);
97 combineMask(right);
98 }
99
100 // Combine the mask of this and the other value (by anding them).
101 // <group>
102 void combineMask(const LELArrayBase& other) {
103 if (other.isMasked()) combineMask(other.mask());
104 }
106 // </group>
107
108 // Combine the mask with the given value in case of an OR or AND.
109 // It means the mask is set to true if value is desiredValue
110 // (which should be True for OR and False for AND).
111 // <group>
112 // Combine with a single scalar value for which the mask is false.
113 void combineOrAnd(Bool desiredValue, const Array<Bool>& value);
114
115 // Combine for two arrays taking the true/false array values into account.
116 // The mask and value are set to desiredValue if the temp value is desiredValue.
117 void combineOrAnd(Bool desiredValue, Array<Bool>& value, const Array<Bool>& temp);
118
119 // Combine for two arrays taking the true/false array values and mask
120 // into account.
121 // The mask and value are set to desiredValue if the temp value is desiredValue
122 // and its temp mask it true.
123 // The mask is set to false if the temp mask is False.
124 void combineOrAnd(Bool desiredValue, Array<Bool>& value, const Array<Bool>& temp,
125 const Array<Bool>& tempMask);
126 // </group>
127
128 private:
130};
131
132} // namespace casacore
133
134#endif
LELArrayBase & operator=(const LELArrayBase &other)
Assignment (reference semantics).
Array< Bool > & mask()
void setMask(Array< Bool > &other)
Set the mask from given array (takes reference).
void setMask(const Array< Bool > &other)
Set the mask from given array (takes reference).
void combineMask(const Array< Bool > &mask)
LELArrayBase()
Default constructor sets to mask all true.
void setMask(const LELArrayBase &other)
Set the mask from the mask of the other value.
void combineOrAnd(Bool desiredValue, Array< Bool > &value, const Array< Bool > &temp)
Combine for two arrays taking the true/false array values into account.
void combineOrAnd(Bool desiredValue, const Array< Bool > &value)
Combine the mask with the given value in case of an OR or AND.
Array< Bool > * itsMaskPtr
LELArrayBase(const Array< Bool > &mask)
Constructor takes mask.
const Array< Bool > & mask() const
Get mask.
LELArrayBase(const LELArrayBase &other)
Copy constructor (reference semantics).
Bool isMasked() const
Does the value have a mask?
void removeMask()
Remove the mask.
void setMask(const LELArrayBase &left, const LELArrayBase &right)
Set the mask by combining the masks of both values.
void combineMask(const LELArrayBase &other)
Combine the mask of this and the other value (by anding them).
void combineOrAnd(Bool desiredValue, Array< Bool > &value, const Array< Bool > &temp, const Array< Bool > &tempMask)
Combine for two arrays taking the true/false array values and mask into account.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
NewDelAllocator< T > NewDelAllocator< T >::value
Definition Allocator.h:360