Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.atnf.csiro.au/computing/software/casacore/casacore-1.2.0/doc/html/AppInfo_8h_source.html
Дата изменения: Unknown Дата индексирования: Mon Feb 14 19:50:57 2011 Кодировка: Поисковые слова: sts-64 |
00001 //# AppInfo.h: General information for applications 00002 //# Copyright (C) 1996,1997 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 //# 00027 //# $Id: AppInfo.h 20652 2009-07-06 05:04:32Z Malte.Marquarding $ 00028 00029 #ifndef CASA_APPINFO_H 00030 #define CASA_APPINFO_H 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 #include <casa/System/AipsrcValue.h> 00035 00036 namespace casa { //# NAMESPACE CASA - BEGIN 00037 00038 //# Forward declarations 00039 class String; 00040 template<class T> class Vector; 00041 00042 // <summary> 00043 // General information for applications. 00044 // </summary> 00045 00046 // <use visibility=export> 00047 00048 // <reviewed reviewer="wbrouw" date="1997/10/30" tests="tAppInfo" demos=""> 00049 // </reviewed> 00050 00051 // <prerequisite> 00052 // <li> <linkto class=Aipsrc>Aipsrc</linkto> class 00053 // </prerequisite> 00054 // 00055 // <synopsis> 00056 // This class provides general information that an application might want to 00057 // know about its processing environment. This will be based either on 00058 // information coded into <linkto class=Aipsrc>aipsrc</linkto> variables, or 00059 // on information which can be obtained directly from some other source. For 00060 // example, the time zone will generally be obtained from the host OS, but it 00061 // can be overridden by an <linkto class=Aipsrc>aipsrc</linkto> variable if 00062 // necessary. 00063 // 00064 // Generally speaking, this class is provided to hide the details of how the 00065 // information is encoded into an <linkto class=Aipsrc>aipsrc</linkto> variables 00066 // and to avoid having to change applications if the information moves from 00067 // being coded into a variable to being deduced at runtime. 00068 // 00069 // It is expected that the information which is available from this class will 00070 // accrete with time. 00071 // </synopsis> 00072 // 00073 // <motivation> 00074 // Further encapsulate information which is usually in aipsrc variables. 00075 // </motivation> 00076 // 00077 // <thrown> 00078 // <li> AipsError if abs(timeZone()) > 0.625 00079 // </thrown> 00080 // 00081 // <todo asof="1997/11/11"> 00082 // </todo> 00083 00084 class AppInfo { 00085 public: 00086 // Return a list of directory names into which the user may write data. If 00087 // <src>minimumFreeSpace</src> is set (>0) then only directories with at 00088 // least that much free space (in megabytes) are returned. If the aipsrc 00089 // variable <src>user.directories.work</src> is set, the candidate 00090 // directories are taken from that variable, otherwise the current working 00091 // directory (".") is chosen if it exists and is writeable, otherwise /tmp 00092 // is the candidate. Only one of "." and "/tmp" is chosen, not both. 00093 // 00094 // If no suitable directories are found (i.e., writable directories with 00095 // enough free space), a zero-length vector is returned. A warning is 00096 // issued to the logging system for directories which do not exist or are 00097 // not writable. 00098 static Vector<String> workDirectories(uInt minimumFreeSpaceInMB=0); 00099 00100 // Choose a workDirectory with at least <src>minimumFreeSpace</src> MB of 00101 // free space available. It uses <src>workDirectories</src>. If there is 00102 // more than one valid directory it arranges to choose different 00103 // directories in succession in an attempt to spread out the I/O. That is, 00104 // on the first call it will return directory1, on the second it will 00105 // return directory2, etc. in a cyclical fashion. One can imagine more 00106 // elaborate algorithms than this, however this should suffice for some 00107 // time, if not forever. 00108 // <thrown> 00109 // <li> An <linkto class=AipsError>AipsError</linkto> is thrown if no 00110 // directory with enough free space is found. 00111 // </thrown> 00112 static String workDirectory(uInt minimumFreeSpaceInMB=0); 00113 00114 // This function returns a fully qualified filename for a non-existent file 00115 // in a work directory with enough free space. That is, you can create a 00116 // temporary file with the name returned from this function. This function 00117 // calls <src>workDirectory</src> and then appends a unique (file does not 00118 // exist) filename. By default the prefix of temporary file name is 00119 // <src>aipstmp_</src>, but you can override this if you choose. 00120 // <thrown> 00121 // <li> An <linkto class=AipsError>AipsError</linkto> is thrown if no 00122 // directory with enough free space is found. 00123 // </thrown> 00124 static String workFileName(uInt minimumFreeSpaceInMB=0, 00125 const String &filenamePrefix="aipstmp_"); 00126 00127 // Return the local time zone offset in day fractions. This value has to be 00128 // added to UTC to get local time. Generally the OS supplied value will be 00129 // used, however it can be overridden with 00130 // <src>system.time.tzoffset</src> if necessary. 00131 static Double timeZone(); 00132 private: 00133 //# Data 00134 static Bool need_init_p; 00135 static uInt tz_r; 00136 //# Methods 00137 // Force an initialization of the AppInfo values. 00138 static void init(); 00139 }; 00140 00141 //# Inlines 00142 00143 inline Double AppInfo::timeZone() {if (need_init_p) init(); 00144 return AipsrcValue<Double>::get(tz_r);}; 00145 00146 00147 } //# NAMESPACE CASA - END 00148 00149 #endif