casa
$Rev:20696$
|
00001 //# MaskSpecifier.h: Class to specify which mask to use in an image 00002 //# Copyright (C) 1999 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: MaskSpecifier.h 18093 2004-11-30 17:51:10Z ddebonis $ 00027 00028 #ifndef IMAGES_MASKSPECIFIER_H 00029 #define IMAGES_MASKSPECIFIER_H 00030 00031 //# Includes 00032 #include <casa/aips.h> 00033 #include <casa/BasicSL/String.h> 00034 00035 00036 namespace casa { //# NAMESPACE CASA - BEGIN 00037 00038 // <summary> 00039 // Class to specify which mask to use in an image. 00040 // </summary> 00041 00042 // <use visibility=export> 00043 00044 // <reviewed reviewer="" date="" tests="tPagedImage"> 00045 // </reviewed> 00046 00047 // <synopsis> 00048 // The only purpose of MaskSpecifier is to reduce the number of constructors 00049 // in PagedImage. It makes it possible to specify if no mask, the default 00050 // mask, or another mask should be used when opening an existing PagedImage 00051 // object. 00052 // <p> 00053 // Because the constructors automatically converts from a Bool or 00054 // a String, the user does not need to be aware of MaskSpecifier. 00055 // </synopsis> 00056 00057 // <motivation> 00058 // The number of constructors in PagedImage would be many more 00059 // without this class. It would need one taking a Bool and a String. 00060 // Because C++ converts a const char* to Bool instead of String, 00061 // a const char* would also be needed multiple times. 00062 // </motivation> 00063 00064 //# <todo asof="1997/11/11"> 00065 //# <li> 00066 //# </todo> 00067 00068 00069 class MaskSpecifier 00070 { 00071 public: 00072 // Default constructor. 00073 // It tells if the default mask should or no mask be used. 00074 MaskSpecifier (Bool useDefaultMask = True) 00075 : itsFlag(useDefaultMask) {} 00076 00077 // Construct from a string. 00078 // It tells to use an alternative mask. An empty name means no mask. 00079 //# Note the const Char* constructor is needed, otherwise "name" 00080 //# is converted to a Bool by the compiler. 00081 // <group> 00082 MaskSpecifier (const Char* maskName) 00083 : itsFlag(False), itsName(maskName) {} 00084 MaskSpecifier (const String& maskName) 00085 : itsFlag(False), itsName(maskName) {} 00086 // </group> 00087 00088 // Give the flag or name. 00089 // <group> 00090 Bool useDefault() const 00091 { return itsFlag; } 00092 const String& name() const 00093 { return itsName; } 00094 // </group> 00095 00096 00097 private: 00098 Bool itsFlag; 00099 String itsName; 00100 }; 00101 00102 00103 00104 } //# NAMESPACE CASA - END 00105 00106 #endif