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

Exporting and Exempting AST Pointers

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

astExport( zoommap );

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 use of astEnd (but only one such use) 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 astBegin...astEnd 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 functions 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 astEnd. To avoid this, you should use astExempt on each pointer that you store, for example:

astExempt( zoommap );

This will prevent the pointer being affected by any subsequent use of astEnd. Of course, it then becomes your responsibility to annul this pointer (using astAnnul) 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 211
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