DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
appfwk
apps
daq_application.cxx
Go to the documentation of this file.
1
9
10
#include "Application.hpp"
11
#include "
CommandLineInterpreter.hpp
"
12
13
#include "
logging/Logging.hpp
"
14
15
#include <csignal>
16
#include <fstream>
17
#include <list>
18
#include <map>
19
#include <memory>
20
#include <string>
21
#include <vector>
22
26
std::atomic<bool>
run_marker
{
true
};
27
31
static
void
32
signal_handler
(
int
signal)
33
{
34
TLOG
() <<
"Signal received: "
<< signal;
35
run_marker
.store(
false
);
36
}
37
38
int
39
main
(
int
argc,
char
* argv[])
40
{
41
42
// Setup signals
43
std::signal(SIGINT,
signal_handler
);
44
std::signal(SIGQUIT,
signal_handler
);
45
46
using namespace
dunedaq
;
47
48
appfwk::CommandLineInterpreter
args;
49
try
{
50
args =
appfwk::CommandLineInterpreter::parse
(argc, argv);
51
}
catch
(bpo::error
const
& e) {
52
// Die but do it gracefully gracefully.
53
std::cerr <<
"Failed to interpret command line: "
<< e.what();
// NOLINT
54
exit(1);
55
}
56
57
if
(args.help_requested) {
58
exit(0);
59
}
60
61
// Enable DUNE-DAQ logging, including TLOG and ERS messages
62
dunedaq::logging::Logging
().
setup
(args.session_name, args.app_name);
63
64
// Create the Application
65
appfwk::Application app(args.app_name,
66
args.session_name,
67
args.command_facility_plugin_name,
68
args.conf_service_plugin_name,
69
args.configuration_id);
70
71
try
{
72
73
app.init();
74
app.run(
run_marker
);
75
}
catch
(
ers::Issue
& e) {
76
ers::fatal
(appfwk::ApplicationFailure(
ERS_HERE
, args.session_name, args.app_name, e));
77
}
78
79
TLOG
() <<
"Application "
<< args.session_name <<
'.'
<< args.app_name <<
" exiting."
;
80
return
0;
81
}
CommandLineInterpreter.hpp
ERS_HERE
#define ERS_HERE
Definition
LocalContext.hpp:141
dunedaq::logging::Logging
The Logger class defines the interface necessary to configure central logging within a DAQ Applicatio...
Definition
Logging.hpp:25
dunedaq::logging::Logging::setup
static void setup(const std::string &session, const std::string &application)
Setup the Logger service Currently no args.
Definition
Logging.hpp:32
ers::Issue
Base class for any user define issue.
Definition
Issue.hpp:80
main
int main(int argc, char *argv[])
Definition
daq_application.cxx:39
signal_handler
static void signal_handler(int signal)
Signal handler for graceful stop.
Definition
daq_application.cxx:32
run_marker
std::atomic< bool > run_marker
Global atomic for process lifetime.
Definition
daq_application.cxx:26
Logging.hpp
TLOG
#define TLOG(...)
Definition
macro.hpp:22
dunedaq
Including Qt Headers.
Definition
module.cpp:16
ers::fatal
void fatal(const Issue &issue)
Definition
ers.hpp:99
dunedaq::appfwk::CommandLineInterpreter
CommandLineInterpreter parses the command-line options given to the application and stores the result...
Definition
CommandLineInterpreter.hpp:32
dunedaq::appfwk::CommandLineInterpreter::parse
static CommandLineInterpreter parse(int argc, char **argv)
Parse the command line and return a CommandLineInterpreter struct.
Definition
CommandLineInterpreter.hpp:40
Generated on
for DUNE-DAQ by
1.17.0