6 #ifndef KNOWROB_PROLOG_THREAD_POOL_H_
7 #define KNOWROB_PROLOG_THREAD_POOL_H_
10 #include "knowrob/ThreadPool.h"
22 class PrologEngine :
public ThreadPool {
26 using Solution = std::map<Variable, TermPtr, std::less<>>;
84 static bool consult(
const std::filesystem::path &uri,
const char *module = {});
106 static std::filesystem::path
getPrologPath(
const std::filesystem::path &filename);
119 static std::optional<PrologEngine>
self_;
128 #define PROLOG_ENGINE_EVAL(term) PrologEngine::eval([&]() { return term; })
129 #define PROLOG_ENGINE_ONE_SOL(term) PrologEngine::oneSolution([&]() { return term; })
130 #define PROLOG_ENGINE_ALL_SOL(term) PrologEngine::allSolutions([&]() { return term; })
131 #define PROLOG_ENGINE_QUERY(term, callback) PrologEngine::query([&]() { return term; }, callback)
static bool eval(const GoalFactory &goalFactory)
static std::filesystem::path getPrologPath(const std::filesystem::path &filename)
static std::vector< std::string > arguments_
std::map< Variable, TermPtr, std::less<> > Solution
static void pushGoalAndJoin(const std::shared_ptr< ThreadPool::Runner > &goal)
PrologEngine(uint32_t maxNumThreads=0)
static std::filesystem::path getResourcePath(const std::filesystem::path &filename)
static void pushGoal(const std::shared_ptr< ThreadPool::Runner > &goal, const ErrorHandler &errHandler)
bool initializeWorker() override
static bool isPrologInitialized()
static void expandSearchPaths()
static std::optional< Solution > oneSolution(const GoalFactory &goalFactory)
static void query(const GoalFactory &goalFactory, const BindingsHandler &callback)
static bool consult(const std::filesystem::path &uri, const char *module={})
static std::optional< PrologEngine > self_
static bool isPrologInitialized_
std::function< PrologTerm()> GoalFactory
ThreadPool::ExceptionHandler ErrorHandler
static void finalizeProlog()
static std::vector< Solution > allSolutions(const GoalFactory &goalFactory)
static void initializeProlog()
std::function< void(const std::exception &)> ExceptionHandler
FunctionRule & function()
std::function< void(const BindingsPtr &)> BindingsHandler