-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathannotation_fact.hpp
76 lines (53 loc) · 2.09 KB
/
annotation_fact.hpp
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
#ifndef ANNOTATION_FACT_HEADER
#define ANNOTATION_FACT_HEADER
#include <iostream>
#include <vector>
#include "annotation.hpp"
#include "deduction.hpp"
class fact_annotatable;
class annotation_fact : public annotation, public fact {
protected:
virtual std::vector<const fact_annotatable*>get_annotatables() const = 0;
virtual void justification_hook() const override;
virtual void unjustification_hook() const override;
public:
annotation_fact(::context&context) : fact{context} {}
virtual operator bool() const override;
virtual void justify() const override;
};
class negative_annotation_fact : public annotation, public fact {
protected:
virtual std::vector<const fact_annotatable*>get_annotatables() const = 0;
virtual void justification_hook() const override;
virtual void unjustification_hook() const override;
public:
negative_annotation_fact(::context&context) : fact{context} {}
virtual operator bool() const override;
void surreptitiously_make_false() const;
};
class combined_annotation_fact : public annotation_fact {
protected:
bool in_the_positive_sense;
virtual void justification_hook() const override;
virtual void unjustification_hook() const override;
public:
combined_annotation_fact(::context&context, bool in_the_positive_sense) : annotation_fact{context}, in_the_positive_sense{in_the_positive_sense} {}
bool is_in_the_positive_sense() const;
virtual bool is_observation() const final { return true; }
};
// The obvious fourth class, negative_combined_annotation_fact, is missing
// simply because, at the moment we don't need it.
class fact_annotatable : public annotatable {
protected:
// Annotation changes are considered semantically const.
mutable annotations_type justified_negative_annotation_facts;
mutable bool predeleted;
public:
fact_annotatable();
virtual void add_annotation(const ::annotation&annotation) const override;
virtual void remove_annotation(const ::annotation&annotation) const override;
bool has_been_predeleted() const;
virtual void predelete();
virtual std::ostream&dump(std::ostream&out) const;
};
#endif