DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
confobject_desc.hpp
Go to the documentation of this file.
1/*
2 * confobject_desc.hpp
3 *
4 * Created on: Jan 14, 2016
5 * Author: Leonidas Georgopoulos
6 */
7
8#ifndef DBE_CONFOBJECT_DESC_HPP_
9#define DBE_CONFOBJECT_DESC_HPP_
10
13
14#include <QStringList>
15#include <map>
16#include <string>
17#include <vector>
18#include <iterator>
19
20namespace dbe
21{
22//------------------------------------------------------------------------------------------
31template<typename S = std::string>
33{
34private:
37
39 config_object_description & another ) noexcept
40 {
41 std::swap ( one.this_referenced_object, another.this_referenced_object );
42 std::swap ( one.this_class, another.this_class );
43 std::swap ( one.this_name, another.this_name );
44 std::swap ( one.this_file, another.this_file );
45 }
46
47public:
50 { o.UID(), o.class_name() },
52 this_file ( o.contained_in() )
53 {
54 }
55
58 { other.this_name, other.this_class },
60 { other.this_referenced_object },
61 this_file ( other.this_file )
62 {
63
64 }
65
67 {
68 transfer ( *this, other );
69 return *this;
70 }
71
72 S UID() const
73 {
74 return this->this_name;
75 }
76
77 S class_name() const
78 {
79 return this->this_class;
80 }
81
82 S contained_in() const
83 {
84 return this->this_file;
85 }
86
87 bool is_valid() const
88 {
90 }
91
102
103};
105//------------------------------------------------------------------------------------------
106
107//------------------------------------------------------------------------------------------
108template<typename S = std::string, typename I = std::string, typename A = std::string,
109 template<typename ... > class V = std::vector, template <typename ...> class M = std::map >
111{
112 typedef S type_str;
113 typedef I type_image;
115
116 typedef V<type_image> type_images;
117 typedef V<type_attribute_value> type_attributes;
118
119 typedef M<type_str, type_attributes> type_attrmap;
120 typedef M<type_str, type_images> type_relmap;
121
123
126
129};
130//------------------------------------------------------------------------------------------
131
132//------------------------------------------------------------------------------------------
137template<typename S> using config_object_preimage =
140//------------------------------------------------------------------------------------------
141
142//------------------------------------------------------------------------------------------
146template<typename S = std::string>
148{
149 typedef S t_str;
151 typedef std::vector<t_confobject> t_confobjects;
152 typedef std::map<S, QStringList> t_attrmap;
153 typedef std::map<S, t_confobjects> t_relmap;
154
157
159
161 {
164
165 std::for_each ( std::begin ( this->attributes ), std::end ( this->attributes ),
166 [&lattributes] ( typename std::pair<S, QStringList> const & e )
167 {
168 t_config_object_preimage::type_attrmap::value_type::second_type v;
169
170 for ( auto const & x : e.second )
171 {
172 v.push_back ( x.toStdString() );
173 }
174
175 lattributes.insert ( std::make_pair ( e.first, v ) );
176 } );
177
178 std::for_each ( std::begin ( this->relations ), std::end ( this->relations ),
179 [&lrelations] ( typename t_relmap::value_type const & e )
180 {
181 t_config_object_preimage::type_relmap::value_type::second_type v;
182
183 for ( t_confobject const & x : e.second )
184 {
185 v.push_back ( { x.UID(), x.class_name() } );
186 }
187
188 lrelations.insert ( std::make_pair ( e.first, v ) );
189 } );
190
191 return
192 {
193 lattributes, lrelations,
194 { this->ref.UID(), this->ref.class_name() }, this->ref.contained_in() };
195 }
196};
198//------------------------------------------------------------------------------------------
199
200}// end namespace dbe
201
202#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
Include QT Headers.
config_object_preimage< std::string > t_config_object_preimage
config_object_representation t_config_object_rep
config_object_description dref
V< type_attribute_value > type_attributes
M< type_str, type_attributes > type_attrmap
M< type_str, type_images > type_relmap
config_object_description< S > t_confobject
t_config_object_preimage toimage()
std::vector< t_confobject > t_confobjects
std::map< S, t_confobjects > t_relmap
std::map< S, QStringList > t_attrmap