PHDU.h

00001 //   Read the documentation to learn more about C++ code generator
00002 //   versioning.
00003 //      This is version 2.1 release dated Nov 2008
00004 //      Astrophysics Science Division,
00005 //      NASA/ Goddard Space Flight Center
00006 //      HEASARC
00007 //      http://heasarc.gsfc.nasa.gov
00008 //      e-mail: ccfits@legacy.gsfc.nasa.gov
00009 //
00010 //      Original author: Ben Dorman
00011 
00012 #ifndef PHDU_H
00013 #define PHDU_H 1
00014 
00015 // valarray
00016 #include <valarray>
00017 // HDU
00018 #include "HDU.h"
00019 // FITS
00020 #include "FITS.h"
00021 // FITSUtil
00022 #include "FITSUtil.h"
00023 
00024 namespace CCfits {
00025   class FITSBase;
00026 
00027 } // namespace CCfits
00028 // for CLONE_DEFECT
00029 #ifdef _MSC_VER
00030 #include "MSconfig.h"
00031 #endif
00032 
00033 
00034 namespace CCfits {
00035 
00070 /* !\fn  PHDU::PHDU (FITSBase* p)
00071 
00072     \brief Reading Primary HDU constructor.
00073    Constructor used  when reading the primary HDU from an existing file.
00074     Does nothing except initialize, with the real work done by the subclass
00075     PrimaryHDU<T>.
00076 
00077 */
00078 
00259   class PHDU : public HDU  //## Inherits: <unnamed>%394E6F9800C3
00260   {
00261 
00262     public:
00263         virtual ~PHDU();
00264 
00265         //      Read data reads the image if readFlag is true and
00266         //      optional keywords if supplied. Thus, with no arguments,
00267         //      readData() does nothing.
00268         virtual void readData (bool readFlag = false, const std::vector<String>& keys = std::vector<String>()) = 0;
00269         virtual PHDU * clone (FITSBase* p) const = 0;
00270         virtual void zero (double value);
00271         virtual void scale (double value);
00272         virtual double zero () const;
00273         virtual double scale () const;
00274 
00275     public:
00276       // Additional Public Declarations
00277       // image reading/writing interface. 
00278 
00279       // The S template parameter, like for Column, denotes the fact that
00280       // the type of the input array and the object to be read may not match.
00281 
00282 
00283       // the rw interface for images consists of equivalents for fits_read_img,
00284       // fits_read_pix, and fits_read_subset.
00285 
00286       // the paradigm for reading is that the image object (a valarray<T> type)
00287       // is the size of the data already read.
00288 
00289       // write_subset has no null value aware analogue.
00290         template <typename S>
00291         void write(const std::vector<long>& first,
00292                         long nElements,
00293                         const std::valarray<S>& data,
00294                         S* nullValue);
00295 
00296 
00297         template <typename S>
00298         void write(long first,
00299                         long nElements,
00300                         const std::valarray<S>& data,
00301                         S* nullValue);
00302 
00303 
00304         template <typename S>
00305         void write(const std::vector<long>& first,
00306                         long nElements,
00307                         const std::valarray<S>& data);
00308 
00309 
00310         template <typename S>
00311         void write(long first,
00312                         long nElements,
00313                         const std::valarray<S>& data);
00314 
00315         template <typename S>
00316         void write(const std::vector<long>& firstVertex,
00317                         const std::vector<long>& lastVertex,
00318                         const std::vector<long>& stride, 
00319                         const std::valarray<S>& data); 
00320 
00321         // read image data and return an array. Can't return a reference
00322         // because the type conversion needs to allocate a new object in general.
00323 
00324         template<typename S>
00325         void read(std::valarray<S>& image) ; 
00326 
00327         template<typename S>
00328         void  read (std::valarray<S>& image, long first,long nElements); 
00329 
00330         template<typename S>
00331         void read (std::valarray<S>& image, long first,long nElements, S* nullValue) ; 
00332 
00333         template<typename S>
00334         void read (std::valarray<S>& image, const std::vector<long>& first,long nElements)  ; 
00335 
00336         template<typename S>
00337         void read (std::valarray<S>& image, const std::vector<long>& first, long nElements, 
00338                                         S* nullValue); 
00339 
00340         template<typename S>
00341         void read (std::valarray<S>& image, const std::vector<long>& firstVertex, 
00342                                 const std::vector<long>& lastVertex, 
00343                                 const std::vector<long>& stride)  ;      
00344 
00345         template<typename S>
00346         void read (std::valarray<S>& image, const std::vector<long>& firstVertex, 
00347                                 const std::vector<long>& lastVertex, 
00348                                 const std::vector<long>& stride, 
00349                                 S* nullValue) ; 
00350 
00351 
00352     protected:
00353         PHDU(const PHDU &right);
00354         //      Constructor for new FITS objects, takes as arguments
00355         //      the required keywords for a primary HDU.
00356         PHDU (FITSBase* p, int bpix, int naxis, const std::vector<long>& axes);
00357         //      Custom constructor. Allows specification of data to be read and whether to read data at
00358         //      construction or wait until the image data are requested. The default is 'lazy initialization:'
00359         //      wait until asked.
00360         PHDU (FITSBase* p = 0);
00361 
00362         virtual void initRead ();
00363         bool simple () const;
00364         void simple (bool value);
00365         bool extend () const;
00366         void extend (bool value);
00367 
00368       // Additional Protected Declarations
00369 
00370     private:
00371       // Additional Private Declarations
00372 
00373     private: //## implementation
00374       // Data Members for Class Attributes
00375         bool m_simple;
00376         bool m_extend;
00377 
00378       // Additional Implementation Declarations
00379 
00380   };
00381 
00382   // Class CCfits::PHDU 
00383 
00384   inline bool PHDU::simple () const
00385   {
00386     return m_simple;
00387   }
00388 
00389   inline void PHDU::simple (bool value)
00390   {
00391     m_simple = value;
00392   }
00393 
00394   inline bool PHDU::extend () const
00395   {
00396     return m_extend;
00397   }
00398 
00399   inline void PHDU::extend (bool value)
00400   {
00401     m_extend = value;
00402   }
00403 
00404 } // namespace CCfits
00405 
00406 
00407 #endif

Generated on Thu Nov 6 10:44:39 2008 for CCfits by  doxygen 1.5.4