Loading...
Searching...
No Matches
casacore::AppInfo Class Reference
casa package (libcasa_casa) » System_module

More...

`#include <AppInfo.h>`

## Static Public Member Functions

static Vector< String > | workDirectories (uInt minimumFreeSpaceInMB=0)
| Return a list of directory names into which the user may write data.
static String | workDirectory (uInt minimumFreeSpaceInMB=0)
| Choose a workDirectory with at least minimumFreeSpace MB of free space available.
static String | workFileName (uInt minimumFreeSpaceInMB=0, const String &filenamePrefix="aipstmp_")
| This function returns a fully qualified filename for a non-existent file in a work directory with enough free space.
static Double | timeZone ()
| Return the local time zone offset in day fractions.

## Static Private Member Functions

static void | init ()
| Force an initialization of the AppInfo values.

## Static Private Attributes

static Bool | need_init_p
static uInt | tz_r

## Detailed Description

General information for applications.

### Intended use:

Public interface

### Review Status

Reviewed By:
  wbrouw
Date Reviewed:
  1997/10/30
Test programs:
  tAppInfo

### Prerequisite

- Aipsrc class

### Synopsis

This class provides general information that an application might want to know about its processing environment. This will be based either on information coded into aipsrc variables, or on information which can be obtained directly from some other source. For example, the time zone will generally be obtained from the host OS, but it can be overridden by an aipsrc variable if necessary.

Generally speaking, this class is provided to hide the details of how the information is encoded into an aipsrc variables and to avoid having to change applications if the information moves from being coded into a variable to being deduced at runtime.

It is expected that the information which is available from this class will accrete with time.

### Motivation

Further encapsulate information which is usually in aipsrc variables.

### Thrown Exceptions

- AipsError if abs(timeZone()) > 0.625

Definition at line 81 of file AppInfo.h.

## Member Function Documentation

## init()

void casacore::AppInfo::init | ( |  | ) |

static private

Force an initialization of the AppInfo values.

Referenced by timeZone().

## timeZone()

Double casacore::AppInfo::timeZone | ( |  | ) |

inline static

Return the local time zone offset in day fractions.

This value has to be added to UTC to get local time. Generally the OS supplied value will be used, however it can be overridden with system.time.tzoffset if necessary.

Definition at line 140 of file AppInfo.h.

References casacore::AipsrcValue< T >::get(), init(), need_init_p, and tz_r.

## workDirectories()

Vector< String > casacore::AppInfo::workDirectories | ( | uInt | minimumFreeSpaceInMB = 0 | ) |

static

Return a list of directory names into which the user may write data.

If minimumFreeSpace is set (>0) then only directories with at least that much free space (in megabytes) are returned. If the aipsrc variable user.directories.work is set, the candidate directories are taken from that variable, otherwise the current working directory (".") is chosen if it exists and is writeable, otherwise /tmp is the candidate. Only one of "." and "/tmp" is chosen, not both.

If no suitable directories are found (i.e., writable directories with enough free space), a zero-length vector is returned. A warning is issued to the logging system for directories which do not exist or are not writable.

## workDirectory()

String casacore::AppInfo::workDirectory | ( | uInt | minimumFreeSpaceInMB = 0 | ) |

static

Choose a workDirectory with at least minimumFreeSpace MB of free space available.

It uses workDirectories. If there is more than one valid directory it arranges to choose different directories in succession in an attempt to spread out the I/O. That is, on the first call it will return directory1, on the second it will return directory2, etc. in a cyclical fashion. One can imagine more elaborate algorithms than this, however this should suffice for some time, if not forever.

### Thrown Exceptions

- An AipsError is thrown if no directory with enough free space is found.

## workFileName()

String casacore::AppInfo::workFileName | ( | uInt | minimumFreeSpaceInMB = 0,
|  | const String & | filenamePrefix = "aipstmp_" )

static

This function returns a fully qualified filename for a non-existent file in a work directory with enough free space.

That is, you can create a temporary file with the name returned from this function. This function calls workDirectory and then appends a unique (file does not exist) filename. By default the prefix of temporary file name is aipstmp_, but you can override this if you choose.

### Thrown Exceptions

- An AipsError is thrown if no directory with enough free space is found.

## Member Data Documentation

## need_init_p

Bool casacore::AppInfo::need_init_p

static private

Definition at line 131 of file AppInfo.h.

Referenced by timeZone().

## tz_r

uInt casacore::AppInfo::tz_r

static private

Definition at line 132 of file AppInfo.h.

Referenced by timeZone().

The documentation for this class was generated from the following file:

- casa/System/AppInfo.h