forked from cp-profiler/cp-profiler-deprecated-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodetree.hh
43 lines (37 loc) · 890 Bytes
/
nodetree.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef NODETREE_HH
#define NODETREE_HH
#include <QMutex>
#include "visualnode.hh"
class NodeTree {
private:
/// Mutex for synchronizing acccess to the tree
QMutex mutex;
/// Mutex for synchronizing layout and drawing
QMutex layoutMutex;
NodeAllocator na;
Statistics stats;
public:
NodeTree()
: mutex(QMutex::Recursive),
layoutMutex(QMutex::Recursive) {
int rootIdx = na.allocateRoot();
assert(rootIdx == 0);
(void)rootIdx;
na[0]->setMarked(true);
}
const NodeAllocator& getNA() const {
return na;
}
NodeAllocator& getNA() {
return na;
}
VisualNode* getRootNode() const {
return na[0];
}
Statistics& getStatistics() {
return stats;
}
QMutex& getMutex() { return mutex; }
QMutex& getLayoutMutex() { return layoutMutex; }
};
#endif