Changeset 3788 for trunk/MagicSoft/Mars/mdata
- Timestamp:
- 04/21/04 15:38:08 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mdata
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mdata/MDataChain.cc
r3666 r3788 45 45 // "MCameraLV.fPowerSupplyA.fVoltagePos5V" 46 46 // 47 // You can also use brackets:47 // You can also use parantheses: 48 48 // "HillasDource.fDist / (MHillas.fLength + MHillas.fWidth)" 49 49 // … … 57 57 // While a^b returns a to the power of b 58 58 // 59 // Warning: There is no priority rule build in. So better use brackets59 // Warning: There is no priority rule build in. So better use parantheses 60 60 // to get correct results. The rule is parsed/evaluated from the left 61 61 // to the right, which means: … … 158 158 // - The possibility to use other objects inheriting from MData 159 159 // is missing. 160 // - By automatic pre-adding brackets to the rule it would be possible160 // - By automatic pre-adding parantheses to the rule it would be possible 161 161 // to implement priorities for operators. 162 162 // … … 365 365 } 366 366 367 void MDataChain::SimplifyString(TString &txt) const 368 { 369 while (txt.First("--")>=0 || txt.First("++")>=0 || 370 txt.First("+-")>=0 || txt.First("-+")>=0) 371 { 372 txt.ReplaceAll("--", "+"); 373 txt.ReplaceAll("++", "+"); 374 txt.ReplaceAll("-+", "-"); 375 txt.ReplaceAll("+-", "-"); 376 } 377 } 378 367 379 // -------------------------------------------------------------------------- 368 380 // … … 371 383 MData *MDataChain::ParseString(TString txt, Int_t level) 372 384 { 385 if (level==0) 386 SimplifyString(txt); 387 373 388 MData *member0=NULL; 374 389 … … 387 402 { 388 403 // 389 // Search for the corresponding bracket 390 // 391 Int_t first=GetBracket(txt, '(', ')'); 392 404 // Search for the corresponding parantheses 405 // 406 const Int_t first=GetBracket(txt, '(', ')'); 393 407 if (first==txt.Length()) 394 408 { … … 400 414 401 415 // 402 // Make a copy of the 'interieur' and delete the substring ä416 // Make a copy of the 'interieur' and delete the substring 403 417 // including the brackets 404 418 // … … 462 476 if (txt[0]!='-' && txt[0]!='+') 463 477 { 464 *fLog << err << dbginf << "Syntax Error: First argument of symbol'";465 *fLog << txt[0] << "' missing." << endl;478 *fLog << err << dbginf << "Syntax Error: First argument of '"; 479 *fLog << txt[0] << "' opartor missing." << endl; 466 480 if (member0) 467 481 delete member0; -
trunk/MagicSoft/Mars/mdata/MDataChain.h
r3666 r3788 44 44 Int_t GetBracket(TString txt, char open, char close); 45 45 46 void SimplifyString(TString &txt) const; 46 47 MData *ParseString(TString txt, Int_t level); 47 48 MData *ParseDataMember(TString txt);
Note:
See TracChangeset
for help on using the changeset viewer.