DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
datahandler.cpp
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: no.
5
6#include "dbe/datahandler.hpp"
7#include "dbe/treenode.hpp"
9#include "dbe/Conversion.hpp"
10
12 : root ( nullptr )
13{
14}
15
20
22{
23 delete root;
24 root = nullptr;
25}
26
31
32dbe::treenode * dbe::datahandler::getnode ( std::string const & ClassName ) const
33{
34 return getnode ( QString::fromStdString ( ClassName ) );
35}
36
37dbe::treenode * dbe::datahandler::getnode ( const QString & ClassName ) const
38{
39 int current = 0;
40 int const number_of_childs = root->ChildCount();
41
42 for ( ;
43 current != number_of_childs and root->GetChild ( current )->GetData ( 0 ).toString()
44 != ClassName; ++current )
45 ;
46
47 return current == number_of_childs ? nullptr : root->GetChild ( current );
48}
49
50dbe::treenode * dbe::datahandler::getnode ( const std::string & ClassName,
51 const std::string & ObjectName ) const
52{
53 return getnode ( QString::fromStdString ( ClassName ),
54 QString::fromStdString ( ObjectName ) );
55}
56
57dbe::treenode * dbe::datahandler::getnode ( const QString & ClassName,
58 const QString & ObjectName ) const
59{
60 if ( dbe::treenode * classnode = getnode ( ClassName ) )
61 {
62 int current = 0;
63 int const number_of_objects = classnode->ChildCount();
64
65 for ( ;
66 current < number_of_objects and classnode->GetChild ( current )->GetData ( 0 ).toString()
67 != ObjectName; ++current )
68 ;
69
70 return current == number_of_objects ? nullptr : classnode->GetChild ( current );
71 }
72
73 return nullptr;
74}
75
77{
78 return root;
79}
80
82 QString const & name )
83{
84 QList<dbe::treenode *> childs = top->GetChildren();
85
86 for ( dbe::treenode * child : childs )
87 {
88 if ( QString::fromStdString ( child->GetObject().UID() ) == name )
89 {
90 return child;
91 }
92 }
93
94 return nullptr;
95}
treenode * root
Tree data structure.
treenode * getnode() const
void FetchMoreData(const treenode *ClassNode)
void FetchMore(const treenode *ClassNode)
static treenode * findchild(treenode *top, QString const &name)
QList< treenode * > GetChildren() const
Definition treenode.cpp:111