next up previous 264
Next: astAddColumn - Add a new column definition to a table
Up: AST Function Descriptions
Previous: AST Function Descriptions


astSet - Set attribute values for an Object

Description:
This function assigns a set of attribute values to an Object, over-riding any previous values. The attributes and their new values are specified via a character string, which should contain a comma-separated list of the form:

"attribute_1 = value_1, attribute_2 = value_2, ... "

where "attribute_n" specifies an attribute name, and the value to the right of each "=" sign should be a suitable textual representation of the value to be assigned. This value will be interpreted according to the attribute's data type.

The string supplied may also contain "printf"-style format specifiers, identified by "%" signs in the usual way. If present, these will be substituted by values supplied as additional optional arguments (using the normal "printf" rules) before the string is used.

Synopsis:
void astSet( AstObject $*$this, const char $*$settings, ... )
Parameters:
this
Pointer to the Object.
settings
Pointer to a null-terminated character string containing a comma-separated list of attribute settings in the form described above.
...
Optional additional arguments which supply values to be substituted for any "printf"-style format specifiers that appear in the "settings" string.
Class Applicability:
Object
This function applies to all Objects.
Examples:
astSet( map, "Report = 1, Zoom = 25.0" );

Sets the Report attribute for Object "map" to the value 1 and the Zoom attribute to 25.0.
astSet( frame, "Label( %d ) =Offset along axis %d", axis, axis );

Sets the Label(axis) attribute for Object "frame" to a suitable string, where the axis number is obtained from "axis", a variable of type int.
astSet( frame, "Title =%s", mystring );

Sets the Title attribute for Object "frame" to the contents of the string "mystring".
Notes:
  • Attribute names are not case sensitive and may be surrounded by white space.

  • White space may also surround attribute values, where it will generally be ignored (except for string-valued attributes where it is significant and forms part of the value to be assigned).

  • To include a literal comma in the value assigned to an attribute, the whole attribute value should be enclosed in quotation markes. Alternatively, you can use "%s" format and supply the value as a separate additional argument to astSet (or use the astSetC function instead).

  • The same procedure may be adopted if "%" signs are to be included and are not to be interpreted as format specifiers (alternatively, the "printf" convention of writing "%%" may be used).

  • An error will result if an attempt is made to set a value for a read-only attribute.


next up previous 264
Next: astAddColumn - Add a new column definition to a table
Up: AST Function Descriptions
Previous: AST Function Descriptions

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

Copyright (C) 2009 Science \& Technology Facilities Council