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


Ignore:
Timestamp:
Jun 28, 1999, 1:56:16 PM (26 years ago)
Author:
ercodmgr
Message:

Ajout SetXYLimits et debut d'introduction de repertoire dans la gestion des objets nommes - Reza 28/6/99

File:
1 edited

Legend:

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

    r330 r331  
    6565// ..................................................................
    6666// ......  Gestion des objets nommes, variables globales ............
     67struct nobj_diritem {
     68  int id;
     69  int nobj;
     70};
     71
     72typedef map<string, nobj_diritem, less<string> > NObjDirList;
     73
    6774struct nobj_item {
    6875  AnyDataObj* obj;
    6976  NObjMgrAdapter* obja;
    7077  int num;
     78  int dirid;
    7179  list<int> wrsid;
    7280  bool operator==(nobj_item const& b) const
     
    7684typedef map<string, nobj_item, less<string> > NObjList;
    7785
    78 static NObjList* myObjs;
     86static NObjDirList* myDirs = NULL;
     87static NObjList* myObjs = NULL;
    7988static int fgOInit = 0;
    8089static int myNObj = 0;
    81 static string* lastobj = NULL;
     90static int myDirId = 0;
     91static string* currDir;
    8292
    8393static PIStdImgApp* myImgApp=NULL;
     
    101111{
    102112if (fgOInit == 0) {
     113  myDirs = new NObjDirList;
    103114  myObjs = new NObjList; 
    104   lastobj = new string("");
     115  currDir = new string("home");
    105116  char* varenv;
    106117  TmpDir = new string("");
     
    149160{
    150161return(servnobjm);
     162}
     163
     164/* --Methode-- */
     165void NamedObjMgr::CreateDir(string const& dirname)
     166{
     167}
     168
     169/* --Methode-- */
     170void NamedObjMgr::DeleteDir(string const& dirname)
     171{
     172}
     173
     174/* --Methode-- */
     175void NamedObjMgr::SetCurrentDir(string const& dirname)
     176{
     177}
     178
     179/* --Methode-- */
     180void NamedObjMgr::CleanTmpDir()
     181{
     182}
     183
     184/* --Methode-- */
     185void NamedObjMgr::CleanOldDir()
     186{
    151187}
    152188
     
    169205// void  RenameObj(string const& nom, string& nomnew)
    170206//      Change le nom d'un objet dans la liste.
    171 // string  LastObjName()
    172 //      Renvoie le nom du dernier objet ajouté à la liste
    173207//--
    174208
    175209
    176210/* --Methode-- */
    177 void NamedObjMgr::AddObj(AnyDataObj* obj, string& nom, bool)
     211void NamedObjMgr::AddObj(AnyDataObj* obj, string & nom, bool)
    178212{
    179213
     
    200234  }
    201235
    202 (*lastobj) = nom;
    203236nobj_item no;
    204237no.obj = obj;
    205238no.obja = servnobjm->GetAdapter(obj);  // L'adaptateur
    206239no.num =  myNObj;
    207 (*myObjs)[(*lastobj)] = no;
     240(*myObjs)[nom] = no;
    208241if (myImgApp)  {
    209   string str = (*lastobj) + "    (T= " + typeid(*obj).name() + ")" ;
     242  string str = nom + "    (T= " + typeid(*obj).name() + ")" ;
    210243  (myImgApp->ObjMgrW())->AddObj(str.c_str(), myNObj+1000);
    211244}
    212245 
    213 cout << "NamedObjMgr::AddObj()  Object " << (*lastobj) << " ( " 
     246cout << "NamedObjMgr::AddObj()  Object " << nom << " ( " 
    214247     << typeid(*obj).name() << " ) added (Total= " << myObjs->size() << ")" << endl; 
    215248return;
     
    217250
    218251/* --Methode-- */
    219 void NamedObjMgr::DelObj(string const& nom, bool fgd)
     252void NamedObjMgr::RenameObj(string & nom, string& nomnew)
     253{
     254AnyDataObj* obj = GetObj(nom);
     255if (obj == NULL) return;
     256DelObj(nom, false);
     257AddObj(obj, nomnew);
     258return;
     259}
     260
     261/* --Methode-- */
     262void NamedObjMgr::DelObj(string & nom, bool fgd)
    220263{
    221264NObjList::iterator it = myObjs->find(nom);
     
    237280
    238281/* --Methode-- */
    239 void NamedObjMgr::DelObjects(string const& patt, bool fgd)
     282void NamedObjMgr::DelObj_Id(int oid)
     283{
     284}
     285
     286/* --Methode-- */
     287void NamedObjMgr::DelObjects(string & patt, bool fgd)
    240288{
    241289NObjList::iterator it; 
     
    251299
    252300/* --Methode-- */
    253 AnyDataObj* NamedObjMgr::GetObj(string const& nom)
     301AnyDataObj* NamedObjMgr::GetObj(string & nom)
    254302{
    255303NObjList::iterator it = myObjs->find(nom);
     
    259307
    260308/* --Methode-- */
    261 NObjMgrAdapter* NamedObjMgr::GetObjAdapter(string const& nom)
     309NObjMgrAdapter* NamedObjMgr::GetObjAdapter(string & nom)
    262310{
    263311NObjList::iterator it = myObjs->find(nom);
     
    267315
    268316/* --Methode-- */
    269 void NamedObjMgr::RenameObj(string const& nom, string& nomnew)
    270 {
    271 AnyDataObj* obj = GetObj(nom);
    272 if (obj == NULL) return;
    273 DelObj(nom, false);
    274 AddObj(obj, nomnew);
    275 return;
    276 }
    277 
    278 /* --Methode-- */
    279 string NamedObjMgr::LastObjName()
    280 {
    281 return((*lastobj));
     317void NamedObjMgr::ListObjs(string & patt)
     318{
     319int k;
     320AnyDataObj* obj=NULL;
     321string ctyp;
     322char strg[256];
     323
     324cout << "NamedObjMgr::ListObjs() NObjs= " << myObjs->size() << "\n" ;
     325NObjList::iterator it;  k = 0;
     326for(it = myObjs->begin(); it != myObjs->end(); it++) {
     327  obj = (*it).second.obj;
     328
     329  ctyp = typeid(*obj).name();
     330  sprintf(strg, "%2d/ %16s : %s", k, typeid(*obj).name(), ((*it).first).c_str());
     331  ctyp = strg;
     332  cout << ctyp << "\n" ;
     333  k++;
     334}
     335cout << endl;
     336return;
     337}
     338
     339/* --Methode-- */
     340void NamedObjMgr::GetObjList(string & patt, vector<string> &)
     341{
    282342}
    283343
     
    297357
    298358/* --Methode-- */
    299 void NamedObjMgr::ReadObj(string const & flnm, string nobj)
     359void NamedObjMgr::ReadObj(string const & flnm, string & nobj)
    300360{
    301361PPersist* obj=NULL;
     
    387447
    388448/* --Methode-- */
    389 void NamedObjMgr::ReadFits(string const & flnm, string nobj)
     449void NamedObjMgr::ReadFits(string const & flnm, string & nobj)
    390450{
    391451bool ok = true;
     
    415475static int key_for_write = 5000;
    416476/* --Methode-- */
    417 void NamedObjMgr::SaveObj(string const& nom, POutPersist& s)
     477void NamedObjMgr::SaveObj(string & nom, POutPersist& s)
    418478{
    419479NObjMgrAdapter* obja=NULL;
     
    445505
    446506/* --Methode-- */
    447 void NamedObjMgr::SaveFits(string const& nom, string const & flnm)
     507void NamedObjMgr::SaveFits(string& nom, string const & flnm)
    448508{
    449509NObjMgrAdapter* obja=NULL;
     
    455515
    456516
    457 /* --Methode-- */
    458 void NamedObjMgr::ListObjs()
    459 {
    460 int k;
    461 AnyDataObj* obj=NULL;
    462 string ctyp;
    463 char strg[256];
    464 
    465 cout << "NamedObjMgr::ListObjs() NObjs= " << myObjs->size() << "\n" ;
    466 NObjList::iterator it;  k = 0;
    467 for(it = myObjs->begin(); it != myObjs->end(); it++) {
    468   obj = (*it).second.obj;
    469 
    470   ctyp = typeid(*obj).name();
    471   sprintf(strg, "%2d/ %16s : %s", k, typeid(*obj).name(), ((*it).first).c_str());
    472   ctyp = strg;
    473   cout << ctyp << "\n" ;
    474   k++;
    475 }
    476 cout << endl;
    477 return;
    478 }
    479 
    480 /* --Methode-- */
    481 void NamedObjMgr::PrintObj(string const& nom)
     517
     518/* --Methode-- */
     519void NamedObjMgr::PrintObj(string& nom)
    482520{
    483521NObjMgrAdapter* obja=NULL;
     
    493531
    494532/* --Methode-- */
    495 void NamedObjMgr::DisplayObj(string const& nom, string dopt)
     533void NamedObjMgr::DisplayObj(string& nom, string dopt)
    496534{
    497535NObjMgrAdapter* obja=NULL;
     
    535573
    536574/* --Methode-- */
    537 void NamedObjMgr::DisplayImage(string const& nom, string dopt)
     575void NamedObjMgr::DisplayImage(string& nom, string dopt)
    538576{
    539577NObjMgrAdapter* obja=NULL;
     
    567605}
    568606/* --Methode-- */
    569 void NamedObjMgr::DisplaySurf3D(string const& nom, string dopt)
     607void NamedObjMgr::DisplaySurf3D(string& nom, string dopt)
    570608{
    571609NObjMgrAdapter* obja=NULL;
     
    608646
    609647/* --Methode-- */
    610 void NamedObjMgr::DisplayNT(string const& nom, string& nmx, string& nmy, string& nmz,
     648void NamedObjMgr::DisplayNT(string& nom, string& nmx, string& nmy, string& nmz,
    611649                            string& erx, string& ery, string& erz, string dopt)
    612650{
     
    657695
    658696/* --Methode-- cmv 13/10/98 */
    659 void NamedObjMgr::DisplayGFD(string const& nom, string& numvarx, string& numvary, string& err, string dopt)
     697void NamedObjMgr::DisplayGFD(string& nom, string& numvarx, string& numvary, string& err, string dopt)
    660698//      Pour le display 2D ou 3D d'un ``GeneralFitData''.
    661699//|  nom = nom de l'objet GeneralFitData a representer.
     
    719757
    720758/* --Methode--
    721 void NamedObjMgr::DisplayImage(string const& nom, string dopt)
     759void NamedObjMgr::DisplayImage(string& nom, string dopt)
    722760{
    723761  cout << "NamedObjMgr::DisplayImage() a faire ! " << endl;
     
    743781
    744782/* --Methode-- */
    745 void NamedObjMgr::DisplayPoints2D(string const& nom,  string& expx, string& expy,
     783void NamedObjMgr::DisplayPoints2D(string& nom,  string& expx, string& expy,
    746784                                  string& experrx, string& experry,
    747785                                  string& expcut, string dopt)
     
    787825
    788826/* --Methode-- */
    789 void NamedObjMgr::DisplayPoints3D(string const& nom,  string& expx, string& expy, string& expz,
     827void NamedObjMgr::DisplayPoints3D(string& nom,  string& expx, string& expy, string& expz,
    790828                                  string& expcut, string dopt)
    791829{
     
    829867
    830868/* --Methode-- */
    831 void NamedObjMgr::ProjectH1(string const& nom, string& expx, string& expwt, string& expcut, string& nomh1, string dopt)
     869void NamedObjMgr::ProjectH1(string& nom, string& expx, string& expwt, string& expcut, string& nomh1, string dopt)
    832870{
    833871NObjMgrAdapter* obja=NULL;
     
    877915
    878916/* --Methode-- */
    879 void NamedObjMgr::ProjectH2(string const& nom, string& expx, string& expy, string& expwt, string& expcut,
     917void NamedObjMgr::ProjectH2(string& nom, string& expx, string& expy, string& expwt, string& expcut,
    880918                            string& nomh2, string dopt)
    881919{
     
    928966
    929967/* --Methode-- cmv 13/10/98 */
    930 void NamedObjMgr::ProjectHProf(string const& nom, string& expx, string& expy, string& expwt, string& expcut,
     968void NamedObjMgr::ProjectHProf(string& nom, string& expx, string& expy, string& expwt, string& expcut,
    931969                              string& nomprof, string dopt)
    932970//      Pour remplir un ``GeneralFitData'' a partir de divers objets:
     
    9881026
    9891027/* --Methode-- */
    990 void NamedObjMgr::FillVect(string const& nom, string& expx, string& expcut, string& nomvec, string dopt)
     1028void NamedObjMgr::FillVect(string& nom, string& expx, string& expcut, string& nomvec, string dopt)
    9911029{
    9921030NObjMgrAdapter* obja=NULL;
     
    10291067
    10301068/* --Methode-- */
    1031 void NamedObjMgr::FillNT(string const& nom, string& expx, string& expy, string& expz, string& expt,
     1069void NamedObjMgr::FillNT(string& nom, string& expx, string& expy, string& expz, string& expt,
    10321070                         string& expcut, string& nomnt)
    10331071{
     
    10661104
    10671105/* --Methode-- cmv 13/10/98 */
    1068 void NamedObjMgr::FillGFD(string const& nom, string& expx, string& expy, string& expz,
     1106void NamedObjMgr::FillGFD(string& nom, string& expx, string& expy, string& expz,
    10691107                          string& experr, string& expcut, string& nomgfd)
    10701108//      Pour remplir un ``GeneralFitData'' a partir de divers objets:
     
    12461284
    12471285/* --Methode-- cmv 13/10/98 */
    1248 void  NamedObjMgr:: Fit12D(string const& nom, string& func,
     1286void  NamedObjMgr:: Fit12D(string& nom, string& func,
    12491287                          string par,string step,string min,string max,
    12501288                          string opt)
Note: See TracChangeset for help on using the changeset viewer.