DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
daq_application.cxx
Go to the documentation of this file.
1
10#include "Application.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
26std::atomic<bool> run_marker{ true };
27
31static void
32signal_handler(int signal)
33{
34 TLOG() << "Signal received: " << signal;
35 run_marker.store(false);
36}
37
38int
39main(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
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}
#define ERS_HERE
The Logger class defines the interface necessary to configure central logging within a DAQ Applicatio...
Definition Logging.hpp:25
static void setup(const std::string &session, const std::string &application)
Setup the Logger service Currently no args.
Definition Logging.hpp:32
Base class for any user define issue.
Definition Issue.hpp:69
int main(int argc, char *argv[])
static void signal_handler(int signal)
Signal handler for graceful stop.
std::atomic< bool > run_marker
Global atomic for process lifetime.
#define TLOG(...)
Definition macro.hpp:22
Including Qt Headers.
void fatal(const Issue &issue)
Definition ers.hpp:88
CommandLineInterpreter parses the command-line options given to the application and stores the result...