casacore
MaskSpecifier.h
Go to the documentation of this file.
1 //# MaskSpecifier.h: Class to specify which mask to use in an image
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: 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 IMAGES_MASKSPECIFIER_H
29 #define IMAGES_MASKSPECIFIER_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/casa/BasicSL/String.h>
34 
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 // <summary>
39 // Class to specify which mask to use in an image.
40 // </summary>
41 
42 // <use visibility=export>
43 
44 // <reviewed reviewer="" date="" tests="tPagedImage">
45 // </reviewed>
46 
47 // <synopsis>
48 // The only purpose of MaskSpecifier is to reduce the number of constructors
49 // in PagedImage. It makes it possible to specify if no mask, the default
50 // mask, or another mask should be used when opening an existing PagedImage
51 // object.
52 // <p>
53 // Because the constructors automatically converts from a Bool or
54 // a String, the user does not need to be aware of MaskSpecifier.
55 // </synopsis>
56 
57 // <motivation>
58 // The number of constructors in PagedImage would be many more
59 // without this class. It would need one taking a Bool and a String.
60 // Because C++ converts a const char* to Bool instead of String,
61 // a const char* would also be needed multiple times.
62 // </motivation>
63 
64 //# <todo asof="1997/11/11">
65 //# <li>
66 //# </todo>
67 
68 
70 {
71 public:
72  // Default constructor.
73  // It tells if the default mask should or no mask be used.
74  MaskSpecifier (Bool useDefaultMask = True)
75  : itsFlag(useDefaultMask) {}
76 
77  // Construct from a string.
78  // It tells to use an alternative mask. An empty name means no mask.
79  //# Note the const Char* constructor is needed, otherwise "name"
80  //# is converted to a Bool by the compiler.
81  // <group>
82  MaskSpecifier (const Char* maskName)
83  : itsFlag(False), itsName(maskName) {}
84  MaskSpecifier (const String& maskName)
85  : itsFlag(False), itsName(maskName) {}
86  // </group>
87 
88  // Give the flag or name.
89  // <group>
90  Bool useDefault() const
91  { return itsFlag; }
92  const String& name() const
93  { return itsName; }
94  // </group>
95 
96 
97 private:
100 };
101 
102 
103 
104 } //# NAMESPACE CASACORE - END
105 
106 #endif
MaskSpecifier(Bool useDefaultMask=True)
Default constructor.
Definition: MaskSpecifier.h:74
const String & name() const
Definition: MaskSpecifier.h:92
MaskSpecifier(const Char *maskName)
Construct from a string.
Definition: MaskSpecifier.h:82
Bool useDefault() const
Give the flag or name.
Definition: MaskSpecifier.h:90
MaskSpecifier(const String &maskName)
Definition: MaskSpecifier.h:84
String: the storage and methods of handling collections of characters.
Definition: String.h:225
this file contains all the compiler specific defines
Definition: mainpage.dox:28
const Bool False
Definition: aipstype.h:44
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool True
Definition: aipstype.h:43
char Char
Definition: aipstype.h:46