cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
ArgumentsParser Class Reference

A generic command line arguments parser. More...

#include <CepGen/Utils/ArgumentsParser.h>

Public Member Functions

 ArgumentsParser (int argc, char *argv[])
 Arguments parser constructor.
 
template<typename... Args>
ArgumentsParseraddArgument (Args &&... args)
 Add a parameter required for the parser.
 
template<typename... Args>
ArgumentsParseraddOptionalArgument (Args &&... args)
 Add a non-mandatory parameters that can be parsed.
 
ArgumentsParserparse ()
 Associate command-line arguments to parameters.
 
std::string operator[] (std::string name) const
 Read required and optional parameters.
 
void dump () const
 Dump the list of arguments into the terminal.
 
void print_help () const
 Show usage.
 
void print_version () const
 Show version.
 
std::string help_message () const
 Usage message.
 
bool debugging () const
 Is the debugging flag set? Extra configuration flags in arguments?
 
const std::vector< std::string > & extra_config () const
 

Detailed Description

Author
Laurent Forthomme
Date
Nov 2017

Definition at line 31 of file ArgumentsParser.h.

Constructor & Destructor Documentation

◆ ArgumentsParser()

ArgumentsParser ( int  argc,
char *  argv[] 
)
Parameters
[in]argcNumber of argument words (key + value) to be parsed
[in]argv[]List of argument words (key + value) to be parsed

Definition at line 31 of file ArgumentsParser.cpp.

Member Function Documentation

◆ addArgument()

template<typename... Args>
ArgumentsParser & addArgument ( Args &&...  args)

Definition at line 39 of file ArgumentsParser.h.

◆ addOptionalArgument()

template<typename... Args>
ArgumentsParser & addOptionalArgument ( Args &&...  args)

Definition at line 46 of file ArgumentsParser.h.

◆ debugging()

bool debugging ( ) const

Definition at line 57 of file ArgumentsParser.h.

◆ dump()

void dump ( ) const

Definition at line 97 of file ArgumentsParser.cpp.

◆ extra_config()

const std::vector< std::string > & extra_config ( ) const

Definition at line 59 of file ArgumentsParser.h.

◆ help_message()

std::string help_message ( ) const

Definition at line 170 of file ArgumentsParser.cpp.

◆ operator[]()

std::string operator[] ( std::string  name) const

Definition at line 159 of file ArgumentsParser.cpp.

◆ parse()

ArgumentsParser & parse ( )

Definition at line 106 of file ArgumentsParser.cpp.

◆ print_help()

void print_help ( ) const

Definition at line 93 of file ArgumentsParser.cpp.

◆ print_version()

void print_version ( ) const

Definition at line 95 of file ArgumentsParser.cpp.