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 31 of file config_ui_info.hpp.

Constructor & Destructor Documentation

◆ info()

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

Definition at line 24 of file config_ui_info.cpp.

25 : this_full_filenames ( full_file_name )
26{
27 parse();
28}
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 30 of file config_ui_info.cpp.

31{
32 std::map<std::string, GraphicalClass>::const_iterator it = this_graphical.find ( name );
33
34 if ( it != this_graphical.end() )
35 {
36 return it->second;
37 }
38 else
39 {
40 return
41 {};
42 }
43}
std::map< std::string, GraphicalClass > this_graphical

◆ graphicals()

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

Definition at line 371 of file config_ui_info.cpp.

372{
373 std::vector<dbe::GraphicalClass> the_graphicals;
374
375 for ( auto const & x : this_graphical )
376 {
377 the_graphicals.push_back ( x.second );
378 }
379
380 return the_graphicals;
381}

◆ parse()

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

Definition at line 75 of file config_ui_info.cpp.

76{
77 for ( std::string const & fname : this_full_filenames )
78 {
79 std::string Implementation = "oksconflibs:" + fname;
80
81 try
82 {
83 std::shared_ptr<Configuration> ConfigFile ( new Configuration ( Implementation ) );
84 std::vector<ConfigObject> objects;
85
86 ConfigFile->get ( "Class", objects );
87
88 for ( ConfigObject & aclass : objects )
89 {
90 parse_graphical ( ConfigFile, aclass );
91 }
92
93 objects.clear();
94 ConfigFile->get ( "Window", objects );
95
96 for ( ConfigObject & awindow : objects )
97 {
98 parse_window ( ConfigFile, awindow );
99 }
100 }
101 catch ( dunedaq::conffwk::Exception const & ex )
102 {
103 ERROR ( "Configuration database load did not succeed",
104 dbe::config::errors::parse ( ex ).c_str() );
105 }
106 }
107}
void parse_graphical(std::shared_ptr< dunedaq::conffwk::Configuration >, dunedaq::conffwk::ConfigObject &)
void parse_window(std::shared_ptr< dunedaq::conffwk::Configuration >, dunedaq::conffwk::ConfigObject &)
Represents database objects.
Defines base class for cache of template objects.
#define ERROR(...)
Definition messenger.hpp:88
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 109 of file config_ui_info.cpp.

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

◆ parse_window()

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

Definition at line 244 of file config_ui_info.cpp.

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

◆ view()

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

Definition at line 45 of file config_ui_info.cpp.

46{
47 std::map<std::string, ViewConfiguration>::const_iterator it = this_views.find ( name );
48
49 if ( it != this_views.end() )
50 {
51 return it->second;
52 }
53 else
54 {
55 return
56 {};
57 }
58}
std::map< std::string, ViewConfiguration > this_views

◆ views()

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

Definition at line 359 of file config_ui_info.cpp.

360{
361 std::vector<dbe::ViewConfiguration> views;
362
363 for ( auto const & x : this_views )
364 {
365 views.push_back ( x.second );
366 }
367
368 return views;
369}
std::vector< ViewConfiguration > views() const

◆ window()

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

Definition at line 60 of file config_ui_info.cpp.

61{
62 std::map<std::string, Window>::const_iterator it = this_windows.find ( name );
63
64 if ( it != this_windows.end() )
65 {
66 return it->second;
67 }
68 else
69 {
70 return
71 {};
72 }
73}

◆ windows()

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

Definition at line 347 of file config_ui_info.cpp.

348{
349 std::vector<dbe::Window> windows;
350
351 for ( auto const & x : this_windows )
352 {
353 windows.push_back ( x.second );
354 }
355
356 return windows;
357}
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 53 of file config_ui_info.hpp.

◆ this_graphical

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

Definition at line 50 of file config_ui_info.hpp.

◆ this_views

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

Definition at line 51 of file config_ui_info.hpp.

◆ this_windows

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

Definition at line 49 of file config_ui_info.hpp.


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