cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
cepgenCmdTester.cc
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2022-2023 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
#include "
CepGen/Core/ParametersDescription.h
"
20
#include "
CepGen/Utils/ArgumentsParser.h
"
21
#include "
CepGen/Utils/Message.h
"
22
#include "
CepGen/Utils/String.h
"
23
#include "
CepGen/Version.h
"
24
25
using namespace
std;
26
27
int
main
(
int
argc,
char
* argv[]) {
28
string
commands;
29
bool
reserialise;
30
cepgen::ArgumentsParser
(argc, argv)
31
.
addOptionalArgument
(
"cmd,c"
,
"list of arguments to be parsed"
, &commands,
""
)
32
.
addOptionalArgument
(
"serial,s"
,
"re-serialise the parsed arguments"
, &reserialise,
false
)
33
.
parse
();
34
35
auto
plist =
cepgen::ParametersList
().
feed
(commands);
36
CG_LOG
<<
"CepGen v"
<<
cepgen::version::tag
<<
" command line arguments parser parsed the following arguments:\n"
37
<<
cepgen::ParametersDescription
(plist);
38
39
if
(reserialise) {
40
const
auto
serialised = plist.serialise();
41
const
auto
col = serialised == commands ?
cepgen::utils::Colour::green
:
cepgen::utils::Colour::yellow
;
42
CG_LOG
<<
"Re-serialised arguments: "
<<
cepgen::utils::colourise
(serialised, col,
cepgen::utils::Modifier::italic
)
43
<<
"."
;
44
}
45
46
return
0;
47
}
ArgumentsParser.h
Message.h
CG_LOG
#define CG_LOG
Definition
Message.h:212
ParametersDescription.h
String.h
Version.h
cepgen::ArgumentsParser
A generic command line arguments parser.
Definition
ArgumentsParser.h:31
cepgen::ArgumentsParser::parse
ArgumentsParser & parse()
Associate command-line arguments to parameters.
Definition
ArgumentsParser.cpp:106
cepgen::ArgumentsParser::addOptionalArgument
ArgumentsParser & addOptionalArgument(Args &&... args)
Add a non-mandatory parameters that can be parsed.
Definition
ArgumentsParser.h:46
cepgen::ParametersDescription
A description object for parameters collection.
Definition
ParametersDescription.h:26
cepgen::ParametersList
Definition
ParametersList.h:52
cepgen::ParametersList::feed
ParametersList & feed(const std::string &)
Feed a control string to the list of parameters.
Definition
ParametersList.cpp:161
cepgen::utils::Modifier::italic
@ italic
cepgen::utils::Colour::green
@ green
cepgen::utils::Colour::yellow
@ yellow
cepgen::utils::colourise
std::string colourise(const std::string &str, const Colour &col, const Modifier &mod)
Colourise a string for TTY-type output streams.
Definition
String.cpp:70
main
int main()
Definition
pythia6_decay.cc:9
cepgen::version::tag
static const std::string tag
CepGen version.
Definition
Version.h:28
src
utils
cepgenCmdTester.cc
Generated on Mon Jul 29 2024 for CepGen by
1.9.7