Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1556 |
|
Package | utility | |
Module | tasking |
types is the means for defining the user interface (i.e., the functions and arguments) of other AIPS++tools.
An AIPS++tool or function usually takes various types of arguments. Glish itself is type-less and doesn't require that the type of a variable be defined explicitly or fixed, which has advantages and disadvantages. In the tasking system, it is important to impose some typing of variables so that, for example, the toolmanager knows whether a particular argument is a scalar or a measure or a file name. The types tool provides the mechanism for defining the type to be used in the toolmanager's user interface.
This works as follows:
The net result for the developer is that a user interface for any tool or function may be generated easily merely by provision of a meta information file.
An example of a meta information file follows. This defines the interface for a tool called imager and hence should be located in a file called imager_meta.g.
pragma include once; # Include once only include 'types.g'; # Required # # Name the include file that defines the tool types.class('imager').includefile('imager.g'); # # Constructor names are preceeded by ctor_. Then follows the # list of arguments. Each argument is defined with a # function call of this form: # # type(arg, default=unset, dir='in', checkeval=T) # # where type is defined in type.g and is one of: # # file|table|string|integer|float|double|record|boolean|vector_string|complex # # arg is the name of the argument # default sets default values (may be an executable string) # dir sets the direction of the argument # checkeval=T means that a string value is eval'ed and checked, # otherwise no such check is done. # # The functions may be assigned to groups using the # group('mygroup') function. A group() call resets the # group to the default, which is 'basic'. # # Define two constructors, one with just a table name, and the other # with more arguments types.method('ctor_imager').table('filename'). method('ctor_imagertester').string('filename', '3C273XC1.ms'). integer('size', 256).string('cell', '0.7arcsec').string('stokes', 'IV'). string('coordinates', 'b1950'); # Methods # Open with just a table name types.group('basic').method('open').table('thems'); # Plain close types.method('close'); # Get the name back types.method('name').string('return'); # Summary types.method('summary'); # Set various image parameters. Note the use of the measures # tool to set the phasecenter. types.group('setup').method('setimage').integer('nx',128).integer('ny',128). string('cellx','1arcsec').string('celly','1arcsec'). string('stokes', 'I'). boolean('doshift', F). record('phasecenter', 'dm.direction(\'b1950\', \'0d\', \'0d\')',checkeval=F). string('shiftx','0arcsec').string('shifty','0arcsec'). string('mode', 'mfs').integer('nchan', 1).integer('start', 1). integer('step', 1).string('mstart', '0km/s').string('mstep', '0km/s'). integer('spwid', 1).integer('fieldid', 1);
addmeta | Copy meta information to a class |
all | Show all classes |
antennas | Define a list of antennas |
attachhelp | Attach help from the help system |
baselines | Define a list of baselines |
boolean | Define a boolean |
check | Choose one or more from a list of strings |
choice | Choose one from a list of strings |
class | Define a class or type of tool |
classes | Return names of the classes |
complex | Define a complex |
direction | Define a direction measure |
directory | Define a directory |
double | Define a double |
epoch | Define an epoch measure |
exists | Does the class, method, arg exist? |
fields | Define a list of field ids |
file | Define a file |
float | Define a float |
getincludefile | Get the include file for a class |
group | Define the group name for a function |
includefile | Specify the include file for a class |
includemeta | Include all meta information files |
integer | Define an integer |
is_tool | Is this a tool? |
list | Define a list of other types |
measure | Define a measure |
measurecodes | Define the reference code for a measure |
meta | Return meta information for a type of tool |
method | Define a method or function for a class |
msselect | Define a taql string for a MeasurementSet |
position | Define a position measure |
quantity | Define a quantity |
record | Define a record |
region | Define a region |
spectralwindows | Define a list of spectralwindows |
string | Define a string |
table | Define a table |
taql | Define a Table Query Language string |
untyped | Define an untyped variable |
vector_boolean | Define a vector of booleans |
vector_complex | Define a vector of complexs |
vector_double | Define a vector of doubles |
vector_float | Define a vector of floats |
vector_integer | Define a vector of integer |
vector_string | Define a vector of strings |