Changeset 331 in Sophya for trunk/SophyaPI/PIext/nobjmgr.cc
- Timestamp:
- Jun 28, 1999, 1:56:16 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/nobjmgr.cc
r330 r331 65 65 // .................................................................. 66 66 // ...... Gestion des objets nommes, variables globales ............ 67 struct nobj_diritem { 68 int id; 69 int nobj; 70 }; 71 72 typedef map<string, nobj_diritem, less<string> > NObjDirList; 73 67 74 struct nobj_item { 68 75 AnyDataObj* obj; 69 76 NObjMgrAdapter* obja; 70 77 int num; 78 int dirid; 71 79 list<int> wrsid; 72 80 bool operator==(nobj_item const& b) const … … 76 84 typedef map<string, nobj_item, less<string> > NObjList; 77 85 78 static NObjList* myObjs; 86 static NObjDirList* myDirs = NULL; 87 static NObjList* myObjs = NULL; 79 88 static int fgOInit = 0; 80 89 static int myNObj = 0; 81 static string* lastobj = NULL; 90 static int myDirId = 0; 91 static string* currDir; 82 92 83 93 static PIStdImgApp* myImgApp=NULL; … … 101 111 { 102 112 if (fgOInit == 0) { 113 myDirs = new NObjDirList; 103 114 myObjs = new NObjList; 104 lastobj = new string("");115 currDir = new string("home"); 105 116 char* varenv; 106 117 TmpDir = new string(""); … … 149 160 { 150 161 return(servnobjm); 162 } 163 164 /* --Methode-- */ 165 void NamedObjMgr::CreateDir(string const& dirname) 166 { 167 } 168 169 /* --Methode-- */ 170 void NamedObjMgr::DeleteDir(string const& dirname) 171 { 172 } 173 174 /* --Methode-- */ 175 void NamedObjMgr::SetCurrentDir(string const& dirname) 176 { 177 } 178 179 /* --Methode-- */ 180 void NamedObjMgr::CleanTmpDir() 181 { 182 } 183 184 /* --Methode-- */ 185 void NamedObjMgr::CleanOldDir() 186 { 151 187 } 152 188 … … 169 205 // void RenameObj(string const& nom, string& nomnew) 170 206 // Change le nom d'un objet dans la liste. 171 // string LastObjName()172 // Renvoie le nom du dernier objet ajouté à la liste173 207 //-- 174 208 175 209 176 210 /* --Methode-- */ 177 void NamedObjMgr::AddObj(AnyDataObj* obj, string & nom, bool)211 void NamedObjMgr::AddObj(AnyDataObj* obj, string & nom, bool) 178 212 { 179 213 … … 200 234 } 201 235 202 (*lastobj) = nom;203 236 nobj_item no; 204 237 no.obj = obj; 205 238 no.obja = servnobjm->GetAdapter(obj); // L'adaptateur 206 239 no.num = myNObj; 207 (*myObjs)[ (*lastobj)] = no;240 (*myObjs)[nom] = no; 208 241 if (myImgApp) { 209 string str = (*lastobj)+ " (T= " + typeid(*obj).name() + ")" ;242 string str = nom + " (T= " + typeid(*obj).name() + ")" ; 210 243 (myImgApp->ObjMgrW())->AddObj(str.c_str(), myNObj+1000); 211 244 } 212 245 213 cout << "NamedObjMgr::AddObj() Object " << (*lastobj)<< " ( "246 cout << "NamedObjMgr::AddObj() Object " << nom << " ( " 214 247 << typeid(*obj).name() << " ) added (Total= " << myObjs->size() << ")" << endl; 215 248 return; … … 217 250 218 251 /* --Methode-- */ 219 void NamedObjMgr::DelObj(string const& nom, bool fgd) 252 void NamedObjMgr::RenameObj(string & nom, string& nomnew) 253 { 254 AnyDataObj* obj = GetObj(nom); 255 if (obj == NULL) return; 256 DelObj(nom, false); 257 AddObj(obj, nomnew); 258 return; 259 } 260 261 /* --Methode-- */ 262 void NamedObjMgr::DelObj(string & nom, bool fgd) 220 263 { 221 264 NObjList::iterator it = myObjs->find(nom); … … 237 280 238 281 /* --Methode-- */ 239 void NamedObjMgr::DelObjects(string const& patt, bool fgd) 282 void NamedObjMgr::DelObj_Id(int oid) 283 { 284 } 285 286 /* --Methode-- */ 287 void NamedObjMgr::DelObjects(string & patt, bool fgd) 240 288 { 241 289 NObjList::iterator it; … … 251 299 252 300 /* --Methode-- */ 253 AnyDataObj* NamedObjMgr::GetObj(string const& nom)301 AnyDataObj* NamedObjMgr::GetObj(string & nom) 254 302 { 255 303 NObjList::iterator it = myObjs->find(nom); … … 259 307 260 308 /* --Methode-- */ 261 NObjMgrAdapter* NamedObjMgr::GetObjAdapter(string const& nom)309 NObjMgrAdapter* NamedObjMgr::GetObjAdapter(string & nom) 262 310 { 263 311 NObjList::iterator it = myObjs->find(nom); … … 267 315 268 316 /* --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)); 317 void NamedObjMgr::ListObjs(string & patt) 318 { 319 int k; 320 AnyDataObj* obj=NULL; 321 string ctyp; 322 char strg[256]; 323 324 cout << "NamedObjMgr::ListObjs() NObjs= " << myObjs->size() << "\n" ; 325 NObjList::iterator it; k = 0; 326 for(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 } 335 cout << endl; 336 return; 337 } 338 339 /* --Methode-- */ 340 void NamedObjMgr::GetObjList(string & patt, vector<string> &) 341 { 282 342 } 283 343 … … 297 357 298 358 /* --Methode-- */ 299 void NamedObjMgr::ReadObj(string const & flnm, string nobj)359 void NamedObjMgr::ReadObj(string const & flnm, string & nobj) 300 360 { 301 361 PPersist* obj=NULL; … … 387 447 388 448 /* --Methode-- */ 389 void NamedObjMgr::ReadFits(string const & flnm, string nobj)449 void NamedObjMgr::ReadFits(string const & flnm, string & nobj) 390 450 { 391 451 bool ok = true; … … 415 475 static int key_for_write = 5000; 416 476 /* --Methode-- */ 417 void NamedObjMgr::SaveObj(string const& nom, POutPersist& s)477 void NamedObjMgr::SaveObj(string & nom, POutPersist& s) 418 478 { 419 479 NObjMgrAdapter* obja=NULL; … … 445 505 446 506 /* --Methode-- */ 447 void NamedObjMgr::SaveFits(string const& nom, string const & flnm)507 void NamedObjMgr::SaveFits(string& nom, string const & flnm) 448 508 { 449 509 NObjMgrAdapter* obja=NULL; … … 455 515 456 516 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-- */ 519 void NamedObjMgr::PrintObj(string& nom) 482 520 { 483 521 NObjMgrAdapter* obja=NULL; … … 493 531 494 532 /* --Methode-- */ 495 void NamedObjMgr::DisplayObj(string const& nom, string dopt)533 void NamedObjMgr::DisplayObj(string& nom, string dopt) 496 534 { 497 535 NObjMgrAdapter* obja=NULL; … … 535 573 536 574 /* --Methode-- */ 537 void NamedObjMgr::DisplayImage(string const& nom, string dopt)575 void NamedObjMgr::DisplayImage(string& nom, string dopt) 538 576 { 539 577 NObjMgrAdapter* obja=NULL; … … 567 605 } 568 606 /* --Methode-- */ 569 void NamedObjMgr::DisplaySurf3D(string const& nom, string dopt)607 void NamedObjMgr::DisplaySurf3D(string& nom, string dopt) 570 608 { 571 609 NObjMgrAdapter* obja=NULL; … … 608 646 609 647 /* --Methode-- */ 610 void NamedObjMgr::DisplayNT(string const& nom, string& nmx, string& nmy, string& nmz,648 void NamedObjMgr::DisplayNT(string& nom, string& nmx, string& nmy, string& nmz, 611 649 string& erx, string& ery, string& erz, string dopt) 612 650 { … … 657 695 658 696 /* --Methode-- cmv 13/10/98 */ 659 void NamedObjMgr::DisplayGFD(string const& nom, string& numvarx, string& numvary, string& err, string dopt)697 void NamedObjMgr::DisplayGFD(string& nom, string& numvarx, string& numvary, string& err, string dopt) 660 698 // Pour le display 2D ou 3D d'un ``GeneralFitData''. 661 699 //| nom = nom de l'objet GeneralFitData a representer. … … 719 757 720 758 /* --Methode-- 721 void NamedObjMgr::DisplayImage(string const& nom, string dopt)759 void NamedObjMgr::DisplayImage(string& nom, string dopt) 722 760 { 723 761 cout << "NamedObjMgr::DisplayImage() a faire ! " << endl; … … 743 781 744 782 /* --Methode-- */ 745 void NamedObjMgr::DisplayPoints2D(string const& nom, string& expx, string& expy,783 void NamedObjMgr::DisplayPoints2D(string& nom, string& expx, string& expy, 746 784 string& experrx, string& experry, 747 785 string& expcut, string dopt) … … 787 825 788 826 /* --Methode-- */ 789 void NamedObjMgr::DisplayPoints3D(string const& nom, string& expx, string& expy, string& expz,827 void NamedObjMgr::DisplayPoints3D(string& nom, string& expx, string& expy, string& expz, 790 828 string& expcut, string dopt) 791 829 { … … 829 867 830 868 /* --Methode-- */ 831 void NamedObjMgr::ProjectH1(string const& nom, string& expx, string& expwt, string& expcut, string& nomh1, string dopt)869 void NamedObjMgr::ProjectH1(string& nom, string& expx, string& expwt, string& expcut, string& nomh1, string dopt) 832 870 { 833 871 NObjMgrAdapter* obja=NULL; … … 877 915 878 916 /* --Methode-- */ 879 void NamedObjMgr::ProjectH2(string const& nom, string& expx, string& expy, string& expwt, string& expcut,917 void NamedObjMgr::ProjectH2(string& nom, string& expx, string& expy, string& expwt, string& expcut, 880 918 string& nomh2, string dopt) 881 919 { … … 928 966 929 967 /* --Methode-- cmv 13/10/98 */ 930 void NamedObjMgr::ProjectHProf(string const& nom, string& expx, string& expy, string& expwt, string& expcut,968 void NamedObjMgr::ProjectHProf(string& nom, string& expx, string& expy, string& expwt, string& expcut, 931 969 string& nomprof, string dopt) 932 970 // Pour remplir un ``GeneralFitData'' a partir de divers objets: … … 988 1026 989 1027 /* --Methode-- */ 990 void NamedObjMgr::FillVect(string const& nom, string& expx, string& expcut, string& nomvec, string dopt)1028 void NamedObjMgr::FillVect(string& nom, string& expx, string& expcut, string& nomvec, string dopt) 991 1029 { 992 1030 NObjMgrAdapter* obja=NULL; … … 1029 1067 1030 1068 /* --Methode-- */ 1031 void NamedObjMgr::FillNT(string const& nom, string& expx, string& expy, string& expz, string& expt,1069 void NamedObjMgr::FillNT(string& nom, string& expx, string& expy, string& expz, string& expt, 1032 1070 string& expcut, string& nomnt) 1033 1071 { … … 1066 1104 1067 1105 /* --Methode-- cmv 13/10/98 */ 1068 void NamedObjMgr::FillGFD(string const& nom, string& expx, string& expy, string& expz,1106 void NamedObjMgr::FillGFD(string& nom, string& expx, string& expy, string& expz, 1069 1107 string& experr, string& expcut, string& nomgfd) 1070 1108 // Pour remplir un ``GeneralFitData'' a partir de divers objets: … … 1246 1284 1247 1285 /* --Methode-- cmv 13/10/98 */ 1248 void NamedObjMgr:: Fit12D(string const& nom, string& func,1286 void NamedObjMgr:: Fit12D(string& nom, string& func, 1249 1287 string par,string step,string min,string max, 1250 1288 string opt)
Note:
See TracChangeset
for help on using the changeset viewer.