9#ifndef APPFWK_SRC_APPLICATION_HPP_
10#define APPFWK_SRC_APPLICATION_HPP_
26#include "nlohmann/json.hpp"
40 ApplicationNotInitialized,
41 "Application " << name <<
" has not been initialized yet.",
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))
52 "Application " << application <<
" in session " <<
session <<
" failed",
53 ((std::string)
session)((std::string)application))
60 :
public ConfigurationManagerOwner
66 using dataobj_t = nlohmann::json;
68 Application(std::string app_name,
69 std::string session_name,
70 std::string cmdlibimpl,
72 std::string configuration_id);
76 void run(std::atomic<bool>& end_marker);
78 void execute(
const dataobj_t& cmd_data)
override;
80 bool check_state_for_cmd(
const dataobj_t& cmd_data)
const;
82 void generate_opmon_data()
override;
84 void set_state(std::string s)
86 const std::lock_guard<std::mutex> lock(m_mutex);
89 std::string get_state()
const
91 const std::lock_guard<std::mutex> lock(m_mutex);
96 DAQModuleManager m_mod_mgr;
97 mutable std::mutex m_mutex;
99 std::atomic<bool> m_busy;
100 std::atomic<bool> m_error;
102 std::chrono::time_point<std::chrono::steady_clock> m_run_start_time;
104 std::shared_ptr<cmdlib::CommandFacility> m_cmd_fac;
#define ERS_DECLARE_ISSUE(namespace_name, class_name, message, attributes)
Interface needed by commanded objects in the DAQ.
Implements the Named interface.
void init(unordered_map< std::string, std::string > params)
static volatile sig_atomic_t run