17 #include "FitsError.h"
439 friend bool operator<(
const ExtHDU &left,
const ExtHDU &right);
441 friend bool operator>(
const ExtHDU &left,
const ExtHDU &right);
443 friend bool operator<=(
const ExtHDU &left,
const ExtHDU &right);
445 friend bool operator>=(
const ExtHDU &left,
const ExtHDU &right);
447 static void readHduName (
const fitsfile* fptr,
int hduIndex, String& hduName,
int& hduVersion);
448 virtual void readData (
bool readFlag =
false,
const std::vector<String>& keys = std::vector<String>()) = 0;
449 const String&
name ()
const;
450 virtual HDU *
clone (FITSBase* p)
const = 0;
457 virtual Column&
column (
const String& colName,
bool caseSensitive =
true)
const;
459 virtual long rows ()
const;
460 virtual void addColumn (
ValueType type,
const String& columnName,
long repeatWidth,
const String& colUnit = String(
""),
long decimals = -1,
size_t columnNumber = 0);
464 virtual const std::map<string, Column*>&
column ()
const;
469 static const String& missHDU ();
470 static void setMissHDU (
const String& value);
481 template <
typename S>
482 void write(
const std::vector<long>& first,
484 const std::valarray<S>& data,
488 template <
typename S>
489 void write(
long first,
491 const std::valarray<S>& data,
494 template <
typename S>
495 void write(
const std::vector<long>& first,
497 const std::valarray<S>& data);
500 template <
typename S>
501 void write(
long first,
503 const std::valarray<S>& data);
505 template <
typename S>
506 void write(
const std::vector<long>& firstVertex,
507 const std::vector<long>& lastVertex,
508 const std::valarray<S>& data);
515 template <
typename S>
516 void read (std::valarray<S>& image) ;
519 void read (std::valarray<S>& image,
525 void read (std::valarray<S>& image,
526 const std::vector<long>& first,
531 void read (std::valarray<S>& image,
532 const std::vector<long>& firstVertex,
533 const std::vector<long>& lastVertex,
534 const std::vector<long>& stride) ;
537 void read (std::valarray<S>& image,
542 void read (std::valarray<S>& image,
543 const std::vector<long>& first,
547 void read (std::valarray<S>& image,
548 const std::vector<long>& firstVertex,
549 const std::vector<long>& lastVertex,
550 const std::vector<long>& stride,
555 ExtHDU (FITSBase* p, HduType xtype,
const String &hduName,
int version);
558 ExtHDU (FITSBase* p, HduType xtype,
const String &hduName,
int bitpix,
int naxis,
const std::vector<long>&
axes,
int version);
562 ExtHDU (FITSBase* p, HduType xtype,
int number);
564 virtual std::ostream & put (std::ostream &s)
const = 0;
565 virtual void setColumn (
const String& colname,
Column* value);
566 virtual void checkExtensionType ()
const;
578 virtual void initRead () = 0;
579 void checkXtension ();
589 static String s_missHDU;
602 inline bool operator<(
const ExtHDU &left,
const ExtHDU &right)
604 if (left.m_name < right.m_name)
return true;
605 if (left.m_name > right.m_name)
return false;
606 if (left.m_name == right.m_name)
608 if (left.m_version < right.m_version)
return true;
613 inline bool operator>(
const ExtHDU &left,
const ExtHDU &right)
615 return !operator<=(left,right);
618 inline bool operator<=(
const ExtHDU &left,
const ExtHDU &right)
620 if (left.m_name <= right.m_name)
622 if (left.m_version <= right.m_version)
return true;
627 inline bool operator>=(
const ExtHDU &left,
const ExtHDU &right)
629 return !operator<(left,right);
679 inline const String& ExtHDU::missHDU ()
684 inline void ExtHDU::setMissHDU (
const String& value)
void write(const std::vector< long > &first, long nElements, const std::valarray< S > &data, S *nullValue)
Write a set of pixels to an image extension with the first pixel specified by an n-tuple, processing undefined data.
Definition: ExtHDUT.h:408
virtual ~ExtHDU()
destructor
Definition: ExtHDU.cxx:135
virtual const std::map< string, Column * > & column() const
return a reference to the array containing the columns.
Definition: ExtHDU.cxx:305
void read(std::valarray< S > &image)
Read image data into container.
Definition: ExtHDUT.h:18
virtual void readData(bool readFlag=false, const std::vector< String > &keys=std::vector< String >())=0
read data from HDU depending on readFlag and keys.
HduType xtension() const
return the extension type
Definition: ExtHDU.h:669
virtual long getRowsize() const
return the optimal number of rows to read or write at a time
Definition: ExtHDU.cxx:289
Exception to be thrown on unmatched extension types.
Definition: ExtHDU.h:428
int version() const
return the extension version number.
Definition: ExtHDU.h:659
WrongExtensionType(const String &msg, bool silent=true)
Exception ctor, prefixes the string "Fits Error: wrong extension type" before the specific message...
Definition: ExtHDU.cxx:44
virtual long rows() const
return the number of rows in the extension.
Definition: ExtHDU.cxx:239
long bitpix() const
return the data type keyword.
Definition: HDU.h:858
virtual void addColumn(ValueType type, const String &columnName, long repeatWidth, const String &colUnit=String(""), long decimals=-1, size_t columnNumber=0)
add a new column to an existing table HDU.
Definition: ExtHDU.cxx:252
virtual HDU * clone(FITSBase *p) const =0
virtual copy constructor
virtual void makeThisCurrent() const
move the fitsfile pointer to this current HDU.
Definition: ExtHDU.cxx:212
Base class for all HDU [Header-Data Unit] objects.
Definition: HDU.h:543
long pcount() const
return required pcount keyword value
Definition: ExtHDU.h:639
FitsException is the base class for all exceptions thrown by this library.
Definition: FitsError.h:93
base class for all FITS extension HDUs, i.e. Image Extensions and Tables.
Definition: ExtHDU.h:421
ValueType
CCfits value types and their CFITSIO equivalents (in caps)
Definition: CCfits.h:79
const String & name() const
return the name of the extension.
Definition: ExtHDU.h:633
bool isCompressed() const
return true if image is stored using compression.
Definition: ExtHDU.cxx:311
long gcount() const
return required gcount keyword value
Definition: ExtHDU.h:649
ExtHDU(const ExtHDU &right)
copy constructor
Definition: ExtHDU.cxx:55
long axes() const
return the number of axes in the HDU data section (always 2 for tables).
Definition: HDU.h:835
static void readHduName(const fitsfile *fptr, int hduIndex, String &hduName, int &hduVersion)
read extension name.
Definition: ExtHDU.cxx:152
Abstract base class for Column objects.
Definition: Column.h:827
virtual int numCols() const
return the number of Columns in the Table (the TFIELDS keyword).
Definition: ExtHDU.cxx:297
virtual void deleteColumn(const String &columnName)
delete a column in a Table extension by name.
Definition: ExtHDU.cxx:259