casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NewFile.h
Go to the documentation of this file.
1 //# NewFile: Do checks for a new (non-existent) file
2 //# Copyright (C) 1996,1999,2002,2004
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 //#
27 //# $Id$
28 
29 #ifndef TABLES_NEWFILE_H
30 #define TABLES_NEWFILE_H
31 
32 #include <casacore/casa/aips.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 // <summary>
38 // Do checks for a new (non-existent) file.
39 // </summary>
40 
41 // <use visibility=export>
42 
43 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
44 // </reviewed>
45 //
46 // <etymology>
47 // Use this if you want a New File.
48 // </etymology>
49 //
50 // <synopsis>
51 // NewFile is a class checking if a new file already exists.
52 // If the file exists, then the user is asked via Choice::choice whether or not
53 // he or she wants to delete the file before using it.
54 // </synopsis>
55 //
56 // <example>
57 // NewFile validFile;
58 // String newFileName("bigone"), error;
59 // Bool ok = validFile.valueOK(newFileName, error);
60 // if (!ok) {
61 // cout << error << endl;
62 // }
63 // </example>
64 //
65 // <motivation>
66 // Output file names are fairly common parameters, this consolidates the error
67 // checking and "remove if it already exists" logic.
68 // </motivation>
69 //
70 // <todo asof="1996/12/10">
71 // <li> We should probably make sure that the file is writable
72 // </todo>
73 
74 class NewFile
75 {
76 public:
77 // Currently the deleteIfExists argument has no affect
78  NewFile(Bool deleteIfExists = True);
79 
80 // Copy constructor (copy semantics)
81  NewFile(const NewFile &other);
82 
83 // Assignment (copy semantics)
84  NewFile &operator=(const NewFile &other);
85 
86 // Destructor
87  ~NewFile();
88 
89 // Indicates whether the specified string is a valid new file,
90 // invoking the choice GUI. If it returns False, an error
91 // message is returned.
92  Bool valueOK(const String &value, String &error) const;
93 
94 private:
96 };
97 
98 
99 
100 } //# NAMESPACE CASACORE - END
101 
102 #endif
NewFile & operator=(const NewFile &other)
Assignment (copy semantics)
Bool valueOK(const String &value, String &error) const
Indicates whether the specified string is a valid new file, invoking the choice GUI.
Do checks for a new (non-existent) file.
Definition: NewFile.h:74
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
NewFile(Bool deleteIfExists=True)
Currently the deleteIfExists argument has no affect.
String: the storage and methods of handling collections of characters.
Definition: String.h:225
~NewFile()
Destructor.
const Bool True
Definition: aipstype.h:43
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.