knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
ReasonerEvent.h
Go to the documentation of this file.
1 /*
2  * This file is part of KnowRob, please consult
3  * https://github.com/knowrob/knowrob for license details.
4  */
5 
6 #ifndef KNOWROB_REASONER_EVENT_H
7 #define KNOWROB_REASONER_EVENT_H
8 
9 #include <vector>
10 #include <memory>
11 #include <string>
12 #include "knowrob/semweb/Triple.h"
13 
14 namespace knowrob::reasoner {
18  class Event {
19  public:
23  enum Type {
27  Assertion,
31  Retraction,
40  };
41 
43 
47  Type eventType() const { return eventType_; }
48 
49  protected:
50  const Type eventType_;
51  };
52 
56  class TripleEvent : public Event {
57  public:
63  TripleEvent(Type eventType, uint32_t tripleCount, bool copy = true);
64 
68  auto &triples() const { return triples_; }
69 
73  auto &triple(uint32_t index) { return *triples_[index].ptr; }
74 
75  protected:
76  std::vector<TriplePtr> triples_;
77  };
78 
84  class AssertionEvent : public TripleEvent {
85  public:
90  explicit AssertionEvent(uint32_t numTriples, bool copy = true)
91  : TripleEvent(Assertion, numTriples, copy) {}
92  };
93 
99  class RetractionEvent : public TripleEvent {
100  public:
105  explicit RetractionEvent(uint32_t numTriples, bool copy = true)
106  : TripleEvent(Retraction, numTriples, copy) {}
107  };
108 
117  class ReplacementEvent : public TripleEvent {
118  public:
123  explicit ReplacementEvent(uint32_t numTriples, bool copy = true)
124  : TripleEvent(Replacement, numTriples, copy) {}
125  };
126 
132  class InvalidationEvent : public Event {
133  public:
135  };
136 
137 } // knowrob
138 
139 #endif //KNOWROB_REASONER_EVENT_H
AssertionEvent(uint32_t numTriples, bool copy=true)
Definition: ReasonerEvent.h:90
Event(Type eventType)
Definition: ReasonerEvent.h:42
ReplacementEvent(uint32_t numTriples, bool copy=true)
RetractionEvent(uint32_t numTriples, bool copy=true)
TripleEvent(Type eventType, uint32_t tripleCount, bool copy=true)
auto & triple(uint32_t index)
Definition: ReasonerEvent.h:73
std::vector< TriplePtr > triples_
Definition: ReasonerEvent.h:76