DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::ui::config::info Class Reference

#include <config_ui_info.hpp>

Public Member Functions

 info (std::vector< std::string > const &file)
GraphicalClass graphical (std::string const &) const
ViewConfiguration view (std::string const &) const
Window window (std::string const &) const
std::vector< Windowwindows () const
std::vector< ViewConfigurationviews () const
std::vector< GraphicalClassgraphicals () const

Private Member Functions

void parse ()
void parse_graphical (std::shared_ptr< dunedaq::conffwk::Configuration >, dunedaq::conffwk::ConfigObject &)
void parse_window (std::shared_ptr< dunedaq::conffwk::Configuration >, dunedaq::conffwk::ConfigObject &)

Private Attributes

std::map< std::string, Windowthis_windows
std::map< std::string, GraphicalClassthis_graphical
std::map< std::string, ViewConfigurationthis_views
std::vector< std::string > this_full_filenames

Detailed Description

Class used to read the current partition configuration in order to retrieve parameter for running the application and other necessary parameters

Definition at line 36 of file config_ui_info.hpp.

Constructor & Destructor Documentation

◆ info()

dbe::ui::config::info::info ( std::vector< std::string > const & file)

Definition at line 29 of file config_ui_info.cpp.

30 : this_full_filenames ( full_file_name )
31{
32 parse();
33}
std::vector< std::string > this_full_filenames

Member Function Documentation

◆ graphical()

dbe::GraphicalClass dbe::ui::config::info::graphical ( std::string const & name) const

Definition at line 35 of file config_ui_info.cpp.

36{
37 std::map<std::string, GraphicalClass>::const_iterator it = this_graphical.find ( name );
38
39 if ( it != this_graphical.end() )
40 {
41 return it->second;
42 }
43 else
44 {
45 return
46 {};
47 }
48}
std::map< std::string, GraphicalClass > this_graphical

◆ graphicals()

std::vector< dbe::GraphicalClass > dbe::ui::config::info::graphicals ( ) const

Definition at line 376 of file config_ui_info.cpp.

377{
378 std::vector<dbe::GraphicalClass> the_graphicals;
379
380 for ( auto const & x : this_graphical )
381 {
382 the_graphicals.push_back ( x.second );
383 }
384
385 return the_graphicals;
386}

◆ parse()

void dbe::ui::config::info::parse ( )
private

Definition at line 80 of file config_ui_info.cpp.

81{
82 for ( std::string const & fname : this_full_filenames )
83 {
84 std::string Implementation = "oksconflibs:" + fname;
85
86 try
87 {
88 std::shared_ptr<Configuration> ConfigFile ( new Configuration ( Implementation ) );
89 std::vector<ConfigObject> objects;
90
91 ConfigFile->get ( "Class", objects );
92
93 for ( ConfigObject & aclass : objects )
94 {
95 parse_graphical ( ConfigFile, aclass );
96 }
97
98 objects.clear();
99 ConfigFile->get ( "Window", objects );
100
101 for ( ConfigObject & awindow : objects )
102 {
103 parse_window ( ConfigFile, awindow );
104 }
105 }
106 catch ( dunedaq::conffwk::Exception const & ex )
107 {
108 ERROR ( "Configuration database load did not succeed",
109 dbe::config::errors::parse ( ex ).c_str() );
110 }
111 }
112}
void parse_graphical(std::shared_ptr< dunedaq::conffwk::Configuration >, dunedaq::conffwk::ConfigObject &)
void parse_window(std::shared_ptr< dunedaq::conffwk::Configuration >, dunedaq::conffwk::ConfigObject &)
#define ERROR(...)
Definition messenger.hpp:93
std::string const parse(ers::Issue const &)

◆ parse_graphical()

void dbe::ui::config::info::parse_graphical ( std::shared_ptr< dunedaq::conffwk::Configuration > ConfigFile,
dunedaq::conffwk::ConfigObject & Object )
private

Definition at line 114 of file config_ui_info.cpp.

