The use of source and sink functions with a FitsChan is optional. This
is because you can always arrange to explicitly fill a FitsChan with
FITS cards () and you can also extract any
cards that remain and write them out yourself
(
) before you delete the FitsChan.
If you choose to use these functions, however, they behave in a very
similar manner to those used by a Channel (
and
). You supply pointers to these functions,
as arguments to the constructor function astFitsChan when you create
the FitsChan (
). The source function is
invoked implicitly at this point to fill the FitsChan with FITS cards
and the FitsChan is then rewound, so that the first card becomes
current. The sink function is automatically invoked later, when the
FitsChan is deleted, in order to write out any cards that remain in
it.
The only real difference between the source and sink functions for a
FitsChan and a basic Channel is that FITS cards are limited in length
to 80 characters, so the choice of buffer size is simplified. The
``Source'' and ``Sink'' functions in and
could therefore be used to access FITS headers
stored in text files simply by changing LEN to be 80. If you were not
accessing a text file, however, appropriate changes to the I/O
statements would be needed since the separating newline characters
would be absent. The details obviously depend on the format of the
file you are handling, which need not necessarily be a true FITS file.
AST A Library for Handling World Coordinate Systems in Astronomy