DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
dbe
apps
Main.cpp
Go to the documentation of this file.
1
// DUNE DAQ modification notice:
2
// This file has been modified from the original ATLAS dbe source for the DUNE DAQ project.
3
// Fork baseline commit: dbe-02-12-17 (2022-05-12).
4
// Renamed since fork: yes (from src/Main.cpp to apps/Main.cpp).
5
7
#include "
dbe/MainWindow.hpp
"
8
#include "
dbe/MyApplication.hpp
"
10
#include <QApplication>
12
#include <boost/program_options.hpp>
13
14
#include <memory>
15
16
#include "
dbe/confaccessor.hpp
"
17
#include "
dbe/messenger.hpp
"
18
#include "
dbe/msghandler.hpp
"
19
#include "
dbe/types.hpp
"
20
21
template
class ::lutils::program::msghandler<dbe::interface::messenger::qt>;
22
23
namespace
bop = boost::program_options;
24
25
int
26
main
(
int
argc,
char
* argv[])
27
{
29
setenv(
"LC_ALL"
,
"C"
, 1);
30
31
std::unique_ptr<dbe::MyApplication> myapp(
new
dbe::MyApplication
(argc, argv));
32
33
dbe::confaccessor::init
();
34
35
std::string configv;
36
std::string oksfn;
37
std::string rdbrl;
38
std::string roksrl;
39
QMap<QString, QString> argmap;
40
41
bop::options_description options_description(
"Allowed options"
, 128);
42
43
options_description.add_options()(
"help,h"
,
"Provide help message"
)
44
45
// ("version,v", bop::value<std::string>(&configv)->default_value(configv),
46
// "OKS version to load (when the GIT back-end is used - valid only in file mode)")
47
48
(
"file,f"
, bop::value<std::string>(&oksfn)->default_value(oksfn),
"OKS database file name"
)
49
50
// ("rdb,r", bop::value<std::string>(&rdbrl)->default_value(rdbrl),
51
// "RDB resource locator (e.g. rdbServerName@partitionName)")
52
53
// ("roksrl,o",bop::value<std::string>(&roksrl)->default_value(roksrl),
54
// "ROKS resource locator (e.g. oracle://atlas_oks/r:atlas_oks_archive:<schema version>:<data version>)")
55
;
56
57
bop::variables_map options_map;
58
59
try
{
60
bop::parsed_options parsed =
61
bop::command_line_parser(argc, argv).options(options_description).allow_unregistered().run();
62
63
// This is to properly catch any positional argument (not supported)
64
const
auto
& unknown = bop::collect_unrecognized(parsed.options, bop::include_positional);
65
if
(unknown.size() != 0) {
66
std::cerr <<
"Incorrect command line argument, unrecognized options: "
;
67
for
(
const
auto
& o : unknown) {
68
std::cerr << o <<
" "
;
69
}
70
std::cerr << std::endl;
71
72
return
EXIT_FAILURE;
73
}
74
75
bop::store(parsed, options_map);
76
bop::notify(options_map);
77
78
auto
display_help_message = [&options_description]() {
79
std::cout <<
"DBE: TDAQ online configuration database editor"
<< std::endl
80
<< std::endl
81
<<
"Usage: dbe [options]"
<< std::endl
82
<< std::endl
83
<< options_description << std::endl;
84
};
85
86
if
(options_map.count(
"help"
)) {
87
display_help_message();
88
return
EXIT_SUCCESS;
89
}
90
91
argmap.insert(
"f"
, QString::fromStdString(oksfn));
92
// argmap.insert("r", QString::fromStdString(rdbrl));
93
// argmap.insert("o", QString::fromStdString(roksrl));
94
// argmap.insert("v", QString::fromStdString(configv));
95
96
}
catch
(std::exception
const
& e) {
97
std::cerr <<
"Incorrect command line argument: "
<< e.what() << std::endl;
98
return
EXIT_FAILURE;
99
}
100
101
std::unique_ptr<dbe::MainWindow> window(
new
dbe::MainWindow
(argmap));
102
try
{
103
window->show();
104
return
myapp->exec();
105
}
catch
(std::exception
const
& e) {
106
std::cerr <<
"Exception: "
<< e.what() << std::endl;
107
}
catch
(...) {
108
std::cerr <<
"Unknown Exception"
<< std::endl;
109
}
110
111
return
EXIT_FAILURE;
112
}
MainWindow.hpp
MyApplication.hpp
dbe::MainWindow
Definition
MainWindow.hpp:49
dbe::MyApplication
Definition
MyApplication.hpp:16
dbe::confaccessor::init
static void init()
Definition
confaccessor.cpp:364
confaccessor.hpp
main
int main(int argc, char *argv[])
Definition
emu_confgen.cxx:228
messenger.hpp
msghandler.hpp
types.hpp
Generated on
for DUNE-DAQ by
1.18.0