#ifndef PM_FPA_READ_H
#define PM_FPA_READ_H

#include "pslib.h"
#include "pmFPA.h"

bool pmReadoutReadNext(pmReadout *readout, // Readout into which to read
                       psFits *fits,    // FITS file from which to read
                       int z,           // Readout number/plane; zero-offset indexing
                       int numRows      // The number of rows to read
                      );

bool pmCellRead(pmCell *cell,           // Cell to read into
                psFits *fits,           // FITS file from which to read
                psDB *db                // Database handle, for "concepts" ingest
               );

bool pmChipRead(pmChip *chip,           // Chip to read into
                psFits *fits,           // FITS file from which to read
                psDB *db                // Database handle, for "concepts" ingest
               );

bool pmFPARead(pmFPA *fpa,              // FPA to read into
               psFits *fits,            // FITS file from which to read
               psDB *db                 // Database handle, for "concepts" ingest
              );

bool pmCellReadMask(pmCell *cell,           // Cell to read into
                    psFits *fits,           // FITS file from which to read
                    psDB *db                // Database handle, for "concepts" ingest
                   );

bool pmChipReadMask(pmChip *chip,           // Chip to read into
                    psFits *fits,           // FITS file from which to read
                    psDB *db                // Database handle, for "concepts" ingest
                   );

bool pmFPAReadMask(pmFPA *fpa,              // FPA to read into
                   psFits *fits,            // FITS file from which to read
                   psDB *db                 // Database handle, for "concepts" ingest
                  );

bool pmCellReadWeight(pmCell *cell,           // Cell to read into
                      psFits *fits,           // FITS file from which to read
                      psDB *db                // Database handle, for "concepts" ingest
                     );

bool pmChipReadWeight(pmChip *chip,           // Chip to read into
                      psFits *fits,           // FITS file from which to read
                      psDB *db                // Database handle, for "concepts" ingest
                     );

bool pmFPAReadWeight(pmFPA *fpa,              // FPA to read into
                     psFits *fits,            // FITS file from which to read
                     psDB *db                 // Database handle, for "concepts" ingest
                    );

bool pmCellReadPHU(pmCell *cell,        // Cell to read into
                   psFits *fits         // FITS file from which to read
                  );

bool pmChipReadPHU(pmChip *chip,        // Chip to read into
                   psFits *fits         // FITS file from which to read
                  );

bool pmFPAReadPHU(pmFPA *fpa,           // FPA to read into
                  psFits *fits          // FITS file from which to read
                 );


#if 0
bool pmFPARead(pmFPA *fpa,              // FPA to read into
               psFits *fits,            // FITS file from which to read
               psMetadata *phu,         // Primary header
               psDB *db                 // Database handle, for concept ingest
              );

psString p_pmFPATranslateName(const psString name, // The name to translate
                              const pmCell *cell // The cell for which to translate
                             );

psString p_pmFPATranslateFileExt(psString *extName, // Extension name, to be returned
                                 const psString filenameExt, // The string to parse into filename and ext
                                 const pmCell *cell // The cell
                                );

bool pmFPAReadMask(pmFPA *fpa,          // FPA to read into
                   psFits *source       // Source FITS file (for the original data)
                  );

bool pmFPAReadWeight(pmFPA *fpa,        // FPA to read into
                     psFits *source     // Source FITS file (for the original data)
                    );
#endif

#endif
