Changeset 2864 in Sophya for trunk/SophyaExt/FitsIOServer/fitsmanager.cc
- Timestamp:
- Jan 2, 2006, 2:47:44 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/FitsIOServer/fitsmanager.cc
r2843 r2864 24 24 } 25 25 26 int FitsManager::RegisterHandler(FitsHandlerInterface * fhi, string &clname)26 int FitsManager::RegisterHandler(FitsHandlerInterface * fhi, string clname) 27 27 { 28 ChkHLP(); 28 29 if (fhi == NULL) 29 30 throw NullPtrError("FitsManager::RegisterHandler() fhi=NULL "); … … 42 43 int FitsManager::ListHandlers() 43 44 { 45 ChkHLP(); 44 46 int kk=0; 45 47 cout << "---- FitsManager::ListHandlers() NbHandlers= " << hlistp->size() … … 56 58 FitsHandlerInterface* FitsManager::FindHandler(AnyDataObj & o) 57 59 { 60 ChkHLP(); 58 61 FitsHandlerInterface * fhi = NULL; 59 62 HandlerList::iterator it; 60 for(it = hlistp->begin(); it != hlistp->end(); it++) 61 if ( (*it).fhi->CheckHandling(o) ) { 62 fhi = (*it).fhi; break; 63 int hfg = 0; 64 int bhfg = 0; 65 for(it = hlistp->begin(); it != hlistp->end(); it++) { 66 hfg = (*it).fhi->CheckHandling(o); 67 if ( hfg > bhfg ) { 68 fhi = (*it).fhi; bhfg = hfg; 63 69 } 70 } 64 71 if (fhi == NULL) { 65 72 string msg = "FitsManager::FindHandler() Handler not found for "; … … 78 85 } 79 86 80 void FitsManager::Read(FitsInOutFile& os, AnyDataObj & o)87 void FitsManager::Read(FitsInOutFile& is, AnyDataObj & o) 81 88 { 82 89 FitsHandlerInterface * fhi2 = FindHandler(o)->Clone(); 83 90 fhi2->SetDataObj(o); 84 fhi2->Read(os); 91 fhi2->Read(is); 92 delete fhi2; 85 93 return; 86 94 } 95 96 FitsHandlerInterface * FitsManager::FindReader(FitsInOutFile& is) 97 { 98 ChkHLP(); 99 FitsHandlerInterface * fhi = NULL; 100 HandlerList::iterator it; 101 int hfg = 0; 102 int bhfg = 0; 103 for(it = hlistp->begin(); it != hlistp->end(); it++) { 104 hfg = (*it).fhi->CheckReadability(is); 105 if ( hfg > bhfg ) { 106 fhi = (*it).fhi; bhfg = hfg; 107 } 108 } 109 if (fhi == NULL) { 110 string msg = "FitsManager::FindReader() Reader/Handler not found "; 111 msg += is.FileName(); 112 char buff[64]; 113 sprintf(buff, " HDU= %d Type= %d", (int)(is.CurrentHDU()), 114 (int)(is.CurrentHDUType()) ); 115 msg += buff; 116 throw NotFoundExc(msg); 117 } 118 else return fhi; 119 } 120 121 FitsHandlerInterface * FitsManager::Read(FitsInOutFile& is) 122 { 123 FitsHandlerInterface * fhi2 = FindReader(is)->Clone(); 124 fhi2->Read(is); 125 return fhi2; 126 }
Note:
See TracChangeset
for help on using the changeset viewer.