PHDU.h
// Astrophysics Science Division,
// NASA/ Goddard Space Flight Center
// HEASARC
// http://heasarc.gsfc.nasa.gov
// e-mail: ccfits@legacy.gsfc.nasa.gov
//
// Original author: Ben Dorman
#ifndef PHDU_H
#define PHDU_H 1
// valarray
#include <valarray>
// HDU
#include "HDU.h"
// FITS
#include "FITS.h"
// FITSUtil
#include "FITSUtil.h"
namespace CCfits {
class FITS;
} // namespace CCfits
// for CLONE_DEFECT
#ifdef _MSC_VER
#include "MSconfig.h"
#endif
namespace CCfits {
/* !\fn PHDU::PHDU (FITS* p)
\brief Reading Primary HDU constructor.
Constructor used when reading the primary HDU from an existing file.
Does nothing except initialize, with the real work done by the subclass
PrimaryHDU<T>.
*/
class PHDU : public HDU //## Inherits: <unnamed>%394E6F9800C3
{
public:
virtual ~PHDU();
// Read data reads the image if readFlag is true and
// optional keywords if supplied. Thus, with no arguments,
// readData() does nothing.
virtual void readData (bool readFlag = false, const std::vector<String>& keys = std::vector<String>()) = 0;
virtual PHDU * clone (FITS* p) const = 0;
virtual void zero (double value);
virtual void scale (double value);
virtual double zero () const;
virtual double scale () const;
bool simple () const;
bool extend () const;
public:
// Additional Public Declarations
// image reading/writing interface.
// The S template parameter, like for Column, denotes the fact that
// the type of the input array and the object to be read may not match.
// the rw interface for images consists of equivalents for fits_read_img,
// fits_read_pix, and fits_read_subset.
// the paradigm for reading is that the image object (a valarray<T> type)
// is the size of the data already read.
// write_subset has no null value aware analogue.
template <typename S>
void write(const std::vector<long>& first,
long nElements,
const std::valarray<S>& data,
S* nullValue);
template <typename S>
void write(long first,
long nElements,
const std::valarray<S>& data,
S* nullValue);
template <typename S>
void write(const std::vector<long>& first,
long nElements,
const std::valarray<S>& data);
template <typename S>
void write(long first,
long nElements,
const std::valarray<S>& data);
template <typename S>
void write(const std::vector<long>& firstVertex,
const std::vector<long>& lastVertex,
const std::vector<long>& stride,
const std::valarray<S>& data);
// read image data and return an array. Can't return a reference
// because the type conversion needs to allocate a new object in general.
template<typename S>
void read(std::valarray<S>& image) ;
template<typename S>
void read (std::valarray<S>& image, long first,long nElements);
template<typename S>
void read (std::valarray<S>& image, long first,long nElements, S* nullValue) ;
template<typename S>
void read (std::valarray<S>& image, const std::vector<long>& first,long nElements) ;
template<typename S>
void read (std::valarray<S>& image, const std::vector<long>& first, long nElements,
S* nullValue);
template<typename S>
void read (std::valarray<S>& image, const std::vector<long>& firstVertex,
const std::vector<long>& lastVertex,
const std::vector<long>& stride) ;
template<typename S>
void read (std::valarray<S>& image, const std::vector<long>& firstVertex,
const std::vector<long>& lastVertex,
const std::vector<long>& stride,
S* nullValue) ;
protected:
PHDU(const PHDU &right);
// Constructor for new FITS objects, takes as arguments
// the required keywords for a primary HDU.
PHDU (FITS* p, int bpix, int naxis, const std::vector<long>& axes);
// Custom constructor. Allows specification of data to be read and whether to read data at
// construction or wait until the image data are requested. The default is 'lazy initialization:'
// wait until asked.
PHDU (FITS* p = 0);
virtual void initRead ();
void simple (bool value);
void extend (bool value);
// Additional Protected Declarations
private:
// Additional Private Declarations
private: //## implementation
// Data Members for Class Attributes
bool m_simple;
bool m_extend;
// Additional Implementation Declarations
};
// Class CCfits::PHDU
inline bool PHDU::simple () const
{
return m_simple;
}
inline void PHDU::simple (bool value)
{
m_simple = value;
}
inline bool PHDU::extend () const
{
return m_extend;
}
inline void PHDU::extend (bool value)
{
m_extend = value;
}
} // namespace CCfits
#endif
CCfits::PHDU::~PHDU
virtual ~PHDU()
destructor
Definition: PHDU.cxx:69
CCfits::PHDU::initRead
virtual void initRead()
Definition: PHDU.cxx:75
CCfits::PHDU::simple
bool simple() const
Returns the value of the Primary&#39;s SIMPLE keyword.
Definition: PHDU.h:393
CCfits::PHDU::extend
bool extend() const
Returns the value of the Primary&#39;s EXTEND keyword.
Definition: PHDU.h:403
CCfits::HDU
Base class for all HDU [Header-Data Unit] objects.
Definition: HDU.h:673
CCfits::FITS
Memory object representation of a disk FITS file.
Definition: FITS.h:628
CCfits::PHDU::scale
virtual double scale() const
return the BSCALE keyword value
Definition: PHDU.cxx:166
CCfits::PHDU::write
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: PHDUT.h:430
CCfits::PHDU::PHDU
PHDU(const PHDU &right)
copy constructor
Definition: PHDU.cxx:20
CCfits::PHDU::clone
virtual PHDU * clone(FITS *p) const =0
virtual copy constructor for Primary HDUs.
CCfits::HDU::axes
long axes() const
return the number of axes in the HDU data section (always 2 for tables).
Definition: HDU.h:978
CCfits::PHDU::zero
virtual double zero() const
return the BZERO keyword value
Definition: PHDU.cxx:160
CCfits::PHDU
class representing the primary HDU for a FITS file.
Definition: PHDU.h:267
CCfits::PHDU::readData
virtual void readData(bool readFlag=false, const std::vector< String > &keys=std::vector< String >())=0
read primary HDU data