/* @file  psFitsHeader.h
 * @brief Contains Fits header I/O routines
 *
 * @author Robert DeSonia, MHPCC
 *
 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
 * @date $Date: 2007-01-23 22:47:23 $
 *
 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
 */

#ifndef PS_FITSHEADER_H
#define PS_FITSHEADER_H

/// @addtogroup FileIO Input/Output
/// @{

#include "psFits.h"
#include "psMetadata.h"

/** Reads the header of the current HDU.
 *
 *  @return psMetadata*   the header data
 */
psMetadata* psFitsReadHeader(
    psMetadata* out,
    ///< The psMetadata to add the header data.  If null, a new psMetadata is created.
    const psFits* fits                 ///< the psFits object
);

/** Reads the header of all HDUs.  The current HDU is not changed.
 *
 *  @return psMetadata*      the header data set as a number of metadata entries
 */
psMetadata* psFitsReadHeaderSet(
    psMetadata* out,                         ///< output metadata or NULL if new psMetadata is to be created.
    const psFits* fits                       ///< the psFits object
);

/** Writes the values of the metadata to the current HDU header.
 *  Doesn't check if the header has to be created.
 *
 * @return bool         if TRUE, the write was successful, otherwise FALSE.
 */
bool psFitsWriteHeader(
    psFits* fits,                       ///< the psFits object
    const psMetadata* output            ///< the psMetadata data in which to write
);

/** Writes a "blank" --- a header only, with no image or table.
 *
 *  @return bool        if TRUE, the write was successful, otherwise FALSE.
 */
bool psFitsWriteBlank(
    psFits* fits,                       ///< the psFits object
    const psMetadata* output,           ///< the psMetadata data in which to write
    const char *extname
);

/** psFitsHeaderValidate validates the supplied header so that it is in
 *  compliance to the FITS standard for header keyword names and types.
 *
 *  @return bool        TRUE if the resulting header conforms to the FITS
 *                      standard, otherwise FALSE
 */
bool psFitsHeaderValidate(psMetadata *header);

/// @}
#endif // #ifndef PS_FITS_H
