Changeset 9462 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 06/20/09 10:14:33 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MLut.cc
r9318 r9462 70 70 // 71 71 // Check if it is a default lut which would just map every entry to itself 72 // An empty Lut is a default lut73 // 74 Bool_t MLut::IsDefault () const72 // An empty Lut is a default column 73 // 74 Bool_t MLut::IsDefaultCol() const 75 75 { 76 76 if (IsEmpty()) … … 92 92 // Setup a default lut which just maps n-entris to themself 93 93 // 94 void MLut::SetDefault (UInt_t n)94 void MLut::SetDefaultCol(UInt_t n) 95 95 { 96 96 Delete(); … … 106 106 fMinEntries = 1; 107 107 fMaxEntries = 1; 108 109 fMaxIndex = n; 110 } 111 112 // -------------------------------------------------------------------------- 113 // 114 // Check if it is a default lut which would just map all entries to one. 115 // An empty Lut is a default row 116 // 117 Bool_t MLut::IsDefaultRow() const 118 { 119 if (IsEmpty()) 120 return kTRUE; 121 122 if (GetEntriesFast()!=1) 123 return kFALSE; 124 125 const MArrayI &idx = GetRow(0); 126 127 // Loop over all rows 128 for (UInt_t x=0; x<idx.GetSize(); x++) 129 if (UInt_t(idx[x])!=x) 130 return kFALSE; 131 132 return kTRUE; 133 } 134 135 136 // -------------------------------------------------------------------------- 137 // 138 // Setup a default lut which maps all n-entris to one 139 // 140 void MLut::SetDefaultRow(UInt_t n) 141 { 142 Delete(); 143 144 MArrayI &idx = *new MArrayI(n); 145 146 for (UInt_t y=0; y<n; y++) 147 idx[y] = y; 148 149 Add(&idx); 150 151 fMinEntries = n; 152 fMaxEntries = n; 108 153 109 154 fMaxIndex = n; … … 288 333 // Write a lut to a stream. 289 334 // 290 Int_t MLut::WriteStream(ostream &out) 335 Int_t MLut::WriteStream(ostream &out) const 291 336 { 292 337 const Int_t n = GetEntriesFast(); … … 329 374 // Write a lut to a file 330 375 // 331 Int_t MLut::WriteFile(const char *fname) 376 Int_t MLut::WriteFile(const char *fname) const 332 377 { 333 378 TString expname(fname); … … 344 389 return WriteStream(fout); 345 390 } 391 392 void MLut::Print(const Option_t *o) const 393 { 394 gLog << all; 395 WriteStream(gLog); 396 } -
trunk/MagicSoft/Mars/mbase/MLut.h
r9318 r9462 36 36 Bool_t HasConstantLength() const { return fMinEntries==fMaxEntries; } 37 37 Bool_t IsEmpty() const { return fMaxEntries==0; } 38 Bool_t IsDefault() const; 38 Bool_t IsDefaultCol() const; 39 Bool_t IsDefaultRow() const; 39 40 40 41 // MLut conversions … … 43 44 44 45 // Setter 45 void SetDefault(UInt_t n); 46 void SetDefaultCol(UInt_t n); 47 void SetDefaultRow(UInt_t n); 46 48 47 49 // MLut I/O 48 50 Int_t ReadStream(istream &in); 49 Int_t WriteStream(ostream &out) ;51 Int_t WriteStream(ostream &out) const; 50 52 51 53 Int_t ReadFile(const char *fname); 52 Int_t WriteFile(const char *fname); 54 Int_t WriteFile(const char *fname) const; 55 56 // TObject 57 void Print(const Option_t *o="") const; 58 void Print(const Option_t *o, const Option_t *o2) const { Print(o); } 53 59 54 60 ClassDef(MLut, 1) // A simple and fast easy-to-use look-up-table -
trunk/MagicSoft/Mars/mbase/MParList.cc
r9347 r9462 184 184 return kFALSE; 185 185 186 if (cont==this) 187 { 188 *fLog << err << dbginf << "Error: It is not allowed to add a parameter list to itself." << endl; 189 return kFALSE; 190 } 191 186 192 // 187 193 // Get Name of new container … … 223 229 if (!fContainer->FindObject(where)) 224 230 { 225 *fLog << dbginf << "Error: Cannot find parameter container after which the new one should be added!" << endl;231 *fLog << err << dbginf << "Error: Cannot find parameter container after which the new one should be added!" << endl; 226 232 return kFALSE; 227 233 } … … 230 236 if (!cont->InheritsFrom(MParContainer::Class())) 231 237 { 232 *fLog << dbginf << "Error: Cantainer MUST derive from MParContainer!" << endl;238 *fLog << err << dbginf << "Error: Cantainer MUST derive from MParContainer!" << endl; 233 239 return kFALSE; 234 240 }
Note:
See TracChangeset
for help on using the changeset viewer.