6 #ifndef KNOWROB_REASONER_MANAGER_H_
7 #define KNOWROB_REASONER_MANAGER_H_
9 #include "knowrob/plugins/PluginManager.h"
10 #include "knowrob/storage/StorageManager.h"
11 #include "knowrob/KnowledgeBase.h"
12 #include "knowrob/reasoner/GoalDrivenReasoner.h"
13 #include "knowrob/reasoner/DataDrivenReasoner.h"
19 class ReasonerManager :
public PluginManager<Reasoner> {
33 auto kb()
const {
return kb_; }
64 std::shared_ptr<NamedReasoner>
loadPlugin(
const boost::property_tree::ptree &config)
override;
67 std::shared_ptr<NamedReasoner>
79 const std::vector<FirstOrderLiteralPtr> &literals,
84 std::shared_ptr<StorageManager> backendManager_;
86 std::map<std::string_view, StoragePtr, std::less<>> reasonerBackends_;
87 std::map<std::string_view, DataDrivenReasonerPtr> dataDriven_;
88 std::map<std::string_view, GoalDrivenReasonerPtr> goalDriven_;
90 void setReasonerStorage(
const std::shared_ptr<
NamedPlugin<Reasoner>> &plugin,
const std::shared_ptr<Storage> &dataBackend);
92 void initPlugin(
const std::shared_ptr<NamedReasoner> &namedReasoner);
94 static bool initializeReasoner(
const std::shared_ptr<NamedReasoner> &namedReasoner,
PropertyTree &config);
101 #define KNOWROB_BUILTIN_REASONER(Name, Type) class Type ## _Registration{ static bool isRegistered; }; \
102 bool Type ## _Registration::isRegistered = knowrob::PluginManager<knowrob::Reasoner>::addFactory<Type>(Name);
std::shared_ptr< NamedReasoner > addPlugin(std::string_view reasonerID, PluginLanguage language, const std::shared_ptr< Reasoner > &reasoner) override
std::shared_ptr< NamedReasoner > loadPlugin(const boost::property_tree::ptree &config) override
auto backendManager() const
~ReasonerManager() override
static TokenBufferPtr evaluateQuery(const GoalDrivenReasonerPtr &reasoner, const std::vector< FirstOrderLiteralPtr > &literals, const QueryContextPtr &ctx)
std::vector< DefiningReasoner > findDefiningReasoner(const PredicateIndicator &indicator) const
auto & dataDriven() const
auto & goalDriven() const
ReasonerManager(KnowledgeBase *kb, const std::shared_ptr< StorageManager > &backendManager)
std::shared_ptr< Storage > getReasonerStorage(const std::shared_ptr< NamedReasoner > &reasoner)
std::shared_ptr< TokenBuffer > TokenBufferPtr
std::shared_ptr< const QueryContext > QueryContextPtr
std::shared_ptr< GoalDrivenReasoner > GoalDrivenReasonerPtr