Changeset 2901 in Sophya for trunk/SophyaExt


Ignore:
Timestamp:
Jan 16, 2006, 10:01:10 AM (20 years ago)
Author:
ansari
Message:

Petites modifs + commentaires doc ds fitsmanager.cc - Reza 16/01/2006

File:
1 edited

Legend:

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

    r2898 r2901  
    6464}
    6565
     66/*!
     67  Return a NULL pointer if no handler is registered for object \b o .
     68  The returned pointer should not be used directly and should NOT
     69  be deleted. For read/write operations, the Clone() method should
     70  be called on the returned object.
     71*/
    6672FitsHandlerInterface* FitsManager::FindHandler(AnyDataObj & o)
    6773{
     
    8086    }
    8187  }
     88  return fhi ;
     89}
     90
     91/*!
     92  Throws an exception ( NotFoundExc ) if the write operation can not be performed.
     93*/
     94void FitsManager::Write(FitsInOutFile& os, AnyDataObj & o)
     95{
     96  FitsHandlerInterface * fhi = FindHandler(o);
    8297  if (fhi == NULL) {
    83     string msg = "FitsManager::FindHandler() Handler not found for ";
     98    string msg = "FitsManager::Write()/FindHandler() Handler not found for ";
    8499    msg += typeid(o).name();
    85100    throw NotFoundExc(msg);
    86101  }
    87   else return fhi;
    88 }
    89 
    90 void FitsManager::Write(FitsInOutFile& os, AnyDataObj & o)
    91 {
    92   FitsHandlerInterface * fhi2 = FindHandler(o)->Clone();
     102  FitsHandlerInterface * fhi2 = fhi->Clone();
    93103  fhi2->SetDataObj(o);
    94104  fhi2->Write(os);
     105  delete fhi2 ;
    95106  return;
    96107}
    97108
     109/*!
     110  Throws an exception ( NotFoundExc ) if the read operation can not be performed.
     111*/
    98112void FitsManager::Read(FitsInOutFile& is, AnyDataObj & o)
    99113{
    100   FitsHandlerInterface * fhi2 = FindHandler(o)->Clone();
     114  FitsHandlerInterface * fhi = FindHandler(o);
     115  if (fhi == NULL) {
     116    string msg = "FitsManager::Read()/FindHandler() Handler not found for ";
     117    msg += typeid(o).name();
     118    throw NotFoundExc(msg);
     119  }
     120  FitsHandlerInterface * fhi2 = fhi->Clone();
    101121  fhi2->SetDataObj(o);
    102122  fhi2->Read(is);
     
    105125}
    106126
     127/*!
     128  Return a NULL pointer if no handler is found capable of reading
     129  the current HDU.
     130  The returned pointer should not be used directly and should NOT
     131  be deleted. For read/write operations, the Clone() method should
     132  be called on the returned object.
     133*/
    107134FitsHandlerInterface * FitsManager::FindReader(FitsInOutFile& is)
    108135{
     
    120147    }
    121148  }
     149  return fhi;
     150}
     151
     152/*!
     153  Throws an exception ( NotFoundExc ) if the read operation can not be performed.
     154  In case of success, the calling function is responsible for deleting
     155  the returned FitsHandlerInterface object, when the correspondind data object
     156  is not needed any more.
     157*/
     158FitsHandlerInterface * FitsManager::Read(FitsInOutFile& is)
     159{
     160  FitsHandlerInterface * fhi = FindReader(is);
    122161  if (fhi == NULL) {
    123     string msg = "FitsManager::FindReader() Reader/Handler not found  ";
     162    string msg = "FitsManager::Read()/FindReader() Reader/Handler not found  ";
    124163    msg += is.FileName();
    125164    char buff[64];
     
    129168    throw NotFoundExc(msg);
    130169  }
    131   else return fhi;
    132 }
    133 
    134 FitsHandlerInterface * FitsManager::Read(FitsInOutFile& is)
    135 {
    136170  FitsHandlerInterface * fhi2 = FindReader(is)->Clone();
    137171  fhi2->Read(is);
Note: See TracChangeset for help on using the changeset viewer.