File: debugMsmStrategy

package info (click to toggle)
frobby 0.9.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,616 kB
  • sloc: cpp: 30,134; sh: 1,184; makefile: 306; ansic: 102; lisp: 10
file content (71 lines) | stat: -rw-r--r-- 2,145 bytes parent folder | download | duplicates (3)
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
class DebugMsmStrategy : public DecoratorMsmStrategy {
 public:
  DebugMsmStrategy(MsmStrategy* strategy):
    DecoratorMsmStrategy(strategy),
    _level(0) {
  }
  
  virtual void doingIndependenceSplit(const MsmSlice& slice,
				      Ideal* mixedProjectionSubtract) {
    fprintf(stderr, "DEBUG %lu: doing independence split.\n",
	    (unsigned long)_level);
    fflush(stderr);
    DecoratorMsmStrategy::doingIndependenceSplit
      (slice, mixedProjectionSubtract);
  }

  virtual void doingIndependentPart(const Projection& projection, bool last) {
    fprintf(stderr, "DEBUG %lu: doing independent part\n",
	    (unsigned long)_level);
    if (last)
      fputs(" (last)", stderr);
    fputs(".\n", stderr);
    fflush(stderr);
    DecoratorMsmStrategy::doingIndependentPart(projection, last);
  }

  virtual bool doneWithIndependentPart() {
    fprintf(stderr, "DEBUG %lu: done with that independent part.\n",
	    (unsigned long)_level);
    fflush(stderr);
    
    return DecoratorMsmStrategy::doneWithIndependentPart();
  }
  
  virtual void doneWithIndependenceSplit() {
    fprintf(stderr, "DEBUG %lu: done with independence split.\n",
	    (unsigned long)_level);
    fflush(stderr);
    DecoratorMsmStrategy::doneWithIndependenceSplit();
  }

  void getPivot(Term& pivot, MsmSlice& slice) {
    DecoratorMsmStrategy::getPivot(pivot, slice);
    fprintf(stderr, "DEBUG %lu: performing pivot split on ",
	    (unsigned long)_level);
    pivot.print(stderr);
    fputs(".\n", stderr);
    fflush(stderr);
  }

  size_t getLabelSplitVariable(const MsmSlice& slice) {
    size_t var = DecoratorMsmStrategy::getLabelSplitVariable(slice);
    fprintf(stderr, "DEBUG %lu: performing label split on var %lu.\n",
	    (unsigned long)_level,
	    (unsigned long)var);
    fflush(stderr);
    return var;
  }

  void consume(const Term& term) {
    fprintf(stderr, "DEBUG %lu: Writing ", (unsigned long)_level);
    term.print(stderr);
    fputs(" to output.\n", stderr);
    fflush(stderr);

    DecoratorMsmStrategy::consume(term);
  }
  
private:
  size_t _level;
};