DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
DaphneConf.hpp
Go to the documentation of this file.
1// *** this file is generated by oksdalgen, do not modify it ***
2
3#ifndef _DaphneConf_0_dunedaq__appmodel_0_appmodel_H_
4#define _DaphneConf_0_dunedaq__appmodel_0_appmodel_H_
5
6#include <stdint.h> // to define 64 bits types
7#include <iostream>
8#include <sstream>
9#include <string>
10#include <map>
11#include <vector>
12
14#include "conffwk/DalObject.hpp"
15
16
17 // forward declaration for classes used in relationships and algorithms
18
19namespace dunedaq {
20 namespace appmodel {
21 class DaphneV2BoardConf;
22 }
23}
24
25
26 // prologue of method DaphneConf::get_timeout()
27
28#include <chrono>
29
30 // prologue of method DaphneConf::get_json()
31
32#include <nlohmann/json.hpp>
33
34namespace dunedaq {
35 namespace appmodel {
36
41 class DaphneConf : public virtual dunedaq::conffwk::DalObject {
42
43 friend class conffwk::Configuration;
44 friend class conffwk::DalObject;
45 friend class conffwk::DalFactory;
46 friend class conffwk::DalRegistry;
47
48 protected:
49
51 virtual ~DaphneConf() noexcept;
52 virtual void init(bool init_children);
53
54 public:
55
58 static const std::string& s_class_name;
59
60
70 virtual void print(unsigned int offset, bool print_header, std::ostream& s) const;
71
72
82 virtual std::vector<const dunedaq::conffwk::DalObject *> get(const std::string& name, bool upcast_unregistered = true) const;
83
84
85 protected:
86
87 bool get(const std::string& name, std::vector<const dunedaq::conffwk::DalObject *>& vec, bool upcast_unregistered, bool first_call) const;
88
89
90 private:
91
92 uint16_t m_timeout_ms;
93 std::string m_json_file;
94 bool m_time_reset;
96
97
98 public:
99
100 // attribute names
101
102 inline static const std::string s_timeout_ms = "timeout_ms";
103 inline static const std::string s_json_file = "json_file";
104 inline static const std::string s_time_reset = "time_reset";
105
106 static const std::string& __get_timeout_ms_str() noexcept { return s_timeout_ms; }
107 static const std::string& __get_json_file_str() noexcept { return s_json_file; }
108 static const std::string& __get_time_reset_str() noexcept { return s_time_reset; }
109
110
118 uint16_t
120 {
121 std::lock_guard scoped_lock(m_mutex);
122 check();
123 check_init();
124 return m_timeout_ms;
125 }
126
134 void
135 set_timeout_ms(uint16_t value)
136 {
137 std::lock_guard scoped_lock(m_mutex);
138 check();
139 clear();
141 }
142
143
150 const std::string&
152 {
153 std::lock_guard scoped_lock(m_mutex);
154 check();
155 check_init();
156 return m_json_file;
157 }
158
165 void
166 set_json_file(const std::string& value)
167 {
168 std::lock_guard scoped_lock(m_mutex);
169 check();
170 clear();
172 }
173
174
182 bool
184 {
185 std::lock_guard scoped_lock(m_mutex);
186 check();
187 check_init();
188 return m_time_reset;
189 }
190
198 void
199 set_time_reset(bool value)
200 {
201 std::lock_guard scoped_lock(m_mutex);
202 check();
203 clear();
205 }
206
207
208 // relationship names
209
210 inline static const std::string s_default_v2_settings = "default_v2_settings";
211
212 static const std::string& __get_default_v2_settings_str() noexcept { return s_default_v2_settings; }
213
214
224 {
225 std::lock_guard scoped_lock(m_mutex);
226 check();
227 check_init();
229 {
230 std::ostringstream text;
231 text << "relationship \"" << s_default_v2_settings << "\" of object " << this << " is not set";
232 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
233 }
235 }
236
237
245 void
247
248
249 public:
250
251 // user-defined algorithms
252
257 std::chrono::milliseconds get_timeout() const;
258
259
264 nlohmann::json get_json() const;
265
266
271 uint16_t get_board_slot(const std::string & ip) const;
272 };
273
274 // out stream operator
275
276 inline std::ostream& operator<<(std::ostream& s, const DaphneConf& obj)
277 {
278 return obj.print_object(s);
279 }
280
281 typedef std::vector<const DaphneConf*>::const_iterator DaphneConfIterator;
282
283 }
284}
285
286#endif
#define ERS_HERE
static const std::string & s_class_name
static const std::string s_json_file
void set_json_file(const std::string &value)
Set "json_file" attribute value.
static const std::string & __get_default_v2_settings_str() noexcept
bool get_time_reset() const
Get "time_reset" attribute value. If True, it performs the time reset at configuration....
const dunedaq::appmodel::DaphneV2BoardConf * get_default_v2_settings() const
Get "default_v2_settings" relationship value. Value to be used during scrap.
virtual void init(bool init_children)
static const std::string & __get_timeout_ms_str() noexcept
nlohmann::json get_json() const
void set_default_v2_settings(const dunedaq::appmodel::DaphneV2BoardConf *value)
Set "default_v2_settings" relationship value. Value to be used during scrap.
const std::string & get_json_file() const
Get "json_file" attribute value.
static const std::string & __get_time_reset_str() noexcept
static const std::string s_default_v2_settings
static const std::string s_time_reset
uint16_t get_board_slot(const std::string &ip) const
virtual ~DaphneConf() noexcept
friend class conffwk::DalFactory
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_timeout_ms
uint16_t get_timeout_ms() const
Get "timeout_ms" attribute value. timeout used for the board operations.
DaphneConf(conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
void set_time_reset(bool value)
Set "time_reset" attribute value. If True, it performs the time reset at configuration....
friend class conffwk::DalObject
std::chrono::milliseconds get_timeout() const
void set_timeout_ms(uint16_t value)
Set "timeout_ms" attribute value. timeout used for the board operations.
static const std::string & __get_json_file_str() noexcept
const dunedaq::appmodel::DaphneV2BoardConf * m_default_v2_settings
void set_by_val(const std::string &name, T value)
Set attribute value.
void set_by_ref(const std::string &name, T &value)
Set attribute value.
The base class for any generated DAL object.
Definition DalObject.hpp:45
std::mutex m_mutex
Used to protect changes of DAL object.
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...
Generic configuration exception.
conffwk entry point
double offset
std::ostream & operator<<(std::ostream &s, const AVXAbsRunSumProcessor &obj)
std::vector< constDaphneConf * >::const_iterator DaphneConfIterator
The DUNE-DAQ namespace.
Definition DataStore.hpp:57
msgpack::object obj