casacore
Loading...
Searching...
No Matches
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: 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 TABLES_NEWFILE_H
27#define TABLES_NEWFILE_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/casa/BasicSL/String.h>
31
32namespace casacore { // # NAMESPACE CASACORE - BEGIN
33
34// <summary>
35// Do checks for a new (non-existent) file.
36// </summary>
37
38// <use visibility=export>
39
40// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
41// </reviewed>
42//
43// <etymology>
44// Use this if you want a New File.
45// </etymology>
46//
47// <synopsis>
48// NewFile is a class checking if a new file already exists.
49// If the file exists, then the user is asked via Choice::choice whether or not
50// he or she wants to delete the file before using it.
51// </synopsis>
52//
53// <example>
54// NewFile validFile;
55// String newFileName("bigone"), error;
56// Bool ok = validFile.valueOK(newFileName, error);
57// if (!ok) {
58// cout << error << endl;
59// }
60// </example>
61//
62// <motivation>
63// Output file names are fairly common parameters, this consolidates the error
64// checking and "remove if it already exists" logic.
65// </motivation>
66//
67// <todo asof="1996/12/10">
68// <li> We should probably make sure that the file is writable
69// </todo>
70
71class NewFile {
72 public:
73 // Currently the deleteIfExists argument has no affect
74 NewFile(Bool deleteIfExists = True);
75
76 // Copy constructor (copy semantics)
77 NewFile(const NewFile &other);
78
79 // Assignment (copy semantics)
80 NewFile &operator=(const NewFile &other);
81
82 // Destructor
84
85 // Indicates whether the specified string is a valid new file,
86 // invoking the choice GUI. If it returns False, an error
87 // message is returned.
88 Bool valueOK(const String &value, String &error) const;
89
90 private:
92};
93
94} // namespace casacore
95
96#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.
~NewFile()
Destructor.
NewFile(const NewFile &other)
Copy constructor (copy semantics).
NewFile(Bool deleteIfExists=True)
Currently the deleteIfExists argument has no affect.
String: the storage and methods of handling collections of characters.
Definition String.h:355
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
const Bool True
Definition aipstype.h:41
NewDelAllocator< T > NewDelAllocator< T >::value
Definition Allocator.h:360