next up previous contents
Next: Data models Up: No Title Previous: Defining a New

Method Definitions

Before any particular method can be used the argument list it requires must first by defined by the calling application. This is done with a call to an initialisation routine called, in this example NEW0_INIT. Some of the lines it contains are,

      IF ( AST_QPKGI( NEW__PKG ) ) RETURN
Logical function that returns .TRUE. if the package is already defined.
      CALL ADI_REQPKG( 'new', STATUS )
Requires the use of data models defined in the file new.adi.
      CALL ADI_DEFFUN( 'NewRead(_Image,_HDSfile)', NEW1_IMREAD, DID, STATUS )
      CALL ADI_DEFFUN( 'NewRead(_,_HDSfile)', NEW1_READ, DID, STATUS )
      CALL ADI_DEFFUN( 'NewRead(_Image,_FITSfile)', NEW2_IMREAD, DID, STATUS )
      CALL ADI_DEFFUN( 'NewRead(_,_FITSHDSfile)', NEW2_READ, DID, STATUS )
Arguments are; DEFINITION, SUBROUTINE, DUMMY POINTER, STATUS

The method NewRead requires two arguments to be passed, the first describing the type of data to be read and the second the type of file to be accessed. When this method is called its arguments are checked against all stored definition of NewRead, and the first one to match the type of both arguments is executed.

Thus if the user requires data to be read in from a HDS files to an Image structure pointer then the subroutine NEW1_IMREAD will be called. If, however, the data is to be read into any other type of object (as indicated by ` _') then the subroutine NEW1_READ is called instead.





Asterix
Tue Jun 23 11:33:25 BST 1998