| 1 | /* | 
|---|
| 2 | --- SOPHYA software - FitsIOServer module --- | 
|---|
| 3 | Guy Le Meur 08/2000    R. Ansari , 2006 | 
|---|
| 4 | (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA | 
|---|
| 5 | */ | 
|---|
| 6 | #ifndef FITSLOCALMAP_SEEN | 
|---|
| 7 | #define FITSLOCALMAP_SEEN | 
|---|
| 8 |  | 
|---|
| 9 |  | 
|---|
| 10 | #include "pexceptions.h" | 
|---|
| 11 | #include "localmap.h" | 
|---|
| 12 | #include "fitsfile.h" | 
|---|
| 13 |  | 
|---|
| 14 | namespace SOPHYA { | 
|---|
| 15 |  | 
|---|
| 16 |  | 
|---|
| 17 | ///////////////////////////////////////////////////////////////////////// | 
|---|
| 18 | // Classe pour la gestion de persistance sur fichiers fits | 
|---|
| 19 | ///////////////////////////////////////////////////////////////////////// | 
|---|
| 20 |  | 
|---|
| 21 |  | 
|---|
| 22 |  | 
|---|
| 23 | template <class T> | 
|---|
| 24 | class FITS_LocalMap : public FitsIOHandler { | 
|---|
| 25 |  | 
|---|
| 26 | public : | 
|---|
| 27 | FITS_LocalMap(); | 
|---|
| 28 | FITS_LocalMap(char inputfile[],int hdunum=0); | 
|---|
| 29 | FITS_LocalMap(const LocalMap<T> & obj); | 
|---|
| 30 | FITS_LocalMap(LocalMap<T> *obj); | 
|---|
| 31 | virtual ~FITS_LocalMap(); | 
|---|
| 32 | virtual AnyDataObj* DataObj(); | 
|---|
| 33 | virtual   void      SetDataObj(AnyDataObj & o); | 
|---|
| 34 | inline operator LocalMap<T>() { return(*dobj_); } | 
|---|
| 35 |  | 
|---|
| 36 | virtual int         CheckHandling(AnyDataObj & o) ; | 
|---|
| 37 | virtual int         CheckReadability(FitsInOutFile& is); | 
|---|
| 38 | virtual FitsHandlerInterface* Clone(); | 
|---|
| 39 |  | 
|---|
| 40 | protected : | 
|---|
| 41 |  | 
|---|
| 42 | void ReadFromFits(FitsInFile& is); | 
|---|
| 43 | void WriteToFits(FitsOutFile& os) ; | 
|---|
| 44 |  | 
|---|
| 45 | LocalMap<T> * dobj_; | 
|---|
| 46 | bool ownobj_; | 
|---|
| 47 | }; | 
|---|
| 48 | ////////////////////////////////////////////////////////////////// | 
|---|
| 49 |  | 
|---|
| 50 | template <class T> | 
|---|
| 51 | inline FitsInOutFile& operator << (FitsInOutFile& fios, LocalMap<T> & lm) | 
|---|
| 52 | { FITS_LocalMap<T> fih(&lm); fih.Write(fios); return (fios); } | 
|---|
| 53 |  | 
|---|
| 54 | template <class T> | 
|---|
| 55 | inline FitsInOutFile& operator >> (FitsInOutFile& fiis, LocalMap<T> & lm) | 
|---|
| 56 | { FITS_LocalMap<T> fih(&lm); fih.Read(fiis); | 
|---|
| 57 | fiis.MoveToNextHDU(); return (fiis); } | 
|---|
| 58 |  | 
|---|
| 59 | } // Fin du namespace | 
|---|
| 60 |  | 
|---|
| 61 | #endif | 
|---|