116{
117 GraphicalClass GraphicalClassObject;
118
119 GraphicalClassObject.GraphicalUID = QString ( Object.UID().c_str() );
120 dunedaq::conffwk::class_t cinfo = ConfigFile->get_class_info ( Object.class_name(), false );
121
122 std::vector<dunedaq::conffwk::attribute_t> const & attributes = cinfo.p_attributes;
123 std::vector<dunedaq::conffwk::relationship_t> const & relations = cinfo.p_relationships;
124
125 for ( dunedaq::conffwk::attribute_t const & attr : attributes )
126 {
127 QStringList data = dbe::config::api::get::direct::attribute<QStringList> ( Object, attr );
128
129 if ( attr.p_name == "Name" )
130 {
131 GraphicalClassObject.DatabaseClassName = data.at ( 0 );
132 }
133 else if ( attr.p_name == "Generic Pixmap File" )
134 {
135 GraphicalClassObject.GenericPixmapFile = data.at ( 0 );
136 }
137 else if ( attr.p_name == "Used Pixmap File" )
138 {
139 GraphicalClassObject.UsedPixmapFile = data.at ( 0 );
140 }
141 else if ( attr.p_name == "Icon Bitmap File" )
142 {
143 GraphicalClassObject.BitmapFile = data.at ( 0 );
144 }
145 else if ( attr.p_name == "Icon Mask Bitmap File" )
146 {
147 GraphicalClassObject.BitmapMaskFile = data.at ( 0 );
148 }
149 else if ( attr.p_name == "Show All Attributes" )
150 {
151 GraphicalClassObject.ShowAllAttributes = convert::to<bool> (
152 data, attr.p_int_format );
153 }
154 else if ( attr.p_name == "Attributes" )
155 {
156 GraphicalClassObject.Attributes = data;
157 }
158 else if ( attr.p_name == "Show All Relationships" )
159 {
160 GraphicalClassObject.ShowAllRelationships = convert::to<bool> (
161 data, attr.p_int_format );
162 }
163 else if ( attr.p_name == "Relationships" )
164 {
165 GraphicalClassObject.Relationships = data;
166
167 }
168 else if ( attr.p_name == "Icon Title" )
169 {
170 GraphicalClassObject.IconTitle = data.at ( 0 );
171 }
172 }
173
174 for ( dunedaq::conffwk::relationship_t const & relation : relations )
175 {
176 QStringList data;
177 std::vector<ConfigObject> neighboring
178 { };
179
181 {
182 neighboring.push_back (
184 }
185 else
186 {
187 std::vector<ConfigObject> objects = dbe::config::api::graph::direct::linked <
188 std::vector<ConfigObject >> ( Object, relation );
189 neighboring.insert ( std::end ( neighboring ), std::begin ( objects ),
190 std::end ( objects ) );
191 }
192
193 for ( ConfigObject & RelObject : neighboring )
194 {
195 dunedaq::conffwk::class_t RelClassInfo = ConfigFile->get_class_info ( RelObject.class_name(),
196 false );
197 std::vector<dunedaq::conffwk::attribute_t> AttributeRelList = RelClassInfo.p_attributes;
198
199 if ( RelObject.class_name() == "Dual Relationship" )
200 {
201 DualRelationship DRel;
202
203 for ( dunedaq::conffwk::attribute_t & Attribute : AttributeRelList )
204 {
206 Attribute );
207
208 if ( Attribute.p_name == "Direct" )
209 {
210 DRel.Direct = data.at ( 0 );
211 }
212 else if ( Attribute.p_name == "Reverse" )
213 {
214 DRel.Reverse = data.at ( 0 );
215 }
216 }
217
218 GraphicalClassObject.DualRelationships.push_back ( DRel );
219 }
220 else if ( RelObject.class_name() == "Init Attribute Value" )
221 {
222 InitAttributeFromEnv IRel;
223
224 for ( dunedaq::conffwk::attribute_t & Attribute : AttributeRelList )
225 {
227 Attribute );
228
229 if ( Attribute.p_name == "Attribute Name" )
230 {
231 IRel.AttributeName = data.at ( 0 );
232 }
233 else if ( Attribute.p_name == "Environment Variables" )
234 {
235 IRel.EnvNames = data;
236 }
237 }
238
239 GraphicalClassObject.NeedToInitialize.push_back ( IRel );
240 }
241 }
242 }
243
244 this_graphical.emplace ( GraphicalClassObject.GraphicalUID.toStdString(),
245 GraphicalClassObject );
246
247}
friend class dbe::config::api::get::attribute
static T linked(dunedaq::conffwk::ConfigObject &item, dunedaq::conffwk::relationship_t const &relation)
const std::string & UID() const noexcept
Return object identity.
const std::string & class_name() const noexcept
Return object's class name.
std::vector< T > attributes(tref const &item)
T relation(tref item, dunedaq::conffwk::relationship_t const &relation)
std::vector< T > relations(tref const &item)
bool is_simple(dunedaq::conffwk::relationship_t const &)
bool to< bool >(QStringList const &DataList, dunedaq::conffwk::int_format_t Format)
const std::vector< attribute_t > p_attributes
Definition Schema.hpp:170
const std::vector< relationship_t > p_relationships
Definition Schema.hpp:171

◆ parse_window()

void dbe::ui::config::info::parse_window ( std::shared_ptr< dunedaq::conffwk::Configuration > database,
dunedaq::conffwk::ConfigObject & object )
private

Definition at line 249 of file config_ui_info.cpp.

