00001 //# tSubImage.cc: Test program for class SubImage 00002 //# Copyright (C) 1998,1999,2000,2001,2003 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This program is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU General Public License as published by the Free 00007 //# Software Foundation; either version 2 of the License, or (at your option) 00008 //# any later version. 00009 //# 00010 //# This program 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 General Public License for 00013 //# more details. 00014 //# 00015 //# You should have received a copy of the GNU General Public License along 00016 //# with this program; if not, write to the Free Software Foundation, Inc., 00017 //# 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: tSubImage.cc 20567 2009-04-09 23:12:39Z gervandiepen $ 00027 00028 #ifndef IMAGEANALYSIS_LOGFILE_H 00029 #define IMAGEANALYSIS_LOGFILE_H 00030 00031 #include <casa/IO/FiledesIO.h> 00032 #include <casa/namespace.h> 00033 #include <memory> 00034 00035 namespace casa { 00036 00037 class LogFile { 00038 // <summary> 00039 // Class for operations on a log file 00040 // </summary> 00041 00042 // <reviewed reviewer="" date="" tests="" demos=""> 00043 // </reviewed> 00044 00045 // <prerequisite> 00046 // </prerequisite> 00047 00048 // <etymology> 00049 // Image tasking 00050 // </etymology> 00051 00052 // <synopsis> 00053 // Class for operations on a log file 00054 // </synopsis> 00055 00056 // <todo> 00057 // Reimplement in terms of fstream 00058 00059 public: 00060 00061 // The constructor does sanity checking such as that the file 00062 // is writable. 00063 LogFile(const String& filename); 00064 00065 virtual ~LogFile(); 00066 00067 // Should file be appended to if it exists? 00068 void setAppend(const Bool a); 00069 00070 // returns True if file successfully opened 00071 Bool open(); 00072 00073 void close() const; 00074 00075 // Write output to file. If open is False, it is assumed there is apriori information 00076 // that the file is open and no such check will be done before writing. If close is True, 00077 // the file will be closed after writing the output, if True it will be left open (which 00078 // normally means the caller still have more writing to do). 00079 Bool write( 00080 const String& output, const Bool open=True, 00081 const Bool close=True 00082 ); 00083 00084 private: 00085 00086 String _filename; 00087 Bool _append; 00088 Int _fileHandle; 00089 std::unique_ptr<FiledesIO> _fileIO; 00090 00091 }; 00092 } 00093 00094 #endif