Changeset 2897 in Sophya
- Timestamp:
- Jan 13, 2006, 11:05:52 AM (20 years ago)
- Location:
- trunk/SophyaExt/FitsIOServer
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/FitsIOServer/fiosinit.cc
r2895 r2897 7 7 #include "fitshdtable.h" 8 8 #include "fitsarrhand.h" 9 10 #include "fitsntuple.h" 11 #include "fitsspherehealpix.h" 12 #include "fitsspherethetaphi.h" 13 #include "fitslocalmap.h" 14 9 15 10 16 #include <iostream> … … 33 39 FitsManager::RegisterHandler(new FitsHandler<BaseDataTable>, 1, "DataTable"); 34 40 41 // Enregistrement des classes heritant de FitsIOHandler 42 FitsManager::RegisterHandler(new FITS_NTuple, 0, "NTuple"); 43 44 FitsManager::RegisterHandler(new FITS_SphereHEALPix<r_4> , 0, "SphereHEALPix<r_4>"); 45 FitsManager::RegisterHandler(new FITS_SphereHEALPix<r_8> , 0, "SphereHEALPix<r_8>"); 46 FitsManager::RegisterHandler(new FITS_SphereHEALPix<int_4> , 0, "SphereHEALPix<int_4>"); 47 48 FitsManager::RegisterHandler(new FITS_SphereThetaPhi<r_4> , 0, "SphereThetaPhi<r_4>"); 49 FitsManager::RegisterHandler(new FITS_SphereThetaPhi<r_8> , 0, "SphereThetaPhi<r_8>"); 50 FitsManager::RegisterHandler(new FITS_SphereThetaPhi<int_4> , 0, "SphereThetaPhi<int_4>"); 51 52 FitsManager::RegisterHandler(new FITS_LocalMap<r_4> , 0, "LocalMap<r_4>"); 53 FitsManager::RegisterHandler(new FITS_LocalMap<r_8> , 0, "LocalMap<r_8>"); 54 FitsManager::RegisterHandler(new FITS_LocalMap<int_4> , 0, "LocalMap<int_4>"); 55 35 56 cout << " ---- FitsIOServerInitiator / DEBUG ---- ListHandlers() : " << endl; 36 57 FitsManager::ListHandlers(); -
trunk/SophyaExt/FitsIOServer/fitsfile.cc
r2860 r2897 244 244 } 245 245 246 void FitsIOHandler::Read(FitsInOutFile& is) 247 { 248 FitsInFile fis(is); 249 fis.ReadHeader(0); 250 ReadFromFits(fis); 251 } 252 246 253 /*! \fn void SOPHYA::FitsIOHandler::Read(FitsInFile& is, int hdunum) 247 254 Read the data on extension hdunum (or primary header, if hdunum=1) from FitsInFIle. If hdunum is not addressed, , one reads the next extension, with respect to the current position. … … 271 278 { 272 279 FitsOutFile of(flnm, FitsFile::unknown); 273 Write(of); 274 } 275 276 void FitsIOHandler::Write(FitsOutFile& os) 277 { 278 WriteToFits(os); 280 WriteToFits(of); 281 } 282 283 void FitsIOHandler::Write(FitsInOutFile& os) 284 { 285 FitsOutFile fos(os); 286 WriteToFits(fos); 279 287 } 280 288 -
trunk/SophyaExt/FitsIOServer/fitsfile.h
r2860 r2897 5 5 #include "dvlist.h" 6 6 #include "fitsinoutfile.h" 7 #include "fitshandler.h" 7 8 8 9 #define OPENFILE 0 … … 52 53 //! Class for managing Interface for SOPHYA objects to FITS Format Files (uses cfitsio lib) 53 54 54 class FitsIOHandler {55 class FitsIOHandler : public FitsHandlerInterface { 55 56 56 57 … … 60 61 void Read(char flnm[],int hdunum= 0); 61 62 void Write(char flnm[]) ; 62 void Read(FitsInFile& ifts, int hdunum=0); 63 void Write(FitsOutFile& ofts) ; 64 63 64 //Implementation par defaut de l'interface FitsHandlerInterface 65 virtual AnyDataObj* DataObj() { return NULL; } 66 virtual int CheckHandling(AnyDataObj & o) { return 0; } 67 virtual void SetDataObj(AnyDataObj & o) { return; } 68 virtual int CheckReadability(FitsInOutFile& is) { return 0; } 69 virtual FitsHandlerInterface* Clone() { return NULL; } 70 71 virtual void Read(FitsInOutFile& ifts); 72 virtual void Write(FitsInOutFile& ofts) ; 73 74 virtual void Read(FitsInFile& ifts, int hdunum=0); 65 75 66 76 protected: -
trunk/SophyaExt/FitsIOServer/fitslocalmap.cc
r2874 r2897 68 68 ownobj_ = false; 69 69 } 70 71 template <class T> 72 int FITS_LocalMap<T>::CheckHandling(AnyDataObj & o) 73 { 74 if ( typeid(o) == typeid( LocalMap< T > ) ) return 2; 75 LocalMap<T> * po = dynamic_cast< LocalMap<T> * >(&o); 76 if (po == NULL) return 0; 77 else return 1; 78 } 79 80 template <class T> 81 int FITS_LocalMap<T>::CheckReadability(FitsInOutFile& is) 82 { 83 if (is.CurrentHDUType() != BINARY_TBL ) return 0; 84 string key; 85 key = "Content"; 86 string clsnm = is.KeyValue(key); 87 if (clsnm != "LocalMap") return 0; 88 89 vector<string> colnames; 90 vector<int> coltypes; 91 vector<long> repcnt; 92 vector<long> width; 93 long ncols = is.GetColInfo(colnames, coltypes, repcnt, width); 94 if (ncols < 1) return 0; 95 T x; 96 if (coltypes[0] == FitsTypes::DataType(x)) return 2 ; 97 else return 1; 98 } 99 100 template <class T> 101 FitsHandlerInterface* FITS_LocalMap<T>::Clone() 102 { 103 return new FITS_LocalMap<T>() ; 104 } 70 105 71 106 template <class T> … … 195 230 dvl["Content"]= "LocalMap"; 196 231 dvl.SetComment("Content", "name of SOPHYA object"); 232 dvl["SOPCLSNM"]= "SOPHYA::LocalMap<T>"; 233 dvl.SetComment("SOPCLSNM", "SOPHYA class name"); 197 234 // On ecrit les dataBlocks 198 235 vector<string> Noms; 199 236 Noms.push_back(dvl.GetS("Content")); 200 string extname("SIMULATION"); 237 // string extname("SIMULATION"); 238 string extname = os.NextExtensionName(); 201 239 202 240 // sortie sur image fits -
trunk/SophyaExt/FitsIOServer/fitslocalmap.h
r1322 r2897 32 32 inline operator LocalMap<T>() { return(*dobj_); } 33 33 34 virtual int CheckHandling(AnyDataObj & o) ; 35 virtual int CheckReadability(FitsInOutFile& is); 36 virtual FitsHandlerInterface* Clone(); 37 34 38 protected : 35 39 -
trunk/SophyaExt/FitsIOServer/fitsntuple.cc
r2615 r2897 53 53 if (ownobj_ && dobj_ != NULL) delete dobj_; 54 54 // if (column_ != NULL) delete [] column_; 55 } 56 57 int FITS_NTuple::CheckReadability(FitsInOutFile& is) 58 { 59 if (is.CurrentHDUType() == IMAGE_HDU ) return 0; 60 string key = "SOPCLSNM"; 61 string clsnm = is.KeyValue(key); 62 if (clsnm == "SOPHYA::NTuple") return 2; 63 else return 1; 55 64 } 56 65 … … 167 176 dvl["Content"]= "NTuple"; 168 177 dvl.SetComment("Content", "name of SOPHYA object"); 178 dvl["SOPCLSNM"]= "SOPHYA::NTuple"; 179 dvl.SetComment("SOPCLSNM", "SOPHYA class name"); 169 180 // extension name 170 string extname("NTuple_Binary_tbl"); 181 // string extname("NTuple_Binary_tbl"); 182 string extname = os.NextExtensionName(); 171 183 172 184 vector<string> Noms(ncols); -
trunk/SophyaExt/FitsIOServer/fitsntuple.h
r1231 r2897 35 35 ownobj_ = false; 36 36 } 37 virtual int CheckHandling(AnyDataObj & o) 38 { 39 if (typeid(o) == typeid(NTuple)) return 2; 40 NTuple * po = dynamic_cast< NTuple * >(& o); 41 if (po == NULL) return 0; 42 else return 1; 43 } 37 44 45 virtual int CheckReadability(FitsInOutFile& is); 46 47 virtual FitsHandlerInterface* Clone() 48 { return new FITS_NTuple() ; } 38 49 39 50 /*! -
trunk/SophyaExt/FitsIOServer/fitsspherehealpix.cc
r2874 r2897 71 71 } 72 72 73 template <class T> 74 int FITS_SphereHEALPix<T>::CheckHandling(AnyDataObj & o) 75 { 76 if ( typeid(o) == typeid( SphereHEALPix< T > ) ) return 2; 77 SphereHEALPix<T> * po = dynamic_cast< SphereHEALPix<T> * >(&o); 78 if (po == NULL) return 0; 79 else return 1; 80 } 81 82 template <class T> 83 int FITS_SphereHEALPix<T>::CheckReadability(FitsInOutFile& is) 84 { 85 if (is.CurrentHDUType() != BINARY_TBL ) return 0; 86 string key; 87 key = "PIXTYPE"; 88 if ( is.KeyValue(key) != "HEALPIX") return 0; 89 90 bool nosk = false; 91 key = "ORDERING"; 92 is.KeyValue(key, nosk); 93 bool nosk2 = false; 94 key = "NSIDE"; 95 is.KeyValue(key, nosk2); 96 if (nosk || nosk2) return 0; 97 98 vector<string> colnames; 99 vector<int> coltypes; 100 vector<long> repcnt; 101 vector<long> width; 102 long ncols = is.GetColInfo(colnames, coltypes, repcnt, width); 103 if (ncols < 1) return 0; 104 T x; 105 if (coltypes[0] == FitsTypes::DataType(x)) return 2 ; 106 else return 1; 107 } 108 109 template <class T> 110 FitsHandlerInterface* FITS_SphereHEALPix<T>::Clone() 111 { 112 return new FITS_SphereHEALPix<T>() ; 113 } 73 114 74 115 … … 104 145 dvl["Content"]= "SphereHEALPix"; 105 146 dvl.SetComment("Content", "name of SOPHYA object"); 147 dvl["SOPCLSNM"]= "SOPHYA::SphereHEALPix<T>"; 148 dvl.SetComment("SOPCLSNM", "SOPHYA class name"); 106 149 107 150 // On ecrit les dataBlocks 108 151 vector<string> Noms; 109 152 Noms.push_back(dvl.GetS("Content")); 110 string extname("SIMULATION"); 153 // string extname("SIMULATION"); 154 string extname = os.NextExtensionName(); 111 155 112 156 string Type; -
trunk/SophyaExt/FitsIOServer/fitsspherehealpix.h
r1752 r2897 27 27 virtual AnyDataObj* DataObj(); 28 28 virtual void SetDataObj(AnyDataObj & o); 29 30 virtual int CheckHandling(AnyDataObj & o) ; 31 virtual int CheckReadability(FitsInOutFile& is); 32 virtual FitsHandlerInterface* Clone(); 29 33 30 34 void Mollweide_picture_projection(char flnm[]); -
trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.cc
r2874 r2897 68 68 ownobj_ = false; 69 69 } 70 71 template <class T> 72 int FITS_SphereThetaPhi<T>::CheckHandling(AnyDataObj & o) 73 { 74 if ( typeid(o) == typeid( SphereThetaPhi< T > ) ) return 2; 75 SphereThetaPhi<T> * po = dynamic_cast< SphereThetaPhi<T> * >(&o); 76 if (po == NULL) return 0; 77 else return 1; 78 } 79 80 template <class T> 81 int FITS_SphereThetaPhi<T>::CheckReadability(FitsInOutFile& is) 82 { 83 if (is.CurrentHDUType() != BINARY_TBL ) return 0; 84 string key; 85 key = "PIXTYPE"; 86 if ( is.KeyValue(key) != "TETAFI") return 0; 87 key = "Content"; 88 if ( is.KeyValue(key) != "SphereThetaPhi") return 0; 89 90 vector<string> colnames; 91 vector<int> coltypes; 92 vector<long> repcnt; 93 vector<long> width; 94 long ncols = is.GetColInfo(colnames, coltypes, repcnt, width); 95 if (ncols < 1) return 0; 96 T x; 97 if (coltypes[0] == FitsTypes::DataType(x)) return 2 ; 98 else return 1; 99 } 100 101 template <class T> 102 FitsHandlerInterface* FITS_SphereThetaPhi<T>::Clone() 103 { 104 return new FITS_SphereThetaPhi<T>() ; 105 } 106 70 107 71 108 template <class T> … … 100 137 dvl["Content"]= "SphereThetaPhi"; 101 138 dvl.SetComment("Content", "name of SOPHYA object"); 139 dvl["SOPCLSNM"]= "SOPHYA::SphereThetaPhi<T>"; 140 dvl.SetComment("SOPCLSNM", "SOPHYA class name"); 102 141 103 142 // On ecrit les dataBlocks … … 116 155 Noms[2] = "CumulPixParBande"; 117 156 Noms[3] = "ThetaBande"; 118 string extname("SIMULATION");119 157 //string extname("SIMULATION"); 158 string extname = os.NextExtensionName(); 120 159 121 160 string Type; -
trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.h
r1752 r2897 26 26 virtual AnyDataObj* DataObj(); 27 27 virtual void SetDataObj(AnyDataObj & o); 28 29 virtual int CheckHandling(AnyDataObj & o) ; 30 virtual int CheckReadability(FitsInOutFile& is); 31 virtual FitsHandlerInterface* Clone(); 28 32 29 33 void Mollweide_picture_projection(char flnm[]);
Note:
See TracChangeset
for help on using the changeset viewer.