next up previous
Next: Copying Objects
Up: An AST Object Primer
Previous: AST Pointer Contexts Begin and End

Exporting and Exempting AST Pointers

The AST_EXPORT routine allows you to export particular pointers from one AST context ([*]) to the next outer one, as follows:

      CALL AST_EXPORT( ZOOMMAP, STATUS )

This would identify the pointer stored in ZOOMMAP as being required after the end of the current AST context. It causes any pointers nominated in this way to survive the next call to AST_END (but only one such call) unscathed, so that they are available to the next outer context. This facility is not needed often, but is invaluable when the purpose of your AST_BEGIN...AST_END block is basically to generate an Object pointer. Without this, there is no way of getting that pointer out.

Sometimes, you may also want to exempt a pointer from all the effects of AST contexts. You should not need to do this often, but it will prove essential if you ever need to write a library of routines that stores AST pointers as part of its own internal data. Without some form of exemption, the caller of your routines could cause the pointers you have stored to be annulled--thus corrupting your internal data--simply by using AST_END. To avoid this, you should use AST_EXEMPT on each pointer that you store, for example:

      CALL AST_EXEMPT( ZOOMMAP, STATUS )

This will prevent the pointer being affected by any subsequent use of AST_END. Of course, it then becomes your responsibility to annul this pointer (using AST_ANNUL) when it is no longer required.



next up previous
Next: Copying Objects
Up: An AST Object Primer
Previous: AST Pointer Contexts Begin and End

AST A Library for Handling World Coordinate Systems in Astronomy
Starlink User Note 210
R.F. Warren-Smith & D.S. Berry
30th April 2003
E-mail:ussc@star.rl.ac.uk

Copyright (C) 2003 Central Laboratory of the Research Councils