Skip to content

Commit

Permalink
Marlin command line arguments: only split up to the first dot
Browse files Browse the repository at this point in the history
allows for changing LCFIPlus like parameters on the commandline
JetVertexAndRefiner.JetClustering
  • Loading branch information
andresailer authored and gaede committed Mar 5, 2019
1 parent ccd4e80 commit a3a59d2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions source/include/marlin/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,18 @@ class LCTokenizer{
std::vector< std::string >& _tokens ;
char _del ;
char _last ;
size_t _max ;
public:

LCTokenizer( std::vector< std::string >& tokens, char del ) : _tokens(tokens) , _del(del), _last(del) {
LCTokenizer( std::vector< std::string >& tokens, char del, size_t max=-1 ) : _tokens(tokens) , _del(del), _last(del), _max(max) {
}


void operator()(const char& c) {

if( c != _del ) {
if( c != _del or _tokens.size() >= _max ) {

if( _last == _del ) {
if( _last == _del and _tokens.size() < _max ) {
_tokens.push_back("") ;
}
_tokens.back() += c ;
Expand Down
7 changes: 4 additions & 3 deletions source/include/marlin/XMLParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,18 @@ namespace marlin{
std::vector< std::string >& _tokens ;
char _del ;
char _last ;
size_t _max ;
public:

LCTokenizer( std::vector< std::string >& tokens, char del ) : _tokens(tokens) , _del(del), _last(del) {
LCTokenizer( std::vector< std::string >& tokens, char del, size_t max=-1 ) : _tokens(tokens) , _del(del), _last(del), _max(max) {
}


void operator()(const char& c) {

if( c != _del ) {
if( c != _del or _tokens.size() >= _max ) {

if( _last == _del ) {
if( _last == _del and _tokens.size() < _max ) {
_tokens.push_back("") ;
}
_tokens.back() += c ;
Expand Down
2 changes: 1 addition & 1 deletion source/src/Marlin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ int main(int argc, char** argv ){
// split first arg by '.'
// --global.LCIOInputFiles --> global , LCIOInputFiles
s = cmdlinearg[0] ;
LCTokenizer t2( cmdlinekey, '.' ) ;
LCTokenizer t2( cmdlinekey, '.', 2 ) ;

for_each( s.begin(), s.end(), t2 ) ;

Expand Down

0 comments on commit a3a59d2

Please sign in to comment.