Changeset 495 in Sophya for trunk/SophyaPI/PIext/nobjmgr.cc


Ignore:
Timestamp:
Oct 21, 1999, 8:58:45 PM (26 years ago)
Author:
ercodmgr
Message:

Portage -> DPPlanck , Reza+cmv 21/10/99

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/nobjmgr.cc

    r493 r495  
    684684void NamedObjMgr::ReadObj(string const & flnm, string & nobj)
    685685{
    686 PPersist* obj=NULL;
     686PPersist* ppobj=NULL;
    687687bool ok = true;
    688 
     688#ifdef SANS_EVOLPLANCK
    689689TRY{
    690690  PInPersist pis(flnm);
    691   obj = PPersistMgr::ReadObject(pis);
    692   if (obj == NULL) ok = false;
     691  ppobj = PPersistMgr::ReadObject(pis);
     692  if (ppobj == NULL) ok = false;
    693693}  CATCH(merr)
    694694  { printf("NamedObjMgr::ReadObj()/Error Exception= %ld (%s) \n",
    695695    (long)merr, PeidaExc(merr));  ok = false; } ENDTRY;
    696 
     696#else
     697try {
     698  PInPersist pis(flnm);
     699  ppobj = pis.ReadObject();
     700  }
     701catch (IOExc iox) {
     702  cerr << "NamedObjMgr::ReadObj()/Error Exception - Msg= " << iox.Msg() << endl;
     703  ok = false;
     704  }
     705#endif
    697706if (!ok)  return;
    698707if (nobj.length()<1)  nobj = servnobjm->FileName2Name(flnm);
    699 AddObj(obj->DataObj(), nobj, true);
     708AddObj(ppobj->DataObj(), nobj, true);
    700709return;
    701710}
     
    713722if ( (s.NbTags() < 1) || (num >= s.NbTags()) ) {
    714723  if (num >= 0) {
    715     printf("NamedObjMgr::ReadObj(PInPersist, %d) Error! NbTags = %d \n", num, s.NbTags());
     724    cerr << "NamedObjMgr::ReadObj(PInPersist, " << num << "  Error! NbTags ="
     725         << s.NbTags() << endl;
    716726    return;
    717727  }
     728
     729#ifdef SANS_EVOLPLANCK
    718730  TRY {
    719731    obj = PPersistMgr::ReadObject(s);
     
    723735    ok = false;
    724736  } ENDTRY;
     737#else
     738try {
     739  obj = s.ReadObject();
     740  }
     741catch (IOExc iox) {
     742  cerr << "NamedObjMgr::ReadObj()/Error Exception - Msg= " << iox.Msg() << endl;
     743  ok = false;
     744  }
     745#endif
     746
    725747  if (!ok)  return;
    726748  nom = "";
     
    732754else { n0 = num; n1 = num+1; }
    733755for(i=n0; i<n1; i++) {
     756#ifdef SANS_EVOLPLANCK
    734757  key = s.TagKey(i, cid, ln);
    735758  if (ln <= 0)  nom = "";
     
    743766    ok = false;
    744767  } ENDTRY;
     768#else
     769  s.GotoTagNum(i);
     770  try {
     771    obj = s.ReadObject();
     772    char buffnom[64];
     773    sprintf(buffnom,"O%d",i);
     774    nom = buffnom;
     775  }
     776  catch (IOExc iox) {
     777    cerr << "NamedObjMgr::ReadObj()/Error Exception - Msg= " << iox.Msg() << endl;
     778    ok = false;
     779    }
     780#endif
    745781  if (ok)  { AddObj(obj->DataObj(), nom, true);  nread++; }
    746782}
     
    756792
    757793PInPersist* ppin;
     794#ifdef SANS_EVOLPLANCK
    758795TRY{
    759796  ppin = new PInPersist(flnm);
     
    763800  { printf("NamedObjMgr::ReadAll()/Error Exception= %ld (%s) \n",
    764801    (long)merr, PeidaExc(merr));  ok = false; } ENDTRY;
    765 
     802#else
     803try {
     804  ppin = new PInPersist(flnm);
     805  if (ppin->NbTags() < 1)  obj = ppin->ReadObject();
     806  else   obj = NULL;
     807}
     808catch (IOExc iox) {
     809    cerr << "NamedObjMgr::ReadAll()/Error Exception - Msg= " << iox.Msg() << endl;
     810    ok = false;
     811}
     812#endif
    766813if (!ok)  return;
    767814if (obj) {
     
    784831#endif
    785832
    786 TRY{
    787833//  obj = RzReadFits((char*)flnm.c_str(), ImgOffX, ImgOffY, ImgSizX, ImgSizY, ImgBitSgn);
    788834#ifdef SANS_EVOLPLANCK
     835TRY{
    789836  obj = RzReadFits((char*)flnm.c_str());
    790 #else
    791   printf("NamedObjMgr::ReadFITS( NON-Disponible EVOL-PLANCK) \n");
    792   obj = NULL;
    793 #endif
    794837  if (obj == NULL)   ok = false;
    795838}  CATCH(merr) {
     
    801844  AddObj((AnyDataObj*)obj, nobj);
    802845}
     846#else
     847  printf("NamedObjMgr::ReadFITS( NON-Disponible EVOL-PLANCK) \n");
     848#endif
    803849return;
    804850}
     
    834880bool ok = true;
    835881POutPersist* pout;
     882#ifdef SANS_EVOLPLANCK
    836883TRY{
    837884  pout = new POutPersist(flnm);
     
    839886  { printf("NamedObjMgr::SaveObjects()/Error Exception= %ld (%s) \n",
    840887    (long)merr, PeidaExc(merr));  ok = false; } ENDTRY;
     888#else
     889try {
     890 pout = new POutPersist(flnm);
     891}
     892catch (IOExc iox) {
     893    cerr << "NamedObjMgr::SaveObjects()/Error Exception - Msg= " << iox.Msg() << endl;
     894    ok = false;
     895}
     896#endif
    841897if (!ok)  return;
    842898NObjList::iterator it;
     
    857913
    858914POutPersist* pout;
     915#ifdef SANS_EVOLPLANCK
    859916TRY{
    860917  pout = new POutPersist(flnm);
     
    862919  { printf("NamedObjMgr::SaveAll()/Error Exception= %ld (%s) \n",
    863920    (long)merr, PeidaExc(merr));  ok = false; } ENDTRY;
     921#else
     922try {
     923 pout = new POutPersist(flnm);
     924}
     925catch (IOExc iox) {
     926    cerr << "NamedObjMgr::SaveAll()/Error Exception - Msg= " << iox.Msg() << endl;
     927    ok = false;
     928}
     929#endif
    864930if (!ok)  return;
    865931NObjList::iterator it;
Note: See TracChangeset for help on using the changeset viewer.