knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
ObserverManager.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_OBSERVER_MANAGER_H
7 #define KNOWROB_OBSERVER_MANAGER_H
8 
9 #include <memory>
10 #include <knowrob/semweb/GraphQuery.h>
11 #include <knowrob/storage/Transaction.h>
12 #include "Observer.h"
13 
14 namespace knowrob {
18  class ObserverManager : public std::enable_shared_from_this<ObserverManager> {
19  public:
24  explicit ObserverManager(const QueryableBackendPtr &backend);
25 
27 
31  void stop();
32 
40 
44  void synchronize();
45 
50  void stopObservation(const Observer &observer);
51 
56  void insert(const TripleContainerPtr &triples);
57 
62  void remove(const TripleContainerPtr &triples);
63 
69  void query(const GraphQueryPtr &query, const BindingsHandler &callback);
70 
71  protected:
72  struct Impl;
73  std::unique_ptr<Impl> impl_;
75 
76  void run();
77  };
78 
79  using ObserverManagerPtr = std::shared_ptr<ObserverManager>;
80 
81 } // knowrob
82 
83 #endif //KNOWROB_OBSERVER_MANAGER_H
ObserverManager(const QueryableBackendPtr &backend)
void insert(const TripleContainerPtr &triples)
void query(const GraphQueryPtr &query, const BindingsHandler &callback)
std::unique_ptr< Impl > impl_
QueryableBackendPtr backend_
void query(const GraphQueryPtr &query, const BindingsHandler &callback)
void remove(const TripleContainerPtr &triples)
ObserverPtr observe(const GraphQueryPtr &query, const BindingsHandler &callback)
void stopObservation(const Observer &observer)
std::shared_ptr< TripleContainer > TripleContainerPtr
std::shared_ptr< Observer > ObserverPtr
Definition: Observer.h:42
std::shared_ptr< ObserverManager > ObserverManagerPtr
std::function< void(const BindingsPtr &)> BindingsHandler
Definition: Bindings.h:152
std::shared_ptr< GraphQuery > GraphQueryPtr
Definition: GraphQuery.h:65
std::shared_ptr< QueryableStorage > QueryableBackendPtr