DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
dbe
include
dbe
TreeModelInterface.hpp
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: yes (from dbe/TreeModelInterface.h to include/dbe/TreeModelInterface.hpp).
5
6
#ifndef TREEMODELINTERFACE_H
7
#define TREEMODELINTERFACE_H
8
9
#include "
dbe/treenode.hpp
"
10
#include "
dbe/Exceptions.hpp
"
11
12
#include "
conffwk/Configuration.hpp
"
13
#include "
conffwk/ConfigObject.hpp
"
14
#include "
conffwk/Schema.hpp
"
15
16
#include <QModelIndex>
17
#include <vector>
18
#include <algorithm>
19
20
namespace
dbe
21
{
22
23
class
TreeModelInterface
24
{
25
public
:
26
virtual
treenode
*
getnode
(
const
QModelIndex & index )
const
= 0;
27
28
virtual
~TreeModelInterface
() =
default
;
29
};
30
31
}
// namespace dbe
32
33
#define TREEMODEL_REMOVE_ROWS_DEF(classname) \
34
bool classname::removeRows(int row, int count, QModelIndex const & parent) \
35
{\
36
\
37
assert(count > 0);\
38
\
39
int const last = row + count - 1;\
40
emit beginRemoveRows(parent, row, last);\
41
for (int current = last; current != row - 1; --current)\
42
{\
43
QModelIndex src_index = this->mapToSource(index(current, parent.column(), parent));\
44
treenode * element = this->getnode(src_index);\
45
\
46
if (element != nullptr)\
47
{\
48
treenode * element_parent = element->GetParent();\
49
if (element_parent != nullptr)\
50
{\
51
element_parent->RemoveChild(element);\
52
}\
53
}\
54
else\
55
{\
56
return false;\
57
}\
58
}\
59
emit endRemoveRows();\
60
return true;\
61
}\
62
63
#endif
// TREEMODELINTERFACE_H
ConfigObject.hpp
Exceptions.hpp
dbe::TreeModelInterface
Definition
TreeModelInterface.hpp:24
dbe::TreeModelInterface::~TreeModelInterface
virtual ~TreeModelInterface()=default
dbe::TreeModelInterface::getnode
virtual treenode * getnode(const QModelIndex &index) const =0
dbe::treenode
Definition
treenode.hpp:20
Configuration.hpp
conffwk entry point
Schema.hpp
dbe
Include QT Headers.
Definition
BatchChangeWidget.hpp:18
treenode.hpp
Generated on
for DUNE-DAQ by
1.17.0