Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: aipsrc.findlist - Function Up: aipsrc - Tool Previous: aipsrc.findfloat - Function


aipsrc.findint - Function



Package utility
Module misc
Tool aipsrc


lookup a float value resource definition


Synopsis
findint(value, keyword, def, undef, unres)


Description
findint will return T if the specified keyword was found in an aipsrc file, F otherwise. If a find was made, its value is returned, otherwise the specified (or default) default value def will be used. The value defined in the keyword is read as a float, and converted according to standard rules.
The value can be defined with optional units in the aipsrc file. By specifying in the findint a default unit string that has to be used in the absence of given units, and specifying units the result will be converted to before the value is returned. E.g.
drc.findint(x, 'test.int' , 5, 'km', 'm')
will assume that if the keyword is not present, the value of 5 is returned in x. If the keyword is given, but has no units specified, it will be assumed that the user has given the value in 'km'. The value returned will be converted to 'm' (i.e. thousand times bigger). If the user has specified units, the value returned will be converted to these ('m' in this case).



Example
With the following aipsrc keywords:
test.int:		2.9
test.int2:		2.9hm
The following will be the result:
- arc:=aipsrc()
- arc.findint(x, 'test.int')
T 
- x
2 
- arc.findint(x, 'test.int1')
F 
- x
0 
- arc.findint(x, 'test.int1', 7)
F 
- x
7 
- arc.findint(x, 'test.int', 7, 'm', 'km')
T 
- x
0 
- arc.findint(x, 'test.int', 7, 'km', 'm') 
T 
- x
2900 
- arc.findint(x, 'test.int1', 7, 'km', 'm')
F 
- x
7 
- arc.findint(x, 'test.int2', 7, 'km', 'm') 
T 
- x
290 
- arc.findint(x, 'test.int2', 7, '', '')    
T 
- x
290 
- arc.findint(x, 'test.int2', 7)         
T 
- x
2 
- arc.done()             # remove tool



Arguments

value   The value of the resource (Out)
    Allowed: Int
keyword   The name of the resource to look up (In)
    Allowed: String
def   Default value to use if keyword not found
    Allowed: Numeric
    Default: 0
undef   Default units to use if none given in aipsrc file
    Allowed: valid unit string
    Default: F
unres   The units the result will be converted to before giving the value from aipsrc file
    Allowed: valid unit string
    Default: F


Returns
Bool - is the resource defined?




next up previous contents index
Next: aipsrc.findlist - Function Up: aipsrc - Tool Previous: aipsrc.findfloat - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15