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


Ignore:
Timestamp:
Feb 7, 2005, 3:23:45 PM (21 years ago)
Author:
cmv
Message:

openppf modified to allow for object selection at the line command level. cmv 070205

File:
1 edited

Legend:

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

    r2615 r2645  
    926926AddObj_P(ppobj->DataObj(), nobj, true);
    927927cout << "NamedObjMgr::ReadObj(...) object " << nobj << " read from file " << endl;
     928return;
     929}
     930/* --Methode-- */
     931void NamedObjMgr::ReadObj(vector<string> & flnm_objname)
     932// flnm_objname[0] = nom du fichier .ppf
     933// flnm_objname[1...] = nom des tags des objects a lire
     934{
     935if(flnm_objname.size()<2) return;
     936ZSync(*myMutex);
     937int nread=0;
     938try {
     939  PInPersist pis(flnm_objname[0]);
     940  for(int i=1;i<flnm_objname.size();i++) {
     941    bool ok = pis.GotoNameTag(flnm_objname[i]);
     942    if(!ok) {
     943      cout<<"NamedObjMgr::ReadObj(...) Unknown object: "<<flnm_objname[i]<<endl;
     944      continue;
     945    }
     946    PPersist *ppobj = pis.ReadObject();;
     947    if(ppobj==NULL) {
     948      cout<<"NamedObjMgr::ReadObj(...) impossible to read "<<flnm_objname[i]<<endl;
     949      continue;
     950    }
     951    AddObj_P(ppobj->DataObj(),flnm_objname[i],true);
     952    nread++;
     953    cout<<"NamedObjMgr::ReadObj(...) object "<<flnm_objname[i]<<" read from file "<<endl;
     954  }
     955} catch (IOExc iox) {
     956  cerr<<"NamedObjMgr::ReadObj()/Error Exception - Msg= "<<iox.Msg()<<endl;
     957}
     958cout<<nread<<" objects have been read"<<endl;
    928959return;
    929960}
Note: See TracChangeset for help on using the changeset viewer.