Ignore:
Timestamp:
Jan 2, 2006, 2:47:44 PM (20 years ago)
Author:
ansari
Message:

1/ Ajout methode CheckReadability() , retour int pour CheckHandling() ds l'interface FitsHandler et propagation vers handler TArray et DataTable
2/ Correction dans FitsManager et ajout initialiseur de module FitsIOServer (fiosinit.h .cc)
3/ FitsSwapper complete - corrige - full template (suppression de fitsswapper.cc)
4/ MAJ Makefile et objlist.list suite ajout fiosinit.cc et swfitsdtable

Reza , 2 Jan 2006

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaExt/FitsIOServer/fitsmanager.cc

    r2843 r2864  
    2424}
    2525
    26 int FitsManager::RegisterHandler(FitsHandlerInterface * fhi, string & clname)
     26int FitsManager::RegisterHandler(FitsHandlerInterface * fhi, string clname)
    2727{
     28  ChkHLP();
    2829  if (fhi == NULL)
    2930    throw NullPtrError("FitsManager::RegisterHandler() fhi=NULL ");
     
    4243int FitsManager::ListHandlers()
    4344{
     45  ChkHLP();
    4446  int kk=0;
    4547  cout << "---- FitsManager::ListHandlers()  NbHandlers= " << hlistp->size()
     
    5658FitsHandlerInterface* FitsManager::FindHandler(AnyDataObj & o)
    5759{
     60  ChkHLP();
    5861  FitsHandlerInterface * fhi = NULL;
    5962  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;
    6369    }
     70  }
    6471  if (fhi == NULL) {
    6572    string msg = "FitsManager::FindHandler() Handler not found for ";
     
    7885}
    7986
    80 void FitsManager::Read(FitsInOutFile& os, AnyDataObj & o)
     87void FitsManager::Read(FitsInOutFile& is, AnyDataObj & o)
    8188{
    8289  FitsHandlerInterface * fhi2 = FindHandler(o)->Clone();
    8390  fhi2->SetDataObj(o);
    84   fhi2->Read(os);
     91  fhi2->Read(is);
     92  delete fhi2;
    8593  return;
    8694}
     95
     96FitsHandlerInterface * 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
     121FitsHandlerInterface * 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.