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
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/casa/Arrays/Array.h>
33
34
35namespace casacore { //# NAMESPACE CASACORE - BEGIN
36
37// <summary>
38// Base class for LELArray holding the 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 maskes 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
61{
62public:
63// Default constructor sets to mask all true.
66
67// Constructor takes mask.
70
71// Copy constructor (reference semantics).
72 LELArrayBase (const LELArrayBase& other);
73
75
76// Assignment (reference semantics).
78
79// Does the value have a mask?
80 Bool isMasked() const
81 { return (itsMaskPtr != 0); }
82
83// Get mask.
84// <group>
85 const Array<Bool>& mask() const
86 { return *itsMaskPtr; }
88 { return *itsMaskPtr; }
89// </group>
90
91// Remove the mask.
92 void removeMask();
93
94// Set the mask from given array (takes reference).
95 void setMask (const Array<Bool>& other);
96
97// Set the mask from the mask of the other value.
98 void setMask (const LELArrayBase& other);
99
100// Set the mask from given array (takes reference).
101 void setMask (Array<Bool>& other);
102
103// Set the mask by combining the masks of both values.
104 void setMask (const LELArrayBase& left, const LELArrayBase& right)
105 { setMask (left); combineMask (right); }
106
107// Combine the mask of this and the other value (by anding them).
108// <group>
109 void combineMask (const LELArrayBase& other)
110 { if (other.isMasked()) combineMask (other.mask()); }
112// </group>
113
114// Combine the mask with the given value in case of an OR or AND.
115// It means the mask is set to true if value is desiredValue
116// (which should be True for OR and False for AND).
117// <group>
118// Combine with a single scalar value for which the mask is false.
119 void combineOrAnd (Bool desiredValue, const Array<Bool>& value);
120
121// Combine for two arrays taking the true/false array values into account.
122// The mask and value are set to desiredValue if the temp value is desiredValue.
123 void combineOrAnd (Bool desiredValue, Array<Bool>& value,
124 const Array<Bool>& temp);
125
126// Combine for two arrays taking the true/false array values and mask
127// into account.
128// The mask and value are set to desiredValue if the temp value is desiredValue
129// and its temp mask it true.
130// The mask is set to false if the temp mask is False.
131 void combineOrAnd (Bool desiredValue, Array<Bool>& value,
132 const Array<Bool>& temp, const Array<Bool>& tempMask);
133// </group>
134
135private:
137};
138
139
140
141} //# NAMESPACE CASACORE - END
142
143#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.
this file contains all the compiler specific defines
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.