22 #include "clips-protobuf-thread.h" 24 #include <protobuf_clips/communicator.h> 36 :
Thread(
"ClipsProtobufThread",
Thread::OPMODE_WAITFORWAKEUP),
51 cfg_proto_dirs_.clear();
54 for (
size_t i = 0; i < cfg_proto_dirs_.size(); ++i) {
55 std::string::size_type pos;
56 if ((pos = cfg_proto_dirs_[i].find(
"@BASEDIR@")) != std::string::npos) {
57 cfg_proto_dirs_[i].replace(pos, 9, BASEDIR);
59 if ((pos = cfg_proto_dirs_[i].find(
"@FAWKES_BASEDIR@")) != std::string::npos) {
60 cfg_proto_dirs_[i].replace(pos, 16, FAWKES_BASEDIR);
62 if ((pos = cfg_proto_dirs_[i].find(
"@RESDIR@")) != std::string::npos) {
63 cfg_proto_dirs_[i].replace(pos, 8, RESDIR);
65 if ((pos = cfg_proto_dirs_[i].find(
"@CONFDIR@")) != std::string::npos) {
66 cfg_proto_dirs_[i].replace(pos, 9, CONFDIR);
68 if (cfg_proto_dirs_[i][cfg_proto_dirs_.size()-1] !=
'/') {
69 cfg_proto_dirs_[i] +=
"/";
84 for (
auto pb_comm : pb_comms_) {
85 delete pb_comm.second;
99 clips->batch_evaluate(SRCDIR
"/clips/protobuf.clp");
106 if (pb_comms_.find(env_name) != pb_comms_.end()) {
107 delete pb_comms_[env_name];
108 pb_comms_.erase(env_name);
virtual void loop()
Code to execute in the thread.
Thread aspect to provide a feature to CLIPS environments.
virtual void log_info(const char *component, const char *format,...)=0
Log informational message.
virtual ~ClipsProtobufThread()
Destructor.
Fawkes library namespace.
Thread class encapsulation of pthreads.
ClipsProtobufThread()
Constructor.
Logger * logger
This is the Logger member used to access the logger.
virtual void clips_context_init(const std::string &env_name, fawkes::LockPtr< CLIPS::Environment > &clips)
Initialize a CLIPS context to use the provided feature.
Base class for exceptions in Fawkes.
Mutex * objmutex_ptr() const
Get object mutex.
virtual void init()
Initialize the thread.
CLIPS feature maintainer.
const char * name() const
Get name of thread.
virtual void log_warn(const char *component, const char *format,...)=0
Log warning message.
virtual std::vector< std::string > get_strings(const char *path)=0
Get list of values from configuration which is of type string.
virtual void clips_context_destroyed(const std::string &env_name)
Notification that a CLIPS environment has been destroyed.
Configuration * config
This is the Configuration member used to access the configuration.
virtual void finalize()
Finalize the thread.
CLIPS protobuf integration class.