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/Conversion.hpp"
9#include "dbe/treenode.hpp"
10
12 : root(nullptr)
13{
14}
15
20
21void
23{
24 delete root;
25 root = nullptr;
26}
27
28void
33
35dbe::datahandler::getnode(std::string const& ClassName) const
36{
37 return getnode(QString::fromStdString(ClassName));
38}
39
41dbe::datahandler::getnode(const QString& ClassName) const
42{
43 int current = 0;
44 int const number_of_childs = root->ChildCount();
45
46 for (; current != number_of_childs and root->GetChild(current)->GetData(0).toString() != ClassName; ++current)
47 ;
48
49 return current == number_of_childs ? nullptr : root->GetChild(current);
50}
51
53dbe::datahandler::getnode(const std::string& ClassName, const std::string& ObjectName) const
54{
55 return getnode(QString::fromStdString(ClassName), QString::fromStdString(ObjectName));
56}
57
59dbe::datahandler::getnode(const QString& ClassName, const QString& ObjectName) const
60{
61 if (dbe::treenode* classnode = getnode(ClassName)) {
62 int current = 0;
63 int const number_of_objects = classnode->ChildCount();
64
65 for (; current < number_of_objects and classnode->GetChild(current)->GetData(0).toString() != ObjectName; ++current)
66 ;
67
68 return current == number_of_objects ? nullptr : classnode->GetChild(current);
69 }
70
71 return nullptr;
72}
73
76{
77 return root;
78}
79
81dbe::datahandler::findchild(dbe::treenode* const top, QString const& name)
82{
83 QList<dbe::treenode*> childs = top->GetChildren();
84
85 for (dbe::treenode* child : childs) {
86 if (QString::fromStdString(child->GetObject().UID()) == name) {
87 return child;
88 }
89 }
90
91 return nullptr;
92}
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:110
int ChildCount() const
Definition treenode.cpp:122