DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
appfwk
src
Application.hpp
Go to the documentation of this file.
1
8
9
#ifndef APPFWK_SRC_APPLICATION_HPP_
10
#define APPFWK_SRC_APPLICATION_HPP_
11
12
// appfwk Includes
13
#include "
ConfigurationManagerOwner.hpp
"
14
#include "
DAQModuleManager.hpp
"
15
#include "
appfwk/cmd/Structs.hpp
"
16
17
// DUNE-DAQ includes
18
#include "
cmdlib/CommandFacility.hpp
"
19
#include "
cmdlib/CommandedObject.hpp
"
20
#include "
logging/Logging.hpp
"
// NOTE: if ISSUES ARE DECLARED BEFORE include logging/Logging.hpp, TLOG_DEBUG<<issue wont work.
21
#include "
opmonlib/OpMonManager.hpp
"
22
#include "
rcif/opmon/run_info.pb.h
"
23
#include "
utilities/NamedObject.hpp
"
24
25
// External libraries
26
#include "nlohmann/json.hpp"
27
28
// C++ includes
29
#include <atomic>
30
#include <chrono>
31
#include <memory>
32
#include <mutex>
33
#include <string>
34
35
namespace
dunedaq
{
36
37
// Disable coverage collection LCOV_EXCL_START
38
39
ERS_DECLARE_ISSUE
(
appfwk
,
40
ApplicationNotInitialized,
41
"Application "
<< name <<
" has not been initialized yet."
,
42
((std::string)name))
43
44
ERS_DECLARE_ISSUE
(
appfwk
,
45
InvalidStateForCommand
,
46
"Command "
<< cmdid <<
" not allowed at this time. state: "
<< state <<
", error: "
<< err
47
<<
", busy: "
<< busy,
48
((std::string)cmdid)((std::string)state)((
bool
)err)((
bool
)busy))
// NOLINT
49
50
ERS_DECLARE_ISSUE
(
appfwk
,
51
ApplicationFailure,
52
"Application "
<< application <<
" in session "
<<
session
<<
" failed"
,
53
((std::string)
session
)((std::string)application))
54
55
// Re-enable coverage collection LCOV_EXCL_STOP
56
57
namespace
appfwk
{
58
59
class
Application
60
:
public
ConfigurationManagerOwner
61
,
public
cmdlib::CommandedObject
62
,
public
opmonlib::OpMonManager
63
,
public
utilities::NamedObject
64
{
65
public
:
66
using
dataobj_t = nlohmann::json;
67
68
Application(std::string app_name,
69
std::string session_name,
70
std::string cmdlibimpl,
71
std::string confimpl,
72
std::string configuration_id);
73
74
void
init
();
75
76
void
run
(std::atomic<bool>& end_marker);
77
78
void
execute(
const
dataobj_t& cmd_data)
override
;
79
80
bool
check_state_for_cmd(
const
dataobj_t& cmd_data)
const
;
81
82
void
generate_opmon_data()
override
;
83
84
void
set_state(std::string s)
85
{
86
const
std::lock_guard<std::mutex> lock(m_mutex);
87
m_state = s;
88
}
89
std::string get_state()
const
90
{
91
const
std::lock_guard<std::mutex> lock(m_mutex);
92
return
m_state;
93
}
94
95
protected
:
96
void
publish_app_info();
97
98
private
:
99
DAQModuleManager m_mod_mgr;
100
mutable
std::mutex m_mutex;
101
std::string m_state;
102
std::atomic<bool> m_busy;
103
std::atomic<bool> m_error;
104
bool
m_initialized;
105
std::chrono::time_point<std::chrono::steady_clock> m_run_start_time;
106
dunedaq::rcif::opmon::RunInfo
m_runinfo;
107
std::shared_ptr<cmdlib::CommandFacility> m_cmd_fac;
108
};
109
110
}
// namespace appfwk
111
}
// namespace dunedaq
112
113
#endif
// APPFWK_SRC_APPLICATION_HPP_
CommandFacility.hpp
CommandedObject.hpp
ConfigurationManagerOwner.hpp
DAQModuleManager.hpp
NamedObject.hpp
OpMonManager.hpp
Structs.hpp
dunedaq::cmdlib::CommandedObject
Interface needed by commanded objects in the DAQ.
Definition
CommandedObject.hpp:21
dunedaq::opmonlib::OpMonManager
Definition
OpMonManager.hpp:50
dunedaq::rcif::opmon::RunInfo
Definition
run_info.pb.h:80
dunedaq::utilities::NamedObject
Implements the Named interface.
Definition
NamedObject.hpp:44
init
void init(unordered_map< std::string, std::string > params)
Definition
conversions-impl.hh:30
run
static volatile sig_atomic_t run
Definition
kafka_opmon_consumer.cxx:38
Logging.hpp
ERS_DECLARE_ISSUE
#define ERS_DECLARE_ISSUE( namespace_name, class_name, message_, attributes)
Definition
macro.hpp:65
appfwk
Definition
__init__.py:1
dunedaq
Including Qt Headers.
Definition
module.cpp:16
dunedaq::InvalidStateForCommand
InvalidStateForCommand
Definition
Application.hpp:45
session
Definition
session.py:1
run_info.pb.h
Generated on
for DUNE-DAQ by
1.17.0