22 #include "cedar_thread.h"
24 #include "plugin_director_thread.h"
26 #include <core/threading/mutex_locker.h>
54 clips->evaluate(std::string(
"(path-add-subst \"@BASEDIR@\" \"") + BASEDIR +
"\")");
55 clips->evaluate(std::string(
"(path-add-subst \"@FAWKES_BASEDIR@\" \"") + FAWKES_BASEDIR +
"\")");
56 clips->evaluate(std::string(
"(path-add-subst \"@RESDIR@\" \"") + RESDIR +
"\")");
57 clips->evaluate(std::string(
"(path-add-subst \"@CONFDIR@\" \"") + CONFDIR +
"\")");
59 clips->evaluate(std::string(
"(path-add \"") + SRCDIR +
"/clips/\")");
60 clips->evaluate(std::string(
"(path-add \"") + CONFDIR +
"/cedar/\")");
62 clips->evaluate(
"(ff-feature-request \"config\")");
64 bool use_fawkes =
false;
71 clips->add_function(
"fawkes-get-plugin-info",
73 sigc::mem_fun(*
this, &CedarThread::clips_get_plugin_info)));
76 clips->batch_evaluate(SRCDIR
"/clips/cedar.clp");
77 clips->assert_fact(
"(cedar-init)");
78 clips->refresh_agenda();
91 clips->assert_fact(
"(time (now))");
92 clips->refresh_agenda();
97 CedarThread::clips_get_plugin_info()
99 std::list<std::string> loaded = pdt_->get_loaded_plugins();
100 std::list<std::pair<std::string, std::string>> available = pdt_->get_available_plugins();
104 for (
auto p : available) {
105 bool is_loaded = (std::find(loaded.begin(), loaded.end(), p.first) != loaded.end());
107 clips->assert_fact_f(
"(fawkes-plugin (name \"%s\") (state %s))",
109 is_loaded ?
"LOADED" :
"AVAILABLE");
Plugin manager access for CEDAR.
virtual void init()
Initialize the thread.
virtual ~CedarThread()
Destructor.
CedarThread(CedarPluginDirectorThread *pdt)
Constructor.
virtual void loop()
Code to execute in the thread.
virtual void finalize()
Finalize the thread.
Thread aspect to use blocked timing.
Thread aspect to get access to a CLIPS environment.
LockPtr< CLIPS::Environment > clips
CLIPS environment for exclusive usage.
Configuration * config
This is the Configuration member used to access the configuration.
virtual bool get_bool(const char *path)=0
Get value from configuration which is of type bool.
Base class for exceptions in Fawkes.
Mutex * objmutex_ptr() const
Get object mutex.
Thread class encapsulation of pthreads.
Fawkes library namespace.