next up previous 264
Next: astGetActiveUnit - Determines how the Unit attribute will be used
Up: AST Function Descriptions
Previous: astGenCurve - Draw a generalized curve


astGet$<$X$>$ - Get an attribute value for an Object

Description:
This is a family of functions which return a specified attribute value for an Object using one of several different data types. The type is selected by replacing $<$X$>$ in the function name by C, D, F, I or L, to obtain a result in const char$*$ (i.e. string), double, float, int, or long format, respectively.

If possible, the attribute value is converted to the type you request. If conversion is not possible, an error will result.

Synopsis:
$<$X$>$type astGet$<$X$>$( AstObject $*$this, const char $*$attrib )
Parameters:
this
Pointer to the Object.
attrib
Pointer to a null-terminated string containing the name of the attribute whose value is required.
Class Applicability:
Object
These functions apply to all Objects.
Returned Value:
astGet$<$X$>$()
The attribute value, in the data type corresponding to $<$X$>$ (or, in the case of astGetC, a pointer to a constant null-terminated character string containing this value).
Examples:
printf( "RefCount = %d$\backslash$n", astGetI( z, "RefCount" ) );

Prints the RefCount attribute value for Object "z" as an int.
title = astGetC( axis, "Title" );

Obtains a pointer to a null-terminated character string containing the Title attribute of Object "axis".
Notes:
  • Attribute names are not case sensitive and may be surrounded by white space.

  • An appropriate "null" value will be returned if this function is invoked with the AST error status set, or if it should fail for any reason. This null value is zero for numeric values and NULL for pointer values.

  • The pointer returned by astGetC is guaranteed to remain valid and the string to which it points will not be over-written for a total of 50 successive invocations of this function. After this, the memory containing the string may be re-used, so a copy of the string should be made if it is needed for longer than this.


next up previous 264
Next: astGetActiveUnit - Determines how the Unit attribute will be used
Up: AST Function Descriptions
Previous: astGenCurve - Draw a generalized curve

AST A Library for Handling World Coordinate Systems in Astronomy
Starlink User Note 211
R.F. Warren-Smith & D.S. Berry
25th February 2013
E-mail:starlink@jiscmail.ac.uk

Copyright (C) 2014 Science \& Technology Facilities Council