A CmpMap does not store copies of its component Mappings, but simply
holds pointers to them. In the example above
(), we were free to annul the individual
Mapping pointers after creating the CmpMap because the pointers held
internally by the CmpMap increased the reference count (RefCount
attribute) of each component Mapping by one. The individual components
are therefore not deleted by astAnnul, but retained until the CmpMap
itself is deleted and annuls the pointers it holds. Consistent use of
astAnnul (
) and/or pointer contexts
(
) will therefore ensure that all Objects are
deleted at the appropriate time.
Note that access to a CmpMap's component Mappings is not generally available unless pointers to them are retained when the CmpMap is created. If such pointers are retained, then subsequent modifications to the individual components can be used to indirectly modify the behaviour of the overall CmpMap.
There is an important exception to this, however, because a CmpMap
retains a copy of the initial Invert flag settings of each of its
components and uses these in order to ignore any subsequent external
changes. This means that you may invert either component Mapping
before inserting it into a CmpMap and need not worry if you un-invert
it again later. The CmpMap's behaviour will not be affected by the
later action.
AST A Library for Handling World Coordinate Systems in Astronomy