-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathexecution.hh
140 lines (103 loc) · 3.25 KB
/
execution.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#ifndef EXECUTION_HH
#define EXECUTION_HH
#include <QObject>
#include <QDebug>
#include <sstream>
#include <ctime>
#include <memory>
// #include "nodetree.hh"
#include <unordered_map>
#include <QWaitCondition>
#include "nogood_representation.hh"
class Data;
class NameMap;
class DbEntry;
class NodeAllocator;
class NodeTree;
class Node;
class VisualNode;
class Statistics;
class QMutex;
struct NodeUID;
namespace cpprofiler {
class Message;
}
class TreeBuilder;
class Execution : public QObject {
Q_OBJECT
public:
Execution();
Execution(const Execution&) = delete;
Execution& operator=(const Execution&) = delete;
/// create an execution with an existing NodeTree and Data
Execution(std::unique_ptr<NodeTree> nt, std::unique_ptr<Data> data);
~Execution();
const NogoodViews* getNogood(const Node& node) const;
const std::string* getInfo(const Node& node) const;
NodeUID getParentUID(const NodeUID uid) const;
const std::string* getInfo(NodeUID uid) const;
const int* getObjective(const Node& node) const;
int getExecutionId() const {
return execution_id;
}
void setExecutionId(int eid) {
execution_id = eid;
}
std::string getTitle() const { return _title; }
void setTitle(std::string title) { _title = title; }
std::string getDescription() {
std::stringstream ss;
ss << getTitle();
return ss.str();
}
DbEntry* getEntry(int gid) const;
DbEntry* getEntry(const Node& node) const;
const NodeTree& nodeTree() const { return *m_NodeTree.get(); }
NodeTree& nodeTree() { return *m_NodeTree.get(); }
const Uid2Nogood& getNogoods() const;
const std::string& getNogoodByUID(NodeUID uid, bool renamed, bool simplified) const;
// std::unordered_map<NodeUID, std::shared_ptr<std::string>>& getInfo(void) const;
int32_t getGidByUID(NodeUID uid) const;
std::string getLabel(int gid, bool rename = true) const;
std::string getLabel(const VisualNode& node, bool rename = true) const;
void setLabel(const VisualNode& n, const std::string& str);
unsigned long long getTotalTime();
Data& getData() const;
void begin(std::string label, bool isRestarts);
bool isRestarts() const { return _is_restarts; }
Statistics& getStatistics();
QMutex& getTreeMutex();
QMutex& getLayoutMutex();
void setVariableListString(const std::string& s) {
variableListString = s;
}
std::string getVariableListString() {
return variableListString;
}
void setNameMap(NameMap* names);
const NameMap* getNameMap() const;
bool finished{false};
/// these two go together
bool has_exec_id{false};
QWaitCondition has_exec_id_cond;
public slots:
void handleNewNode(const cpprofiler::Message& node);
/// Compare domains of two nodes (highlighted)
void compareDomains();
signals:
void newNode();
void newRoot();
void titleKnown();
void doneReceiving();
void doneBuilding();
private:
std::unique_ptr<NodeTree> m_NodeTree;
std::unique_ptr<Data> m_Data;
std::unique_ptr<TreeBuilder> m_Builder;
int execution_id;
bool _is_restarts;
// Name of the FlatZinc model
std::string _title = "";
std::string variableListString;
};
#endif