cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
N/A
Central exclusive processes event generator
Toggle main menu visibility
Main Page
Related Pages
Packages
Package List
Package Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
x
y
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
x
y
Variables
Typedefs
Enumerations
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Enumerations
Enumerator
b
c
d
e
g
h
i
l
m
n
p
r
t
u
w
x
y
z
Related Symbols
d
g
h
o
u
v
Files
File List
File Members
All
_
a
b
c
d
e
h
o
p
r
s
Functions
Variables
Macros
_
b
c
d
e
p
r
s
▼
CepGen
Reference manual
Bibliography
►
Packages
►
Classes
▼
Files
▼
File List
▼
include
▼
CepGen
►
Cards
►
Core
►
Event
►
EventFilter
►
FormFactors
►
Integration
►
Modules
►
PartonFluxes
►
Physics
►
Process
►
StructureFunctions
▼
Utils
►
AbortHandler.h
►
Algebra.h
►
ArgumentsParser.h
►
Caller.h
►
Collections.h
►
Derivator.h
►
DocumentationGenerator.h
►
Drawable.h
►
Drawer.h
►
Environment.h
►
EventUtils.h
►
Filesystem.h
►
Functional.h
►
FunctionWrapper.h
►
Graph.h
►
GridDrawer.h
►
GridHandler.h
►
GSLFunctionWrapper.h
►
GSLMonteFunctionWrapper.h
►
Hasher.h
►
Histogram.h
►
Limits.h
►
Logger.h
►
Math.h
►
Message.h
►
Piper.h
►
ProcessVariablesAnalyser.h
►
ProgressBar.h
►
RandomGenerator.h
►
StreamCollector.h
►
String.h
►
Test.h
►
TimeKeeper.h
►
Timer.h
►
Value.h
►
Generator.h
►
Version.h
►
CepGenBoost
►
CepGenHepMC2
►
CepGenHepMC3
►
CepGenHerwig6
►
CepGenMadGraph
►
CepGenPythia6
►
CepGenPythia8
►
CepGenPython
►
CepGenRoot
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
ArgumentsParser.h
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2019-2025 Laurent Forthomme
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef CepGen_Utils_ArgumentsParser_h
20
#define CepGen_Utils_ArgumentsParser_h
21
22
#include <string>
23
24
#include "
CepGen/Utils/Limits.h
"
25
26
namespace
cepgen
{
30
class
ArgumentsParser
{
31
public
:
35
explicit
ArgumentsParser
(
int
argc,
char
* argv[]);
37
template
<
typename
... Args>
38
inline
ArgumentsParser
&
addArgument
(Args&&... args) {
39
params_.emplace_back(std::forward<Args>(args)...);
40
params_.rbegin()->optional =
false
;
41
return
*
this
;
42
}
38
inline
ArgumentsParser
&
addArgument
(Args&&... args) {
…
}
44
template
<
typename
... Args>
45
inline
ArgumentsParser
&
addOptionalArgument
(Args&&... args) {
46
params_.emplace_back(std::forward<Args>(args)...);
47
params_.rbegin()->optional =
true
;
48
return
*
this
;
49
}
45
inline
ArgumentsParser
&
addOptionalArgument
(Args&&... args) {
…
}
50
ArgumentsParser
&
parse
();
51
std::string
operator[]
(
const
std::string& name)
const
;
52
void
dump
()
const
;
53
void
print_help
()
const
;
54
static
void
print_version
();
55
std::string
help_message
()
const
;
56
inline
bool
debugging
()
const
{
return
debug_req_; }
57
inline
const
std::vector<std::string>&
extra_config
()
const
{
return
extra_config_; }
58
59
private
:
61
class
Parameter {
62
public
:
63
explicit
Parameter(
const
std::string&,
64
const
std::string& =
""
,
65
std::string* =
nullptr
,
66
const
std::string& =
""
);
67
explicit
Parameter(
const
std::string&,
68
const
std::string&,
69
unsigned
int
* =
nullptr
,
70
const
unsigned
int
& = 0);
71
explicit
Parameter(
const
std::string&,
72
const
std::string&,
73
int
* =
nullptr
,
74
const
int
& = 0);
75
explicit
Parameter(
const
std::string&,
76
const
std::string&,
77
bool
* =
nullptr
,
78
const
bool
& =
false
);
79
explicit
Parameter(
const
std::string&,
80
const
std::string&,
81
double
* =
nullptr
,
82
const
double
& = -999.999);
83
explicit
Parameter(
const
std::string&,
84
const
std::string&,
85
std::vector<std::string>* =
nullptr
,
86
const
std::vector<std::string>& = {});
87
explicit
Parameter(
const
std::string&,
88
const
std::string&,
89
std::vector<int>* =
nullptr
,
90
const
std::vector<int>& = {});
91
explicit
Parameter(
const
std::string&,
92
const
std::string&,
93
std::vector<double>* =
nullptr
,
94
const
std::vector<double>& = {});
95
explicit
Parameter(
const
std::string&,
96
const
std::string&,
97
Limits* =
nullptr
,
98
const
Limits& = Limits{});
99
100
Parameter& parse();
101
inline
bool
boolean()
const
{
return
bool_variable_ !=
nullptr
; }
102
bool
matches(
const
std::string&)
const
;
103
104
// parameters attributes
105
std::vector<std::string> name;
106
std::string description;
107
std::string value;
108
bool
optional{
true
};
109
110
private
:
111
// parameters containers
112
std::string* str_variable_{
nullptr
};
113
double
* float_variable_{
nullptr
};
114
int
* int_variable_{
nullptr
};
115
unsigned
int
* uint_variable_{
nullptr
};
116
bool
* bool_variable_{
nullptr
};
117
Limits* lim_variable_{
nullptr
};
118
std::vector<std::string>* vec_str_variable_{
nullptr
};
119
std::vector<int>* vec_int_variable_{
nullptr
};
120
std::vector<double>* vec_float_variable_{
nullptr
};
121
};
122
using
ParametersCollection = std::vector<Parameter>;
123
124
const
std::string command_name_;
125
bool
help_req_{
false
}, version_req_{
false
}, debug_req_{
false
};
126
ParametersCollection params_;
127
std::vector<std::pair<std::string, std::string> > args_;
128
std::vector<std::string> add_ons_;
129
std::vector<std::string> extra_config_;
130
};
131
}
// namespace cepgen
132
133
#endif
57
inline
const
std::vector<std::string>&
extra_config
()
const
{
return
extra_config_; } {
…
}
30
class
ArgumentsParser
{
…
};
Limits.h
cepgen::ArgumentsParser
A generic command line arguments parser.
Definition
ArgumentsParser.h:30
cepgen::ArgumentsParser::extra_config
const std::vector< std::string > & extra_config() const
Extra config flags.
Definition
ArgumentsParser.h:57
cepgen::ArgumentsParser::debugging
bool debugging() const
Is the debugging flag set?
Definition
ArgumentsParser.h:56
cepgen::ArgumentsParser::ArgumentsParser
ArgumentsParser(int argc, char *argv[])
Arguments parser constructor.
cepgen::ArgumentsParser::addArgument
ArgumentsParser & addArgument(Args &&... args)
Add a parameter required for the parser.
Definition
ArgumentsParser.h:38
cepgen::ArgumentsParser::operator[]
std::string operator[](const std::string &name) const
Read required and optional parameters.
cepgen::ArgumentsParser::print_version
static void print_version()
Show version.
cepgen::ArgumentsParser::parse
ArgumentsParser & parse()
Associate command-line arguments to parameters.
cepgen::ArgumentsParser::print_help
void print_help() const
Show usage.
cepgen::ArgumentsParser::help_message
std::string help_message() const
Usage message.
cepgen::ArgumentsParser::addOptionalArgument
ArgumentsParser & addOptionalArgument(Args &&... args)
Add a non-mandatory parameters that can be parsed.
Definition
ArgumentsParser.h:45
cepgen::ArgumentsParser::dump
void dump() const
Dump the list of arguments into the terminal.
cepgen
Common namespace for this Monte Carlo generator.
Definition
Handler.h:26
include
CepGen
Utils
ArgumentsParser.h
Generated on Tue Apr 22 2025 for CepGen by
1.10.0