Fawkes API  Fawkes Development Version
exec_thread.h
1 
2 /***************************************************************************
3  * exec_thread.h - Fawkes Skiller: Execution Thread
4  *
5  * Created: Mon Feb 18 10:28:38 2008
6  * Copyright 2006-2011 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_SKILLER_EXEC_THREAD_H_
24 #define __PLUGINS_SKILLER_EXEC_THREAD_H_
25 
26 #include <core/threading/thread.h>
27 #include <aspect/blocked_timing.h>
28 #include <aspect/logging.h>
29 #include <aspect/configurable.h>
30 #include <aspect/clock.h>
31 #include <aspect/blackboard.h>
32 #ifdef HAVE_TF
33 # include <aspect/tf.h>
34 #endif
35 #include <utils/system/fam.h>
36 #include <blackboard/interface_listener.h>
37 #include <lua/context_watcher.h>
38 #include <blackboard/ownership.h>
39 #include <core/utils/lock_queue.h>
40 
41 #include <list>
42 #include <string>
43 #include <cstdlib>
44 
45 namespace fawkes {
46  class ComponentLogger;
47  class Mutex;
48  class LuaContext;
49  class Interface;
50  class SkillerInterface;
51  class SkillerDebugInterface;
52 #ifdef SKILLER_TIMETRACKING
53  class TimeTracker;
54 #endif
55 }
56 class SkillerFeature;
57 
59 : public fawkes::Thread,
61  public fawkes::LoggingAspect,
64  public fawkes::ClockAspect,
65 #ifdef HAVE_TF
67 #endif
70 {
71  public:
73  virtual ~SkillerExecutionThread();
74 
75  virtual void init();
76  virtual void loop();
77  virtual void finalize();
78 
79  void add_skiller_feature(SkillerFeature *feature);
80 
81  /* BlackBoardInterfaceListener */
82  void bb_interface_reader_removed(fawkes::Interface *interface,
83  unsigned int instance_serial) throw();
84 
85  // LuaContextWatcher
86  void lua_restarted(fawkes::LuaContext *context);
87 
88  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
89  protected: virtual void run() { Thread::run(); }
90 
91  private: /* members */
94 
95  // config values
96  std::string __cfg_skillspace;
97  bool __cfg_watch_files;
98 
99  fawkes::LockQueue<unsigned int> __skiller_if_removed_readers;
100 
101  fawkes::SkillerInterface *__skiller_if;
102 
103  fawkes::LuaContext *__lua;
104 
105  std::list<SkillerFeature *> __features;
106 };
107 
108 #endif
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:36
Lua context watcher.
Fawkes library namespace.
virtual void run()
Code to execute in the thread.
Definition: thread.cpp:939
Thread class encapsulation of pthreads.
Definition: thread.h:42
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
Skiller Execution Thread.
Definition: exec_thread.h:58
Thread aspect to access the transform system.
Definition: tf.h:42
Thread aspect to use blocked timing.
Lua C++ wrapper.
Definition: context.h:47
BlackBoard that traces interface ownership.
Definition: ownership.h:34
Thread aspect to log output.
Definition: logging.h:35
Component logger.
Definition: component.h:35
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: exec_thread.h:89
Thread aspect to access configuration data.
Definition: configurable.h:35
SkillerInterface Fawkes BlackBoard Interface.
Skiller feature base class.
BlackBoard interface listener.