251{
252 Window WindowObject;
253 dunedaq::conffwk::class_t ClassInfo = database->get_class_info ( object.class_name(), false );
254 std::vector<dunedaq::conffwk::attribute_t> const & attributes = ClassInfo.p_attributes;
255 std::vector<dunedaq::conffwk::relationship_t> const & relations = ClassInfo.p_relationships;
256
257 for ( dunedaq::conffwk::attribute_t const & attribute : attributes )
258 {
259 if ( attribute.p_name == "Title" )
260 {
261 WindowObject.Title = dbe::config::api::get::direct::attribute<QStringList> ( object,
262 attribute ).at (
263 0 );
264 }
265 }
266
267 for ( dunedaq::conffwk::relationship_t const & relation : relations )
268 {
269 std::vector<ConfigObject> linkedobjects;
270
272 {
273 linkedobjects.push_back (
275 }
276 else
277 {
278 std::vector<ConfigObject> voisins = dbe::config::api::graph::direct::linked <
279 std::vector<ConfigObject >> ( object, relation );
280
281 if ( not voisins.empty() )
282 {
283 linkedobjects.insert ( std::end ( linkedobjects ), std::begin ( voisins ),
284 std::end ( voisins ) );
285 }
286 }
287
288 for ( ConfigObject & neighbor : linkedobjects )
289 {
290 dunedaq::conffwk::class_t classinfo = database->get_class_info ( neighbor.class_name(),
291 false );
292 std::vector<dunedaq::conffwk::attribute_t> const & AttributeRelList = classinfo
294 std::vector<dunedaq::conffwk::relationship_t> const & RelationshipRelList = classinfo
296
297 if ( neighbor.class_name() != "Window Separator" )
298 {
299 for ( dunedaq::conffwk::attribute_t const & Attribute : AttributeRelList )
300 {
301 if ( Attribute.p_name == "Shown with children" )
302 {
303 QStringList neighbor_names
305
306 if ( neighbor_names.at ( 0 ) != "none" )
307 {
308 WindowObject.ShowChildren = true;
309 }
310 else
311 {
312 WindowObject.ShowChildren = false;
313 }
314 }
315 }
316
317 for ( dunedaq::conffwk::relationship_t const & RelationshipRel : RelationshipRelList )
318 {
319 QStringList RelDataList;
320 std::vector<ConfigObject> neighboring_nodes;
321
322 if ( dbe::config::api::info::relation::is_simple ( RelationshipRel ) )
323 {
324 neighboring_nodes.push_back (
326 RelationshipRel ) );
327 }
328 else
329 {
330
331 std::vector<ConfigObject> neighbors = dbe::config::api::graph::direct::linked <
332 std::vector<ConfigObject >> ( neighbor, RelationshipRel );
333
334 neighboring_nodes.insert ( std::end ( neighboring_nodes ), std::begin ( neighbors ),
335 std::end ( neighbors ) );
336 }
337
338 for ( ConfigObject & RelDataObject : neighboring_nodes )
339 {
340 RelDataList.push_back ( QString ( RelDataObject.UID().c_str() ) );
341 }
342
343 WindowObject.GraphicalClassesList.push_back ( RelDataList.at ( 0 ) );
344 }
345 }
346 }
347 }
348
349 this_windows.emplace ( WindowObject.Title.toStdString(), WindowObject );
350}
std::map< std::string, Window > this_windows
T attribute(tref item, dunedaq::conffwk::attribute_t const &attr)
std::vector< T > object(tref const &)

◆ view()

dbe::ViewConfiguration dbe::ui::config::info::view ( std::string const & name) const

Definition at line 50 of file config_ui_info.cpp.

51{
52 std::map<std::string, ViewConfiguration>::const_iterator it = this_views.find ( name );
53
54 if ( it != this_views.end() )
55 {
56 return it->second;
57 }
58 else
59 {
60 return
61 {};
62 }
63}
std::map< std::string, ViewConfiguration > this_views

◆ views()

std::vector< dbe::ViewConfiguration > dbe::ui::config::info::views ( ) const

Definition at line 364 of file config_ui_info.cpp.

365{
366 std::vector<dbe::ViewConfiguration> views;
367
368 for ( auto const & x : this_views )
369 {
370 views.push_back ( x.second );
371 }
372
373 return views;
374}
std::vector< ViewConfiguration > views() const

◆ window()

dbe::Window dbe::ui::config::info::window ( std::string const & name) const

Definition at line 65 of file config_ui_info.cpp.

66{
67 std::map<std::string, Window>::const_iterator it = this_windows.find ( name );
68
69 if ( it != this_windows.end() )
70 {
71 return it->second;
72 }
73 else
74 {
75 return
76 {};
77 }
78}

◆ windows()

std::vector< dbe::Window > dbe::ui::config::info::windows ( ) const

Definition at line 352 of file config_ui_info.cpp.

353{
354 std::vector<dbe::Window> windows;
355
356 for ( auto const & x : this_windows )
357 {
358 windows.push_back ( x.second );
359 }
360
361 return windows;
362}
std::vector< Window > windows() const

Member Data Documentation

◆ this_full_filenames

std::vector<std::string> dbe::ui::config::info::this_full_filenames
private

Definition at line 58 of file config_ui_info.hpp.

◆ this_graphical

std::map<std::string, GraphicalClass> dbe::ui::config::info::this_graphical
private

Definition at line 55 of file config_ui_info.hpp.

◆ this_views

std::map<std::string, ViewConfiguration> dbe::ui::config::info::this_views
private

Definition at line 56 of file config_ui_info.hpp.

◆ this_windows

std::map<std::string, Window> dbe::ui::config::info::this_windows
private

Definition at line 54 of file config_ui_info.hpp.


The documentation for this class was generated from the following files: