Changeset 9026
- Timestamp:
- 07/21/08 09:18:18 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r9024 r9026 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2008/07/21 Thomas Bretz 22 23 * mbase/MParContainer.[h,cc]: 24 - adde new static ember functions GetClass 25 26 * mbase/MParList.[h,cc], mbase/MStatusArray.[h,cc], 27 mreport/MReportHelp.cc: 28 - use new GetClass function 29 30 20 31 21 32 2008/07/20 Thomas Bretz -
trunk/MagicSoft/Mars/mbase/MParList.cc
r9025 r9026 776 776 // try to get class from root environment 777 777 // 778 TClass *cls = GetClass(cname); 778 gLog << err; 779 TClass *cls = GetClass(cname, &gLog); 779 780 if (!cls) 780 781 return list; … … 782 783 if (!cls->InheritsFrom(MParContainer::Class())) 783 784 { 784 *fLog << err << dbginf << "Cannot create new instance of class '" << cname << "': " << endl;785 *fLog << "Class doesn't inherit from MParContainer." << endl;785 gLog << err << dbginf << "Cannot create new instance of class '" << cname << "': " << endl; 786 gLog << "Class doesn't inherit from MParContainer." << endl; 786 787 return list; 787 788 } -
trunk/MagicSoft/Mars/mbase/MStatusArray.cc
r8961 r9026 44 44 #include "MStatusArray.h" 45 45 46 #include <TH1.h> // TH1::AddDirectoryStatus();46 #include <TH1.h> // TH1::AddDirectoryStatus(); 47 47 #include <TClass.h> 48 48 #include <TCanvas.h> … … 51 51 #include "MLogManip.h" 52 52 53 #include "MParContainer.h" // MParContainer::GetClass 53 54 #include "MStatusDisplay.h" 54 55 … … 125 126 } 126 127 127 // FIXME: Move to a general class MMARS (TROOT) and unify with MParContainer128 TClass *MStatusArray::GetClass(const char *name) const129 {130 TClass *cls = gROOT->GetClass(name);131 Int_t rc = 0;132 if (!cls)133 rc =1;134 else135 {136 if (!cls->Property())137 rc = 5;138 if (!cls->Size())139 rc = 4;140 if (!cls->IsLoaded())141 rc = 3;142 if (!cls->HasDefaultConstructor())143 rc = 2;144 }145 146 if (rc==0)147 return cls;148 149 gLog << err << dbginf << "Class '" << name << "' not in dictionary: ";150 switch (rc)151 {152 case 1:153 gLog << "gROOT->GetClass() returned NULL." << endl;154 return NULL;155 case 2:156 gLog << "no default constructor." << endl;157 return NULL;158 case 3:159 gLog << "not loaded." << endl;160 return NULL;161 case 4:162 gLog << "zero size." << endl;163 return NULL;164 case 5:165 gLog << "no property." << endl;166 return NULL;167 }168 169 gLog << "THIS SHOULD NEVER HAPPEN!" << endl;170 171 return 0;172 }173 174 128 TCanvas *MStatusArray::FindCanvas(const char *name) const 175 129 { … … 184 138 TObject *MStatusArray::FindObjectInCanvas(const char *object, const char *base, const char *canvas) const 185 139 { 186 TClass *cls = GetClass(base); 140 gLog << err; 141 TClass *cls = MParContainer::GetClass(base, &gLog); 187 142 if (!cls) 188 143 return 0; -
trunk/MagicSoft/Mars/mbase/MStatusArray.h
r8961 r9026 24 24 void PrintObjectsInPad(const TCollection *list, const TString &name, Int_t lvl=0) const; 25 25 TObject *FindObjectInPad(TVirtualPad *pad, const char *object, TClass *base) const; 26 TClass *GetClass(const char *name) const;27 26 28 27 public: -
trunk/MagicSoft/Mars/mreport/MReportHelp.cc
r4575 r9026 58 58 MReportHelp::MReportHelp(const char *name, MLog *fLog) : fReport(NULL), fNumReports(0), fNumSkipped(0) 59 59 { 60 TClass *cls = gROOT->GetClass(name);61 Int_t rc = 0;62 if (!cls)63 rc =1;64 else65 {66 if (!cls->Property())67 rc = 5;68 if (!cls->Size())69 rc = 4;70 if (!cls->IsLoaded())71 rc = 3;72 if (!cls->HasDefaultConstructor())73 rc = 2;74 }75 76 if (rc)77 {78 *fLog << err << dbginf << "Cannot create new instance of class '" << name << "': ";79 switch (rc)80 {81 case 1:82 *fLog << "gROOT->GetClass() returned NULL." << endl;83 return;84 case 2:85 *fLog << "no default constructor." << endl;86 return;87 case 3:88 *fLog << "not loaded." << endl;89 return;90 case 4:91 *fLog << "zero size." << endl;92 return;93 case 5:94 *fLog << "no property." << endl;95 return;96 }97 }98 99 60 // 100 61 // create the parameter container of the the given class type 101 62 // 102 fReport = (MReport*)cls->New(); 63 *fLog << err; 64 TClass *cls = MParList::GetClass(name, fLog); 65 66 if (cls && cls->InheritsFrom(MReport::Class())) 67 fReport = static_cast<MReport*>(cls->New()); 103 68 } 104 69
Note:
See TracChangeset
for help on using the changeset viewer.