DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
confobject_desc.hpp
Go to the documentation of this file.
1// DUNE DAQ modification notice:
2// This file has been modified from the original ATLAS dbe source for the DUNE DAQ project.
3// Fork baseline commit: dbe-02-12-17 (2022-05-12).
4// Renamed since fork: yes (from dbe/confobject_desc.hpp to include/dbe/confobject_desc.hpp).
5
6/*
7 * confobject_desc.hpp
8 *
9 * Created on: Jan 14, 2016
10 * Author: Leonidas Georgopoulos
11 */
12
13#ifndef DBE_CONFOBJECT_DESC_HPP_
14#define DBE_CONFOBJECT_DESC_HPP_
15
18
19#include <QStringList>
20#include <iterator>
21#include <map>
22#include <string>
23#include <vector>
24
25namespace dbe {
26//------------------------------------------------------------------------------------------
35template<typename S = std::string>
37{
38private:
41
43 {
44 std::swap(one.this_referenced_object, another.this_referenced_object);
45 std::swap(one.this_class, another.this_class);
46 std::swap(one.this_name, another.this_name);
47 std::swap(one.this_file, another.this_file);
48 }
49
50public:
52 : config_object_key<S>{ o.UID(), o.class_name() }
54 , this_file(o.contained_in())
55 {
56 }
57
59 : config_object_key<S>{ other.this_name, other.this_class }
60 , this_referenced_object{ other.this_referenced_object }
61 , this_file(other.this_file)
62 {
63 }
64
66 {
67 transfer(*this, other);
68 return *this;
69 }
70
71 S UID() const { return this->this_name; }
72
73 S class_name() const { return this->this_class; }
74
75 S contained_in() const { return this->this_file; }
76
77 bool is_valid() const { return not this_referenced_object.is_null(); }
78
89};
91//------------------------------------------------------------------------------------------
92
93//------------------------------------------------------------------------------------------
94template<typename S = std::string,
95 typename I = std::string,
96 typename A = std::string,
97 template<typename...> class V = std::vector,
98 template<typename...> class M = std::map>
100{
101 typedef S type_str;
102 typedef I type_image;
104
105 typedef V<type_image> type_images;
106 typedef V<type_attribute_value> type_attributes;
107
108 typedef M<type_str, type_attributes> type_attrmap;
109 typedef M<type_str, type_images> type_relmap;
110
112
115
118};
119//------------------------------------------------------------------------------------------
120
121//------------------------------------------------------------------------------------------
126template<typename S>
129//------------------------------------------------------------------------------------------
130
131//------------------------------------------------------------------------------------------
135template<typename S = std::string>
137{
138 typedef S t_str;
140 typedef std::vector<t_confobject> t_confobjects;
141 typedef std::map<S, QStringList> t_attrmap;
142 typedef std::map<S, t_confobjects> t_relmap;
143
146
148
150 {
153
154 std::for_each(std::begin(this->attributes),
155 std::end(this->attributes),
156 [&lattributes](typename std::pair<S, QStringList> const& e) {
157 t_config_object_preimage::type_attrmap::value_type::second_type v;
158
159 for (auto const& x : e.second) {
160 v.push_back(x.toStdString());
161 }
162
163 lattributes.insert(std::make_pair(e.first, v));
164 });
165
166 std::for_each(
167 std::begin(this->relations), std::end(this->relations), [&lrelations](typename t_relmap::value_type const& e) {
168 t_config_object_preimage::type_relmap::value_type::second_type v;
169
170 for (t_confobject const& x : e.second) {
171 v.push_back({ x.UID(), x.class_name() });
172 }
173
174 lrelations.insert(std::make_pair(e.first, v));
175 });
176
177 return { lattributes, lrelations, { this->ref.UID(), this->ref.class_name() }, this->ref.contained_in() };
178 }
179};
181//------------------------------------------------------------------------------------------
182
183} // end namespace dbe
184
185#endif /* DBE_CONFOBJECT_DESC_HPP_ */
config_object_description operator=(config_object_description other)
inner::configobject::tref this_referenced_object
config_object_description(config_object_description const &other)
inner::configobject::tref ref() const
config_object_description(dbe::inner::configobject::tref const &o) noexcept(false)
friend void transfer(config_object_description &one, config_object_description &another) noexcept
config_object_key(std::string const &oname, std::string const &cname)
Include QT Headers.
config_object_image< S, config_object_key< S >, S > config_object_preimage
config_object_preimage< std::string > t_config_object_preimage
config_object_representation t_config_object_rep
config_object_description dref
M< type_str, type_images > type_relmap
M< type_str, type_attributes > type_attrmap
V< type_attribute_value > type_attributes
std::vector< t_confobject > t_confobjects
std::map< S, QStringList > t_attrmap
t_config_object_preimage toimage()
config_object_description< S > t_confobject
std::map< S, t_confobjects > t_relmap