|
static Bool | find (T &value, const String &keyword) |
| The find() functions will, given a keyword, return the value of a matched keyword found in the files. More...
|
|
static Bool | find (T &value, const String &keyword, const T &deflt) |
|
static Bool | find (T &value, const String &keyword, const Unit &defun, const Unit &resun) |
| These find() functions will, given a keyword, read the value of a matched keyword as a Quantity. More...
|
|
static Bool | find (T &value, const String &keyword, const Unit &defun, const Unit &resun, const T &deflt) |
|
static uInt | registerRC (const String &keyword, const T &deflt) |
| Functions to register keywords for later use in get() and set(). More...
|
|
static uInt | registerRC (const String &keyword, const Unit &defun, const Unit &resun, const T &deflt) |
|
static const T & | get (uInt keyword) |
| Gets are like find, but using registered integers rather than names. More...
|
|
static void | set (uInt keyword, const T &deflt) |
| Sets allow registered values to be set. More...
|
|
static void | save (uInt keyword) |
| Save registered value to $HOME/.aipsrc More...
|
|
template<class T>
class casacore::AipsrcValue< T >
Class to read values from the Aipsrc general resource files
Intended use:
Public interface
Review Status
- Reviewed By:
- mhaller
- Date Reviewed:
- 1997/10/08
- Test programs:
- tAipsrcValue
Prerequisite
Etymology
A class for getting values from the Aipsrc files
Synopsis
The static AipsrcValue class can get typed values from the Aipsrc resource files.
The basic interaction with the class is with the static keyword match functions:
comparable to the standard (String) Aipsrc find.
If the resource file contains a multi-valued keyword, use the AipsrcVector class instead.
The class is templated. For ease of use typedefs are provided for:
In addition to the above finds, special finds:
const Unit &defun, const Unit &resun)
const Unit &defun, const Unit &resun,
const Type &deflt)
are provided. These finds will read the keyword value as a Quantity. If no units are given, the defun are assumed. The result is converted to the resun, before the value is returned. E.g.
find(x,
"time.offset",
"h",
"d");
will return:
-
2.5/24 for a value specified as 2.5 in resource file
-
2.5/24 for 2:30:00
-
0.5/24 for 30min
-
0.5 for 0.5d
The class has registerRC, get, set
functions as described in Aipsrc. Note that registration is on a per Type basis, and hence registration of the same keyword in different types (and possible sets) act on different values, but with the same result if no set has been done.
Specialisation exists for Bool
, where True
is any value string starting with one of 'yYtT123456789', and False in all other cases, and no finds with Units are provided. Strings are supposed to be handled by standard Aipsrc class for single values, and a specialisation exists for the AipsrcVector case.
Example
String tzoff;
tzoff = -5;
};
A more convenient way of accomplishing the same result is:
or even:
Here the final argument is the default to use if the keyword is not found at all.
Template Type Argument Requirements
-
All types with a
>>
defined.
Warning: Since interpretation of the keyword value string is done with the standard input right-shift operator, specialisations are necessary for non-standard cases like Bool; They are provided; String is supposed to be handled by standard Aipsrc;
Motivation
Programs need a way to interact with the AipsrcValue files.
Thrown Exceptions
-
AipsError if the environment variables HOME and/or AIPSPATH not set.
Definition at line 157 of file AipsrcValue.h.