1 #ifndef CPPROFILER_GLOBAL_HH
2 #define CPPROFILER_GLOBAL_HH
3 
4 #include <ostream>
5 #include "tree/node_id.hh"
6 #include "utils/debug_mutex.hh"
7 #include "utils/std_ext.hh"
8 #include "utils/debug.hh"
9 
10 using cpprofiler::tree::NodeID;
11 using Label = std::string;
12 using ExecID = int;
13 
14 using NogoodID = cpprofiler::tree::NodeID;
15 
16 namespace cpprofiler
17 {
18 namespace tree
19 {
20 
21 enum class NodeStatus
22 {
23     SOLVED = 0,
24     FAILED = 1,
25     BRANCH = 2,
26     SKIPPED = 3,
27     UNDETERMINED = 4,
28     MERGED = 5
29 };
30 
31 std::ostream &operator<<(std::ostream &os, const NodeStatus &ns);
32 
33 } // namespace tree
34 } // namespace cpprofiler
35 
36 namespace cpprofiler
37 {
38 
39 typedef std::string Info;
40 
41 class Nogood
42 {
43     /// whether the nogood has a renamed (nice) version
44     bool renamed_;
45     /// raw flatzinc nogood
46     std::string orig_ng_;
47     /// built using a name map
48     std::string nice_ng_;
49 
50   public:
Nogood(const std::string & orig)51     explicit Nogood(const std::string &orig) : renamed_(false), orig_ng_(orig) {}
52 
Nogood(const std::string & orig,const std::string & renamed)53     Nogood(const std::string &orig, const std::string &renamed) : renamed_(true), orig_ng_(orig), nice_ng_(renamed) {}
54 
renamed() const55     const std::string &renamed() const
56     {
57         return nice_ng_;
58     }
59 
has_renamed() const60     bool has_renamed() const { return renamed_; }
61 
62     /// Get the best name available (renamed if present)
get() const63     const std::string &get() const { return renamed_ ? nice_ng_ : orig_ng_; }
64 
original() const65     const std::string &original() const
66     {
67         return orig_ng_;
68     }
69 
70     static const Nogood empty;
71 };
72 } // namespace cpprofiler
73 
74 #endif