Changeset 1483 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 08/05/02 16:12:14 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r1481 r1483 371 371 out << " MEvtLoop evtloop;" << endl; 372 372 if (fParList) 373 out << " evtloop.SetParList(&" << ToLower(fParList->GetName()) << ");" << endl;373 out << " evtloop.SetParList(&" << fParList->GetUniqueName() << ");" << endl; 374 374 else 375 375 out << " // fParList empty..." << endl; -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r1477 r1483 37 37 #include "MParContainer.h" 38 38 39 #include <ctype.h> // isdigit 39 40 #include <fstream.h> // ofstream, AsciiWrite 40 41 … … 139 140 // -------------------------------------------------------------------------- 140 141 // 142 // Return a unique name for this container. It is created from 143 // the container name and the unique Id. (This is mostly used 144 // in the StreamPrimitive member functions) 145 // 146 const TString MParContainer::GetUniqueName() const 147 { 148 TString ret = ToLower(fName); 149 150 if (isdigit(ret[ret.Length()-1])) 151 ret+="_"; 152 153 ret+=GetUniqueID(); 154 155 return ret; 156 } 157 158 // -------------------------------------------------------------------------- 159 // 141 160 // List MParContainer name and title. 142 161 // … … 359 378 void MParContainer::SavePrimitive(ofstream &out, Option_t *o) 360 379 { 380 static UInt_t uid = 0; 381 361 382 if (IsSavedAsPrimitive()) 362 383 return; 363 384 385 SetUniqueID(uid++/*gRandom->Uniform(kMaxInt)*/); 364 386 StreamPrimitive(out); 365 387 SetBit(kIsSavedAsPrimitive); … … 373 395 { 374 396 out << " // Using MParContainer::StreamPrimitive" << endl; 375 out << " " << ClassName() << " " << ToLower(fName) << "(\"";397 out << " " << ClassName() << " " << GetUniqueName() << "(\""; 376 398 out << fName << "\", \"" << fTitle << "\");" << endl; 377 399 } -
trunk/MagicSoft/Mars/mbase/MParContainer.h
r1477 r1483 55 55 virtual void FillBuffer(char *&buffer); 56 56 57 virtual const char *GetDescriptor() const { return Form("%s [%s]", fName.Data(), ClassName()); } 58 virtual const char *GetName() const { return fName.Data(); } 59 virtual const char *GetTitle() const { return fTitle.Data(); } 60 virtual ULong_t Hash() const { return fName.Hash(); } 61 virtual Bool_t IsSortable() const { return kTRUE; } 57 virtual const char *GetDescriptor() const { return Form("%s [%s]", fName.Data(), ClassName()); } 58 virtual const TString GetUniqueName() const; 59 virtual const char *GetName() const { return fName.Data(); } 60 virtual const char *GetTitle() const { return fTitle.Data(); } 61 virtual ULong_t Hash() const { return fName.Hash(); } 62 virtual Bool_t IsSortable() const { return kTRUE; } 62 63 63 64 virtual void SetName(const char *name); // *MENU* -
trunk/MagicSoft/Mars/mbase/MParList.cc
r1477 r1483 52 52 ClassImp(MParList); 53 53 54 static const TString gsDefName = "MParList"; 55 static const TString gsDefTitle = "A list of Parameter Containers"; 56 54 57 // -------------------------------------------------------------------------- 55 58 // … … 59 62 MParList::MParList(const char *name, const char *title) 60 63 { 61 fName = name ? name : "MParList";62 fTitle = title ? title : "A list of Parameter Containers";64 fName = name ? name : gsDefName.Data(); 65 fTitle = title ? title : gsDefTitle.Data(); 63 66 64 67 // … … 668 671 void MParList::StreamPrimitive(ofstream &out) const 669 672 { 670 out << " MParList " << ToLower(fName) << "(\""; 671 out << fName << "\", \"" << fTitle << "\");" << endl << endl; 673 out << " MParList " << GetUniqueName(); 674 if (fName!=gsDefName) 675 { 676 out << "(\"" << fName << "\""; 677 if (fTitle!=gsDefTitle) 678 out << ", \"" << fTitle << "\""; 679 out <<")"; 680 } 681 out << ";" << endl << endl; 672 682 673 683 TIter Next(fContainer); 674 684 675 TObject*cont = NULL;676 while ((cont= Next()))685 MParContainer *cont = NULL; 686 while ((cont=(MParContainer*)Next())) 677 687 { 678 688 cont->SavePrimitive(out, ""); 679 689 680 out << " " << ToLower(fName) << ".AddToList(&"; 681 out << ToLower(cont->GetName()) << ");" << endl << endl; 682 } 683 } 684 690 out << " " << GetUniqueName() << ".AddToList(&"; 691 out << cont->GetUniqueName() << ");" << endl << endl; 692 } 693 } 694 695 // -------------------------------------------------------------------------- 696 // 697 // Adds one TNamed object per object in the list. The TNamed object must 698 // be deleted by the user. 699 // 685 700 void MParList::GetNames(TObjArray &arr) const 686 701 { … … 689 704 } 690 705 706 // -------------------------------------------------------------------------- 707 // 708 // Sets name and title of each object in the list from the objects in 709 // the array. 710 // 691 711 void MParList::SetNames(TObjArray &arr) 692 712 { -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r1477 r1483 71 71 ClassImp(MTaskList); 72 72 73 static const TString gsDefName = "MTaskList"; 74 static const TString gsDefTitle = "A list for tasks to be executed"; 73 75 // -------------------------------------------------------------------------- 74 76 // … … 79 81 MTaskList::MTaskList(const char *name, const char *title) 80 82 { 81 fName = name ? name : "MTaskList";82 fTitle = title ? title : "A list for tasks to be executed";83 fName = name ? name : gsDefName.Data(); 84 fTitle = title ? title : gsDefTitle.Data(); 83 85 84 86 fTasks = new TList; … … 522 524 void MTaskList::StreamPrimitive(ofstream &out) const 523 525 { 524 out << " MTaskList " << ToLower(fName) << "(\""; 525 out << fName << "\", \"" << fTitle << "\");" << endl << endl; 526 out << " MTaskList " << GetUniqueName(); 527 if (fName!=gsDefName) 528 { 529 out << "(\"" << fName << "\""; 530 if (fTitle!=gsDefTitle) 531 out << ", \"" << fTitle << "\""; 532 out <<")"; 533 } 534 out << ";" << endl << endl; 526 535 527 536 TIter Next(fTasks); 528 537 529 TObject*cont = NULL;530 while ((cont= Next()))538 MParContainer *cont = NULL; 539 while ((cont=(MParContainer*)Next())) 531 540 { 532 541 cont->SavePrimitive(out, ""); 533 out << " " << ToLower(fName) << ".AddToList(&";534 out << ToLower(cont->GetName()) << ");" << endl << endl;542 out << " " << GetUniqueName() << ".AddToList(&"; 543 out << cont->GetUniqueName() << ");" << endl << endl; 535 544 } 536 545 }
Note:
See TracChangeset
for help on using the changeset viewer.