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 <map>
21#include <string>
22#include <vector>
23#include <iterator>
24
25namespace dbe
26{
27//------------------------------------------------------------------------------------------
36template<typename S = std::string>
38{
39private:
42
44 config_object_description & another ) noexcept
45 {
46 std::swap ( one.this_referenced_object, another.this_referenced_object );
47 std::swap ( one.this_class, another.this_class );
48 std::swap ( one.this_name, another.this_name );
49 std::swap ( one.this_file, another.this_file );
50 }
51
52public:
55 { o.UID(), o.class_name() },
57 this_file ( o.contained_in() )
58 {
59 }
60
63 { other.this_name, other.this_class },
65 { other.this_referenced_object },
66 this_file ( other.this_file )
67 {
68
69 }
70
72 {
73 transfer ( *this, other );
74 return *this;
75 }
76
77 S UID() const
78 {
79 return this->this_name;
80 }
81
82 S class_name() const
83 {
84 return this->this_class;
85 }
86
87 S contained_in() const
88 {
89 return this->this_file;
90 }
91
92 bool is_valid() const
93 {
94 return not this_referenced_object.is_null();
95 }
96
107
108};
110//------------------------------------------------------------------------------------------
111
112//------------------------------------------------------------------------------------------
113template<typename S = std::string, typename I = std::string, typename A = std::string,
114 template<typename ... > class V = std::vector, template <typename ...> class M = std::map >
116{
117 typedef S type_str;
118 typedef I type_image;
120
121 typedef V<type_image> type_images;
122 typedef V<type_attribute_value> type_attributes;
123
124 typedef M<type_str, type_attributes> type_attrmap;
125 typedef M<type_str, type_images> type_relmap;
126
128
131
134};
135//------------------------------------------------------------------------------------------
136
137//------------------------------------------------------------------------------------------
142template<typename S> using config_object_preimage =
145//------------------------------------------------------------------------------------------
146
147//------------------------------------------------------------------------------------------
151template<typename S = std::string>
153{
154 typedef S t_str;
156 typedef std::vector<t_confobject> t_confobjects;
157 typedef std::map<S, QStringList> t_attrmap;
158 typedef std::map<S, t_confobjects> t_relmap;
159
162
164
166 {
169
170 std::for_each ( std::begin ( this->attributes ), std::end ( this->attributes ),
171 [&lattributes] ( typename std::pair<S, QStringList> const & e )
172 {
173 t_config_object_preimage::type_attrmap::value_type::second_type v;
174
175 for ( auto const & x : e.second )
176 {
177 v.push_back ( x.toStdString() );
178 }
179
180 lattributes.insert ( std::make_pair ( e.first, v ) );
181 } );
182
183 std::for_each ( std::begin ( this->relations ), std::end ( this->relations ),
184 [&lrelations] ( typename t_relmap::value_type const & e )
185 {
186 t_config_object_preimage::type_relmap::value_type::second_type v;
187
188 for ( t_confobject const & x : e.second )
189 {
190 v.push_back ( { x.UID(), x.class_name() } );
191 }
192
193 lrelations.insert ( std::make_pair ( e.first, v ) );
194 } );
195
196 return
197 {
198 lattributes, lrelations,
199 { this->ref.UID(), this->ref.class_name() }, this->ref.contained_in() };
200 }
201};
203//------------------------------------------------------------------------------------------
204
205}// end namespace dbe
206
207#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_preimage< std::string > t_config_object_preimage
config_object_image< S, config_object_key< S >, S > 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