casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LogFile.h
Go to the documentation of this file.
1 //# tSubImage.cc: Test program for class SubImage
2 //# Copyright (C) 1998,1999,2000,2001,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This program is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU General Public License as published by the Free
7 //# Software Foundation; either version 2 of the License, or (at your option)
8 //# any later version.
9 //#
10 //# This program 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 General Public License for
13 //# more details.
14 //#
15 //# You should have received a copy of the GNU General Public License along
16 //# with this program; if not, write to the Free Software Foundation, Inc.,
17 //# 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: tSubImage.cc 20567 2009-04-09 23:12:39Z gervandiepen $
27 
28 #ifndef IMAGEANALYSIS_LOGFILE_H
29 #define IMAGEANALYSIS_LOGFILE_H
30 
31 #include <casa/IO/FiledesIO.h>
32 #include <casa/namespace.h>
33 #include <memory>
34 
35 namespace casa {
36 
37 class LogFile {
38  // <summary>
39  // Class for operations on a log file
40  // </summary>
41 
42  // <reviewed reviewer="" date="" tests="" demos="">
43  // </reviewed>
44 
45  // <prerequisite>
46  // </prerequisite>
47 
48  // <etymology>
49  // Image tasking
50  // </etymology>
51 
52  // <synopsis>
53  // Class for operations on a log file
54  // </synopsis>
55 
56  // <todo>
57  // Reimplement in terms of fstream
58 
59 public:
60 
61  // The constructor does sanity checking such as that the file
62  // is writable.
63  LogFile(const casacore::String& filename);
64 
65  virtual ~LogFile();
66 
67  // Should file be appended to if it exists?
68  void setAppend(const casacore::Bool a);
69 
70  // returns true if file successfully opened
72 
73  void close() const;
74 
75  // Write output to file. If open is false, it is assumed there is apriori information
76  // that the file is open and no such check will be done before writing. If close is true,
77  // the file will be closed after writing the output, if true it will be left open (which
78  // normally means the caller still have more writing to do).
80  const casacore::String& output, const casacore::Bool open=true,
81  const casacore::Bool close=true
82  );
83 
84 private:
85 
89  std::unique_ptr<casacore::FiledesIO> _fileIO;
90 
91 };
92 }
93 
94 #endif
int Int
Definition: aipstype.h:50
casacore::String _filename
Definition: LogFile.h:86
casacore::Bool open()
LogFile(const casacore::String &filename)
Class for operations on a log file.
casacore::Int _fileHandle
Definition: LogFile.h:88
virtual ~LogFile()
casacore::Bool _append
Definition: LogFile.h:87
void close() const
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Bool write(const casacore::String &output, const casacore::Bool open=true, const casacore::Bool close=true)
std::unique_ptr< casacore::FiledesIO > _fileIO
Definition: LogFile.h:89
String: the storage and methods of handling collections of characters.
Definition: String.h:223
void setAppend(const casacore::Bool a)