DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
WIBSettings.cpp
Go to the documentation of this file.
4#include "conffwk/Errors.hpp"
6
7#include "logging/Logging.hpp"
8
9 // include files for classes used in relationships and algorithms
10
14
15
16namespace dunedaq {
17 namespace appmodel {
18 const std::string& WIBSettings::s_class_name(dunedaq::conffwk::DalFactory::instance().get_known_class_name_ref("WIBSettings"));
19
20 // the factory initializer
21
23 {
25 {
26 dunedaq::conffwk::DalFactory::instance().register_dal_class<WIBSettings>("WIBSettings");
27 }
29
30
31 // the constructor
32
35 m_femb0 (nullptr),
36 m_femb1 (nullptr),
37 m_femb2 (nullptr),
38 m_femb3 (nullptr),
39 m_coldadc_settings (nullptr),
40 m_wib_pulser (nullptr)
41
42 {
43 ;
44 }
45
46
47 void WIBSettings::print(unsigned int indent, bool print_header, std::ostream& s) const
48 {
49 check_init();
50
51 try {
52 const std::string str(indent+2, ' ');
53
54 if (print_header)
55 p_hdr(s, indent, s_class_name, "dunedaq::appmodel");
56
57
58 // print direct attributes
59
64
65
66 // print direct relationships
67
74 }
75 catch (dunedaq::conffwk::Exception & ex) {
77 }
78 }
79
80
103
105 {
106 }
107
108 std::vector<const dunedaq::conffwk::DalObject *> WIBSettings::get(const std::string& name, bool upcast_unregistered) const
109 {
110 std::vector<const dunedaq::conffwk::DalObject *> vec;
111
112 if (!get(name, vec, upcast_unregistered, true))
113 throw_get_ex(name, s_class_name, this);
114
115 return vec;
116 }
117
118 bool WIBSettings::get(const std::string& name, std::vector<const dunedaq::conffwk::DalObject *>& vec, bool upcast_unregistered, bool first_call) const
119 {
120 if (first_call)
121 {
122 std::lock_guard scoped_lock(m_mutex);
123
124 check();
125 check_init();
126
127 if (get_rel_objects(name, upcast_unregistered, vec))
128 return true;
129 }
130
131 if (first_call)
132 return get_algo_objects(name, vec);
133
134 return false;
135 }
136
138 {
139 _set_object(s_femb0, value);
140 }
141
143 {
144 _set_object(s_femb1, value);
145 }
146
148 {
149 _set_object(s_femb2, value);
150 }
151
153 {
154 _set_object(s_femb3, value);
155 }
156
161
166
167 }
168}
static const std::string s_pulser
static const std::string s_cold
void set_femb1(const dunedaq::appmodel::FEMBSettings *value)
Set "femb1" relationship value. Settings for FEMB in slot 1.
virtual void print(unsigned int offset, bool print_header, std::ostream &s) const
Print details of the WIBSettings object.
static const std::string s_detector_type
static const std::string s_coldadc_settings
virtual ~WIBSettings() noexcept
static const std::string s_femb2
static const std::string s_femb0
void set_femb0(const dunedaq::appmodel::FEMBSettings *value)
Set "femb0" relationship value. Settings for FEMB in slot 0.
static const std::string s_femb1
const dunedaq::appmodel::ColdADCSettings * m_coldadc_settings
static const std::string s_adc_test_pattern
const dunedaq::appmodel::FEMBSettings * m_femb0
static const std::string s_wib_pulser
virtual std::vector< const dunedaq::conffwk::DalObject * > get(const std::string &name, bool upcast_unregistered=true) const
Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject...
static const std::string s_femb3
const dunedaq::appmodel::FEMBSettings * m_femb1
const dunedaq::appmodel::FEMBSettings * m_femb2
void set_wib_pulser(const dunedaq::appmodel::WIBPulserSettings *value)
Set "wib_pulser" relationship value. Settings for WIB pulser.
WIBSettings(conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
static const std::string & s_class_name
const dunedaq::appmodel::WIBPulserSettings * m_wib_pulser
const dunedaq::appmodel::FEMBSettings * m_femb3
void set_femb2(const dunedaq::appmodel::FEMBSettings *value)
Set "femb2" relationship value. Settings for FEMB in slot 2.
void set_coldadc_settings(const dunedaq::appmodel::ColdADCSettings *value)
Set "coldadc_settings" relationship value. Custom register settings for ColdADC.
virtual void init(bool init_children)
void set_femb3(const dunedaq::appmodel::FEMBSettings *value)
Set "femb3" relationship value. Settings for FEMB in slot 3.
void get(const std::string &name, T &value)
Get value of object's attribute or relationship.
The base class for any generated DAL object.
Definition DalObject.hpp:45
void p_hdr(std::ostream &s, unsigned int indent, const std::string &cl, const char *nm=nullptr) const
print object headers
Definition DalObject.cpp:65
void throw_init_ex(dunedaq::conffwk::Exception &ex)
throw object initialisation exception (i.e.
Definition DalObject.cpp:74
void increment_read() noexcept
static void p_error(std::ostream &s, dunedaq::conffwk::Exception &ex)
print error text
Definition DalObject.cpp:59
bool get_rel_objects(const std::string &name, bool upcast_unregistered, std::vector< const DalObject * > &objs) const
Read relationship values as DAL objects using DAL factory.
Definition DalObject.cpp:8
static void throw_get_ex(const std::string &what, const std::string &class_name, const DalObject *obj)
throw exception in generated get method (i.e.
Definition DalObject.cpp:82
std::mutex m_mutex
Used to protect changes of DAL object.
void _set_object(const std::string &name, const T *value)
Helper method for generated set single-value relationship methods.
DalRegistry & p_registry
Configuration object.
bool p_was_read
is true, if the object was read
bool get_algo_objects(const std::string &name, std::vector< const DalObject * > &objs) const
Run algorithm and return result as DAL objects using DAL factory.
Definition DalObject.cpp:25
ConfigObject p_obj
Config object used by given template object.
void check_init() const
Check and initialize object if necessary.
DalRegistry: A registry of DalObjects It provides a single interface to create, cache and manage DalO...
const T * _ref(ConfigObject &obj, const std::string &name, bool read_children)
Get signle value of object's relation and instantiate result with it (multi-thread safe).
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112
static struct dunedaq::appmodel::__AVXAbsRunSumProcessor_Registrator registrator
void p_sv_rel(std::ostream &s, const std::string &str, const std::string &name, const DalObject *obj)
print weak single-value relationship
void p_sv_attr(std::ostream &s, const std::string &str, const std::string &name, const T &val) noexcept
print single-value attribute
Including Qt Headers.