next up previous 264
Next: astMapLenC - Get the number of characters in a character entry in a KeyMap
Up: AST Function Descriptions
Previous: astMapHasKey - Check if an entry with a given key exists in a KeyMap


astMapKey - Get the key at a given index within the KeyMap

Description:
This function returns a string holding the key for the entry with the given index within the KeyMap.

This function is intended primarily as a means of iterating round all the elements in a KeyMap. For this purpose, the number of entries in the KeyMap should first be found using astMapSize and this function should then be called in a loop, with the index value going from zero to one less than the size of the KeyMap. The index associated with a given entry is determined by the SortBy attribute.

Synopsis:
const char $*$astMapKey( AstKeyMap $*$this, int index )
Parameters:
this
Pointer to the KeyMap.
index
The index into the KeyMap. The first entry has index zero, and the last has index "size-1", where "size" is the value returned by the astMapSize function.
Returned Value:
astMapKey()
A pointer to a null-terminated string containing the key.
Notes:
  • The returned pointer 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.

  • A NULL pointer will be returned if this function is invoked with the AST error status set, or if it should fail for any reason.


next up previous 264
Next: astMapLenC - Get the number of characters in a character entry in a KeyMap
Up: AST Function Descriptions
Previous: astMapHasKey - Check if an entry with a given key exists in a KeyMap

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