Fawkes API  Fawkes Development Version
clips_executive_thread.h
1 
2 /***************************************************************************
3  * clips_executive_thread.h - CLIPS-based executive plugin
4  *
5  * Created: Tue Sep 19 11:59:44 2017
6  * Copyright 2006-2017 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef _PLUGINS_CLIPS_EXECUTIVE_CLIPS_EXECUTIVE_THREAD_H_
24 #define _PLUGINS_CLIPS_EXECUTIVE_CLIPS_EXECUTIVE_THREAD_H_
25 
26 #include <aspect/blocked_timing.h>
27 #include <aspect/clock.h>
28 #include <aspect/configurable.h>
29 #include <aspect/logging.h>
30 #include <core/threading/thread.h>
31 #include <plugins/clips/aspect/clips.h>
32 #include <utils/time/time.h>
33 
34 #include <clipsmm.h>
35 #include <memory>
36 
37 namespace fawkes {
38 class ActionSkillMapping;
39 }
40 
43  public fawkes::LoggingAspect,
45  public fawkes::ClockAspect,
46  public fawkes::CLIPSAspect
47 {
48 public:
50  virtual ~ClipsExecutiveThread();
51 
52  virtual void init();
53  virtual void loop();
54  virtual void finalize();
55 
56  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
57 protected:
58  virtual void
59  run()
60  {
61  Thread::run();
62  }
63 
64 private:
65  std::string
66  clips_map_skill(std::string name, CLIPS::Values param_names, CLIPS::Values param_values);
67 
68 private:
69  bool cfg_assert_time_each_loop_;
70 
71  std::shared_ptr<fawkes::ActionSkillMapping> action_skill_mapping_;
72 };
73 
74 #endif
Main thread of CLIPS-based executive.
virtual void loop()
Code to execute in the thread.
virtual void finalize()
Finalize the thread.
virtual void init()
Initialize the thread.
virtual void run()
Stub to see name in backtrace for easier debugging.
virtual ~ClipsExecutiveThread()
Destructor.
Thread aspect to use blocked timing.
Thread aspect to get access to a CLIPS environment.
Definition: clips.h:41
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:34
Thread aspect to access configuration data.
Definition: configurable.h:33
Thread aspect to log output.
Definition: logging.h:33
Thread class encapsulation of pthreads.
Definition: thread.h:46
const char * name() const
Get name of thread.
Definition: thread.h:100
Fawkes library namespace.