![]() |
AliRoot Core
3dc7879 (3dc7879)
|
Class provides flexibility static methods for tokenizing strings. You can find explanation, details and examples in description of each function. More...
#include <AliParser.h>
Static Public Member Functions | |
static std::vector< TString > | ExtractBetween (const char *inputString, const char *startStr, const char *endStr, Int_t verbose=0) |
Extracts content between specified patterns (startStr, endStr). More... | |
static std::vector< TString > | Split (const char *inputString, const char delimiter=',', Int_t verbose=0) |
Splits input string to array according to specified char delimiter. More... | |
static std::vector< TString > | ExtractSurroundingBy (const char *inputString, const char begin='(', const char end= ')', Int_t verbose=0) |
Extracts content from specified parentheses. More... | |
static std::map< TString, TString > | Parse (const char *inputString, Int_t verbose=0, std::vector< TString > defKeys=std::vector< TString >{}) |
Parses string with named arguments. More... | |
static std::vector< Int_t > | Slice2IArray (const char *inputString) |
Returns array according with python-like interface. More... | |
static TMatrixD | Slice2Matrix (const char *inputString, Int_t verbose=0) |
Returns TMatrixD from input string. More... | |
static void | Map2Array (std::vector< Double_t > &array, std::map< Int_t, std::vector< Double_t > > iRanges, Int_t *indexes, Int_t cnt) |
static void | FillFloatFlagArray (std::vector< Double_t > &, TString) |
Class provides flexibility static methods for tokenizing strings. You can find explanation, details and examples in description of each function.
Definition at line 21 of file AliParser.h.
|
static |
Extracts content between specified patterns (startStr, endStr).
The analogue of this method exists in matlab
str | - input string |
startStr | - start pattern |
endStr | - end pattern |
verbose |
Example usage:
Definition at line 40 of file AliParser.cxx.
Referenced by AliParserTest_ExtractBetween(), and AliPainter::GetStatVal().
|
static |
Extracts content from specified parentheses.
The similar method exist in java library from google - guava Template of input string: <(content1)(content2(content3))> ==> {content1,content2(content3)} This function very similar to AliParser::ExtractBetween. The differences:
inpString | |
begin | - by default - '(' |
end | - by default - ')' |
verbose |
Definition at line 132 of file AliParser.cxx.
Referenced by AliParserTest_ExtractSurroundingBy(), AliPainter::DrawHistogram(), and AliPainter::PrepareHistogram().
|
static |
floatFlagArray | |
str |
Definition at line 381 of file AliParser.cxx.
Referenced by Slice2Matrix().
|
static |
array | |
iRanges | |
indexes | |
cnt |
Definition at line 354 of file AliParser.cxx.
Referenced by Slice2Matrix().
|
static |
Parses string with named arguments.
Template of input string: <nameOfArg1=value1,nameOfArg2=value2,nameOfArg3=[value3.1,value3.2]...> In some cases could be useful usage of named parameters. You can study more information in python argparse module.
optionsStr | - input string |
verbose | |
defKeys | - the list of predefined keys, if parsed key will not found in this list - warning'll be generate. |
Example usage:
Definition at line 190 of file AliParser.cxx.
Referenced by AliParserTest_Parse(), AliPainter::DrawHistogram(), and AliPainter::PrepareHistogram().
|
static |
Returns array according with python-like interface.
In python for getting values from array, you can use ":" see python docs Here we provide the same functionality, but output array will generate from string.
range |
Example usage:
Definition at line 228 of file AliParser.cxx.
Referenced by AliParserTest_Slice2IArray(), and Slice2Matrix().
|
static |
Returns TMatrixD from input string.
The idea is providing method for generating values of ranges with slicer: Such string "10,20,30:60:10:10,70:110:10:10" should be transform to the next map:
axisNum | 0 | 1 | 2 |
---|---|---|---|
values | 10 | 30 | 70 |
20 | 40 | 80 | |
40 | 80 | ||
50 | 90 | ||
50 | 90 | ||
60 | 100 | ||
100 | |||
110 |
And then such map will be transform to the matrix:
nCols - (count of axes) * 2
nRows - 1 + multiplication of sizes of each array from map divided by 2
last row - floatFlag of each column. In case float flag is 1 SetRangeUser will be applied else SetRange
x0Min | x0Max | x1Min | x1Max | x2Min | x2Max |
---|---|---|---|---|---|
10 | 20 | 30 | 40 | 70 | 80 |
10 | 20 | 30 | 40 | 80 | 90 |
10 | 20 | 30 | 40 | 90 | 100 |
10 | 20 | 30 | 40 | 100 | 110 |
10 | 20 | 40 | 50 | 70 | 80 |
10 | 20 | 40 | 50 | 80 | 90 |
10 | 20 | 40 | 50 | 90 | 100 |
10 | 20 | 40 | 50 | 100 | 110 |
10 | 20 | 50 | 60 | 70 | 80 |
10 | 20 | 50 | 60 | 80 | 90 |
10 | 20 | 50 | 60 | 90 | 100 |
10 | 20 | 50 | 60 | 100 | 110 |
0 | 0 | 0 | 0 | 0 | 0 |
inputString | - string for transforming |
verbose |
Example usage:
Definition at line 300 of file AliParser.cxx.
Referenced by AliParserTest_Slice2Matrix(), and AliPainter::SliceHistogram().
|
static |
Splits input string to array according to specified char delimiter.
Widespread function in popular languages like python, or javascript. The main difference our method from aforementioned is ignoring specified delimiter inside of such - "(){}[]<>" brackets. Template of input string: <value1|delimiter|value2(value2.1|delimiter|value2.2)> ==> {value1,value2(value2.1|delimiter|value2.2)}
inputExpr | - input string |
del | - delimiter. by default - ',' |
verbose |
Example usage:
Definition at line 81 of file AliParser.cxx.
Referenced by AliParserTest_Split(), AliPainter::FitHistogram(), Parse(), AliPainter::SetProjections(), Slice2IArray(), and Slice2Matrix().