Changeset 2645 in Sophya for trunk/SophyaPI/PIext


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

Location:
trunk/SophyaPI/PIext
Files:
3 edited

Legend:

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

    r2638 r2645  
    364364}
    365365else if (kw == "openppf" ) {
    366   if (tokens.size() < 1) { cout << "Usage: openppf file " << endl; return(0); }
    367   mObjMgr->ReadAll(tokens[0]); 
     366  if (tokens.size()<1) {cout<<"Usage: openppf file [objname1 objname2 ...]"<<endl; return(0); }
     367  else if (tokens.size()==1) mObjMgr->ReadAll(tokens[0]); 
     368  else mObjMgr->ReadObj(tokens);
    368369}
    369370else if ((kw == "saveobjs") || (kw == "saveppf"))  {
     
    14601461mpiac->RegisterCommand(kw, usage, this, "FileIO");
    14611462kw = "openppf";
    1462 usage = "Reads all objects from a PPF file \n Usage: openppf filename";
     1463usage = "Reads all or some objects from a PPF file \n Usage: openppf filename [objname1 objname2 ...]";
    14631464usage += "\n  Related commands: saveall openfits"; 
    14641465mpiac->RegisterCommand(kw, usage, this, "FileIO");
  • 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}
  • trunk/SophyaPI/PIext/nobjmgr.h

    r2491 r2645  
    7070  virtual void          ReadObj(PInPersist& s, int num=-1);
    7171  virtual void          ReadObj(string const & nomppf, string & nobj);
     72  virtual void          ReadObj(vector<string> & flnm_objname);
    7273  virtual void          ReadAll(string const & nomppf);
    7374  virtual void          ReadFits(string const & flnm, string & nobj);
Note: See TracChangeset for help on using the changeset viewer.