#include <AipsrcValue.h>
Inheritance diagram for casa::AipsrcValue< T >:


Part of API
A class for getting values from the Aipsrc files
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:
Bool AipsrcValue<Type>::find(Type &result, const String &keyword) Bool AipsrcValue<Type>::find(Type &result, const String &keyword, const Type &deflt)
The class is templated. For ease of use typedefs are provided for:
AipsrcDouble, AipsrcInt, AipsrcBool, AipsrcString AipsrcVDouble, AipsrcVInt, AipsrcVBool, AipsrcVString
Bool AipsrcValue<Type>::find(Type &result, const String &keyword, const Unit &defun, const Unit &resun) Bool AipsrcValue<Type>::find(Type &result, const String &keyword, const Unit &defun, const Unit &resun, const Type &deflt)
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.
String tzoff; // result of keyword find if (!AipsrcValue<Double>::find(tzoff, "time.zone.offset")) { // look for key tzoff = -5; };
AipsrcDouble::find(tzoff, "time.zone.offset", -5);
AipsrcDouble::find(tzoff, "time.zone.offset", "h", "h", -5);
>> 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.
Programs need a way to interact with the AipsrcValue files.
Definition at line 157 of file AipsrcValue.h.
Public Member Functions | |
| AipsrcValue () | |
| Default constructor Tip: A constructor (and destructor) have been provided to be able to generate a (routine-level) static register list. | |
| ~AipsrcValue () | |
| See note with constructor. | |
| template<> | |
| Bool | find (String &value, const String &keyword, const Unit &defun, const Unit &resun) |
Static Public Member Functions | |
| static void | save (uInt keyword) |
Save registered value to $HOME/.aipsrc. | |
| 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. | |
| 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. | |
| 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(). | |
| 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. | |
| static void | set (uInt keyword, const T &deflt) |
| Sets allow registered values to be set. | |
Private Member Functions | |
| AipsrcValue< T > & | operator= (const AipsrcValue< T > &other) |
| Copy constructor (not implemented). | |
| AipsrcValue (const AipsrcValue< T > &other) | |
Private Attributes | |
| Block< T > | tlst |
| Register list. | |
| Block< String > | ntlst |
Static Private Attributes | |
| static AipsrcValue | myp_p |
| The global AipsrcValue object. | |
| casa::AipsrcValue< T >::AipsrcValue | ( | ) |
Default constructor Tip: A constructor (and destructor) have been provided to be able to generate a (routine-level) static register list.
This had to be done since static data members are not yet implemented in the gcc compiler for templated classes. Once they are available the tlist and ntlst data can become static, constructor and desctructor and all references to the init() method can disappear.
| casa::AipsrcValue< T >::~AipsrcValue | ( | ) |
See note with constructor.
| casa::AipsrcValue< T >::AipsrcValue | ( | const AipsrcValue< T > & | other | ) | [private] |
| static Bool casa::AipsrcValue< T >::find | ( | T & | value, | |
| const String & | keyword | |||
| ) | [static] |
The find() functions will, given a keyword, return the value of a matched keyword found in the files.
If no match found the function will be False, and the default returned if specified.
| static Bool casa::AipsrcValue< T >::find | ( | T & | value, | |
| const String & | keyword, | |||
| const T & | deflt | |||
| ) | [static] |
| static Bool casa::AipsrcValue< T >::find | ( | T & | value, | |
| const String & | keyword, | |||
| const Unit & | defun, | |||
| const Unit & | resun | |||
| ) | [static] |
These find() functions will, given a keyword, read the value of a matched keyword as a Quantity.
If no unit has been given in the keyword value, the defun Unit will be assumed. The value returned will be converted to the resun Unit. If no match found, the default value is returned (see example above).
| static Bool casa::AipsrcValue< T >::find | ( | T & | value, | |
| const String & | keyword, | |||
| const Unit & | defun, | |||
| const Unit & | resun, | |||
| const T & | deflt | |||
| ) | [static] |
| static uInt casa::AipsrcValue< T >::registerRC | ( | const String & | keyword, | |
| const T & | deflt | |||
| ) | [static] |
| static uInt casa::AipsrcValue< T >::registerRC | ( | const String & | keyword, | |
| const Unit & | defun, | |||
| const Unit & | resun, | |||
| const T & | deflt | |||
| ) | [static] |
| static const T& casa::AipsrcValue< T >::get | ( | uInt | keyword | ) | [static] |
Gets are like find, but using registered integers rather than names.
The aipsrc file is read only once, and values can be set as well.
Reimplemented from casa::Aipsrc.
| static void casa::AipsrcValue< T >::set | ( | uInt | keyword, | |
| const T & | deflt | |||
| ) | [static] |
Sets allow registered values to be set.
| static void casa::AipsrcValue< T >::save | ( | uInt | keyword | ) | [static] |
| AipsrcValue<T>& casa::AipsrcValue< T >::operator= | ( | const AipsrcValue< T > & | other | ) | [private] |
Copy constructor (not implemented).
| Bool casa::AipsrcValue< String >::find | ( | String & | value, | |
| const String & | keyword, | |||
| const Unit & | defun, | |||
| const Unit & | resun | |||
| ) |
AipsrcValue casa::AipsrcValue< T >::myp_p [static, private] |
Block<T> casa::AipsrcValue< T >::tlst [private] |
Block<String> casa::AipsrcValue< T >::ntlst [private] |
Definition at line 226 of file AipsrcValue.h.
1.5.1