cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
1.2.5
Central exclusive processes event generator
Loading...
Searching...
No Matches
cepgenDescribeModules.cc
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2022-2024 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 <fstream>
20
21
#include "
CepGen/Core/Exception.h
"
22
#include "
CepGen/Generator.h
"
23
#include "
CepGen/Modules/DocumentationGeneratorFactory.h
"
24
#include "
CepGen/Utils/ArgumentsParser.h
"
25
#include "
CepGen/Utils/DocumentationGenerator.h
"
26
27
using namespace
std;
28
29
int
main
(
int
argc,
char
* argv[]) {
30
string
doc_generator, output_file;
31
vector<string> addons, categories, modules_names;
32
bool
quiet;
33
cepgen::ArgumentsParser
(argc, argv)
34
.
addOptionalArgument
(
"documentation-generator,D"
,
"type of documentation"
, &doc_generator,
"text"
)
35
.
addOptionalArgument
(
"add-ons,a"
,
"external runtime plugin"
, &addons)
36
.
addOptionalArgument
(
"output,o"
,
"output file"
, &output_file,
""
)
37
.
addOptionalArgument
(
"categories,C"
,
"categories to document"
, &categories, vector<string>{})
38
.addOptionalArgument(
"modules,m"
,
"module names to document"
, &modules_names, vector<string>{})
39
.addOptionalArgument(
"quiet,q"
,
"quiet mode"
, &quiet,
false
)
40
.
parse
();
41
42
if
(quiet)
43
CG_LOG_LEVEL
(nothing);
44
cepgen::initialise
();
45
for
(
const
auto
& lib : addons)
// loading of additional plugins into the runtime environment manager
46
try
{
47
cepgen::loadLibrary
(lib);
48
}
catch
(
const
cepgen::Exception
& e) {
49
e.
dump
();
50
}
51
auto
gen = cepgen::DocumentationGeneratorFactory::get().build(
52
doc_generator,
cepgen::ParametersList
().set(
"categories"
, categories).set(
"modules"
, modules_names));
53
const
auto
documentation = gen->describe();
54
55
if
(output_file.empty()) {
56
if
(quiet)
57
CG_LOG_LEVEL
(information);
58
CG_LOG
<< documentation;
59
}
else
{
60
ofstream of(output_file);
61
of << documentation;
62
of.close();
63
CG_INFO
(
"main"
) <<
"Documentation written in '"
<< output_file <<
"'."
;
64
}
65
66
return
0;
67
}
ArgumentsParser.h
DocumentationGeneratorFactory.h
DocumentationGenerator.h
Exception.h
Generator.h
CG_LOG_LEVEL
#define CG_LOG_LEVEL(type)
Definition
Logger.h:83
CG_LOG
#define CG_LOG
Definition
Message.h:212
CG_INFO
#define CG_INFO(mod)
Definition
Message.h:216
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::Exception
Definition
Exception.h:25
cepgen::Exception::dump
void dump(std::ostream *os=nullptr) const noexcept override
Human-readable dump of the exception.
Definition
Exception.cpp:41
cepgen::ParametersList
Definition
ParametersList.h:52
cepgen::loadLibrary
bool loadLibrary(const std::string &path, bool match)
Import a shared library in RTE Launch the initialisation procedure.
Definition
GlobalFunctions.cpp:42
cepgen::initialise
void initialise(bool safe_mode)
Definition
GlobalFunctions.cpp:91
main
int main()
Definition
pythia6_decay.cc:9
src
utils
cepgenDescribeModules.cc
Generated on Mon Jul 29 2024 for CepGen by
1.9.7