Marlin
01.17.01
|
Simple parser class for Marlin. More...
#include <Parser.h>
Public Member Functions | |
Parser (const std::string &fileName) | |
virtual | ~Parser () |
std::shared_ptr< StringParameters > | getParameters (const std::string §ionName) const |
Return the StringParameters defined for this section of the steering file. More... | |
void | setCmdLineParameters (const CommandLineParametersMap &) |
set command line parameters More... | |
void | parse () |
Parse the input file. More... | |
void | write (const std::string &fname) const |
Write down the parsed file in a new file. More... | |
![]() | |
virtual | ~IParser () |
Protected Member Functions | |
int | readNextValidLine (std::string &str, std::istream &stream) |
Helper method that reads the next line from a stream that is not empty or starts with a '#'. More... | |
Protected Attributes | |
StringParametersMap | _map {} |
StringParameters * | _current |
std::string | _fileName |
Private Member Functions | |
Parser ()=delete | |
Parser (const marlin::Parser &)=delete | |
Parser & | operator= (const marlin::Parser &)=delete |
Simple parser class for Marlin.
Creates Parameter objects for all sections in a steering file defined by enclosing
.begin SectionName
.end
Parameters are defined for every line that doesn't start with #. The first string is the name of the parameter (key) the rest of the line is interpreted as the list of values separated by whitespace. Values from multiple lines starting with the same name/key are appended to the corresponding list.
marlin::Parser::Parser | ( | const std::string & | fileName | ) |
|
privatedelete |
|
privatedelete |
|
virtual |
Return the StringParameters defined for this section of the steering file.
Implements marlin::IParser.
Definition at line 113 of file Parser.cc.
References _map, std::map< K, T >::begin(), and std::map< K, T >::end().
Referenced by createProcessors().
|
privatedelete |
|
virtual |
Parse the input file.
Implements marlin::IParser.
Definition at line 16 of file Parser.cc.
References _current, _fileName, _map, marlin::StringParameters::add(), std::string::begin(), std::map< K, T >::begin(), std::string::c_str(), std::map< K, T >::end(), std::string::end(), std::endl(), std::for_each(), marlin::StringParameters::getStringVal(), std::vector< T >::push_back(), readNextValidLine(), std::vector< T >::size(), and std::string::size().
|
protected |
Helper method that reads the next line from a stream that is not empty or starts with a '#'.
Definition at line 132 of file Parser.cc.
References std::istream::eof(), and std::string::length().
Referenced by parse().
|
inlinevirtual |
|
virtual |
Write down the parsed file in a new file.
For this implementation, just copy paste the steering file
Implements marlin::IParser.
Definition at line 163 of file Parser.cc.
References _fileName, std::string::c_str(), and std::endl().
|
protected |
|
protected |
|
mutableprotected |
Definition at line 72 of file Parser.h.
Referenced by getParameters(), and parse().