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