21 #include "HDUCreator.h"
23 #include "FitsError.h"
34 # include <sys/stat.h>
637 NoSuchHDU (
const String& diag,
bool silent =
true);
659 CantOpen (
const String& diag,
bool silent =
true);
669 CantCreate (
const String& diag,
bool silent =
false);
677 FITS (
const String &
name, RWmode rwmode = Read,
bool readDataFlag =
false,
const std::vector<String>& primaryKeys = std::vector<String>());
681 FITS (
const String &name, RWmode rwmode,
const string &hduName,
bool readDataFlag =
false,
const std::vector<String>& hduKeys = std::vector<String>(),
const std::vector<String>& primaryKey = std::vector<String>(),
int version = 1);
685 FITS (
const String &name, RWmode rwmode,
const std::vector<String>& hduNames,
bool readDataFlag =
false,
const std::vector<String>& primaryKey = std::vector<String>());
688 FITS (
const String& fileName,
const FITS& source);
692 FITS (
const String &name, RWmode rwmode,
const std::vector<String>& hduNames,
const std::vector<std::vector<String> >& hduKeys,
bool readDataFlag =
false,
const std::vector<String>& primaryKeys = std::vector<String>(),
const std::vector<int>& hduVersions = std::vector<int>());
695 FITS (
const String& name,
int bitpix,
int naxis,
long *naxes);
699 FITS (
const string &name, RWmode rwmode,
int hduIndex,
bool readDataFlag =
false,
const std::vector<String>& hduKeys = std::vector<String>(),
const std::vector<String>& primaryKey = std::vector<String>());
706 FITS (
const String &name, RWmode rwmode,
const std::vector<String>& searchKeys,
const std::vector<String> &searchValues,
bool readDataFlag =
false,
const std::vector<String>& hduKeys = std::vector<String>(),
const std::vector<String>& primaryKey = std::vector<string>(),
int version = 1);
713 void read (
const String &hduName,
bool readDataFlag =
false,
const std::vector<String> &keys = std::vector<String>(),
int version = 1);
716 void read (
const std::vector<String> &hduNames,
bool readDataFlag =
false);
718 void read (
const std::vector<String> &hduNames,
const std::vector<std::vector<String> > &keys,
bool readDataFlag =
false,
const std::vector<int>& hduVersions = std::vector<int>());
721 void read (
int hduIndex,
bool readDataFlag =
false,
const std::vector<String> &keys = std::vector<String>());
728 void read (
const std::vector<String>& searchKeys,
const std::vector<String> &searchValues,
bool readDataFlag =
false,
const std::vector<String>& hduKeys = std::vector<String>(),
int version = 1);
733 const ExtHDU&
extension (
const String& hduName,
int version = 1)
const;
737 friend std::ostream& operator << (std::ostream& s,
const FITS& right);
740 const std::vector<String>& columnName = std::vector<String>(),
741 const std::vector<String>& columnFmt = std::vector<String>(),
742 const std::vector<String>& columnUnit = std::vector<String>(),
743 HduType type = BinaryTbl,
int version = 1);
745 Table * addGroupTable(
const String & groupName,
int groupID);
748 ExtHDU*
addImage (
const String& hduName,
int bpix, std::vector<long>& naxes,
int version = 1);
758 const String& name () const;
760 Table&
filter (const String& expression,
ExtHDU& inputTable,
bool overwrite = true,
bool readData = false);
778 FITS & operator=(const
FITS &right);
780 void unmapExtension (
ExtHDU& doomed);
781 int nextVersionNumber (const String& inputName) const;
784 void read (
bool readDataFlag = false, const std::vector<String>& keys = std::vector<String>());
787 int open (RWmode rwmode = Read);
796 int close () throw ();
797 std::ostream & put (std::ostream &s) const;
798 ExtHDU& extbyVersion (const String& hduName,
int version) const;
800 void readExtensions (
bool readDataFlag = false);
802 String nameOfUnmapped (
int hduNum) const;
803 void cloneHeader (const
ExtHDU& source);
810 ExtHDU* checkAlreadyRead(const
int hduIdx,
811 const String& hduName =
string(""), const
int version=1) const throw();
815 void destroyPrimary ();
816 void destroyExtensions ();
817 int currentCompressionTileDim () const;
818 void currentCompressionTileDim (
int value);
823 static
bool s_verboseMode;
824 int m_currentCompressionTileDim;
828 std::
string m_currentExtensionName;
829 std::
string m_filename;
836 friend
void HDU::makeThisCurrent() const;
838 friend
PHDU * HDUCreator::MakeImage (
int bpix,
int naxis, const std::vector<
long>& naxes);
854 return extbyVersion(hduName,version);
857 inline std::ostream& operator << (std::ostream& s,
const FITS& right)
864 return s_verboseMode;
869 s_verboseMode = value;
872 inline int FITS::currentCompressionTileDim ()
const
874 return m_currentCompressionTileDim;
877 inline void FITS::currentCompressionTileDim (
int value)
879 m_currentCompressionTileDim = value;
884 return m_currentExtensionName;
889 m_currentExtensionName = extName;
fitsfile * fitsPointer() const
return the CFITSIO fitsfile pointer for this FITS object
Definition: FITS.h:917
CantOpen(const String &diag, bool silent=true)
Exception ctor prefixes the string: "FITS Error: Cannot create file " before specific message...
Definition: FITS.cxx:70
int getCompressionType() const
Get the int specifying the compression algorithm to be used when adding an image extension.
Definition: FITS.cxx:1439
void setCompressionType(int compType)
set the compression algorithm to be used when adding image extensions to the FITS object...
Definition: FITS.cxx:1408
const ExtMap & extension() const
return const reference to the extension container
Definition: FITS.h:912
thrown on failure to open existing file
Definition: FITS.h:656
Table * addTable(const String &hduName, int rows, const std::vector< String > &columnName=std::vector< String >(), const std::vector< String > &columnFmt=std::vector< String >(), const std::vector< String > &columnUnit=std::vector< String >(), HduType type=BinaryTbl, int version=1)
Add a table extension to an existing FITS object. Add extension to FITS object for file with w or rw ...
Definition: FITS.cxx:870
void getTileDimensions(std::vector< long > &tileSizes) const
Get the current settings of dimension sizes for tiles used in image compression.
Definition: FITS.cxx:1450
void resetPosition()
explicit call to set the fits file pointer to the primary.
Definition: FITS.cxx:1072
void setNoiseBits(int noiseBits)
Set the cfitsio noisebits parameter used when compressing floating-point images.
Definition: FITS.cxx:1430
OperationNotSupported(const String &msg, bool silent=true)
Exception ctor, prefixes the string "FITS Error: Operation not supported:" before the specific messag...
Definition: FITS.cxx:60
const String & name() const
return filename of file corresponding to FITS object
Definition: FITS.h:892
PHDU & pHDU()
return a reference to the primary HDU.
Definition: FITS.h:907
ExtHDU & currentExtension()
return a non-const reference to whichever is the current extension.
Definition: FITS.cxx:1269
ExtHDU * addImage(const String &hduName, int bpix, std::vector< long > &naxes, int version=1)
Add an image extension to an existing FITS object. (File with w or rw access).
Definition: FITS.cxx:979
void destroy()
Erase FITS object and close corresponding file.
Definition: FITS.cxx:1016
static bool verboseMode()
return verbose setting for library
Definition: FITS.h:862
Base class for all HDU [Header-Data Unit] objects.
Definition: HDU.h:673
thrown for unsupported operations, such as attempted to select rows from an image extension...
Definition: FITS.h:645
CantCreate(const String &diag, bool silent=false)
Exception ctor prefixes the string: "FITS Error: Cannot create file " before specific message...
Definition: FITS.cxx:80
static void clearErrors()
clear the error stack and set status to zero.
Definition: FITS.cxx:366
FITS(const String &name, RWmode rwmode=Read, bool readDataFlag=false, const std::vector< String > &primaryKeys=std::vector< String >())
basic constructor
Definition: FITS.cxx:91
Memory object representation of a disk FITS file.
Definition: FITS.h:628
FitsException is the base class for all exceptions thrown by this library.
Definition: FitsError.h:93
Table & filter(const String &expression, ExtHDU &inputTable, bool overwrite=true, bool readData=false)
Filter the rows of the inputTable with the condition expression, and return a reference to the result...
Definition: FITS.cxx:1143
base class for all FITS extension HDUs, i.e. Image Extensions and Tables.
Definition: ExtHDU.h:438
static void setVerboseMode(bool value)
set verbose setting for library
Definition: FITS.h:867
void read(const String &hduName, bool readDataFlag=false, const std::vector< String > &keys=std::vector< String >(), int version=1)
get data from single HDU from disk file.
Definition: FITS.cxx:421
thrown on failure to create new file
Definition: FITS.h:667
NoSuchHDU(const String &diag, bool silent=true)
Exception ctor, prefixes the string "FITS Error: Cannot read HDU in FITS file:" before the specific m...
Definition: FITS.cxx:49
void setTileDimensions(const std::vector< long > &tileSizes)
Set the dimensions of the tiles into which the image is divided during compression.
Definition: FITS.cxx:1417
void flush()
flush buffer contents to disk
Definition: FITS.cxx:1054
class representing the primary HDU for a FITS file.
Definition: PHDU.h:267
void deleteExtension(const String &doomed, int version=1)
Delete extension specified by name and version number.
Definition: FITS.cxx:371
~FITS()
destructor
Definition: FITS.cxx:332
const String & currentExtensionName() const
return the name of the extension that the fitsfile is currently addressing.
Definition: FITS.h:882
exception thrown by HDU retrieval methods.
Definition: FITS.h:634
void copy(const HDU &source)
copy the HDU source into the FITS object.
Definition: FITS.cxx:1079
int getNoiseBits() const
Get the cfitsio noisebits parameter used when compressing floating-point images.
Definition: FITS.cxx:1468