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 <aspect/blackboard.h>
27#include <aspect/blocked_timing.h>
28#include <aspect/clock.h>
29#include <aspect/configurable.h>
30#include <aspect/logging.h>
31#include <core/threading/thread.h>
32#ifdef HAVE_TF
33# include <aspect/tf.h>
34#endif
35#include <blackboard/interface_listener.h>
36#include <blackboard/ownership.h>
37#include <core/utils/lock_queue.h>
38#include <lua/context_watcher.h>
39#include <utils/system/fam.h>
40
41#include <cstdlib>
42#include <list>
43#include <string>
44
45namespace fawkes {
46class ComponentLogger;
47class Mutex;
48class LuaContext;
49class Interface;
50class SkillerInterface;
51class SkillerDebugInterface;
52#ifdef SKILLER_TIMETRACKING
53class TimeTracker;
54#endif
55} // namespace fawkes
56class SkillerFeature;
57
64#ifdef HAVE_TF
66#endif
69{
70public:
73
74 virtual void init();
75 virtual void loop();
76 virtual void finalize();
77
79
80 /* BlackBoardInterfaceListener */
82 fawkes::Uuid instance_serial) noexcept;
83
84 // LuaContextWatcher
85 void lua_restarted(fawkes::LuaContext *context);
86
87 /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
88protected:
89 virtual void
91 {
92 Thread::run();
93 }
94
95private: /* members */
98
99 // config values
100 std::string cfg_skillspace_;
101 bool cfg_watch_files_;
102
103 fawkes::LockQueue<fawkes::Uuid> skiller_if_removed_readers_;
104
105 fawkes::SkillerInterface *skiller_if_;
106
107 fawkes::LuaContext *lua_;
108
109 std::list<SkillerFeature *> features_;
110};
111
112#endif
Skiller Execution Thread.
Definition: exec_thread.h:69
virtual void loop()
Code to execute in the thread.
virtual void init()
Initialize the thread.
Definition: exec_thread.cpp:69
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: exec_thread.h:90
void add_skiller_feature(SkillerFeature *feature)
Add a skiller feature.
void lua_restarted(fawkes::LuaContext *context)
Lua restart event.
void bb_interface_reader_removed(fawkes::Interface *interface, fawkes::Uuid instance_serial) noexcept
A reading instance has been closed for a watched interface.
virtual ~SkillerExecutionThread()
Destructor.
Definition: exec_thread.cpp:64
virtual void finalize()
Finalize the thread.
SkillerExecutionThread()
Constructor.
Definition: exec_thread.cpp:56
Skiller feature base class.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
BlackBoard interface listener.
BlackBoard that traces interface ownership.
Definition: ownership.h:31
Thread aspect to use blocked timing.
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:34
Component logger.
Definition: component.h:36
Thread aspect to access configuration data.
Definition: configurable.h:33
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
Thread aspect to log output.
Definition: logging.h:33
Lua context watcher.
Lua C++ wrapper.
Definition: context.h:44
SkillerInterface Fawkes BlackBoard Interface.
Thread class encapsulation of pthreads.
Definition: thread.h:46
Thread aspect to access the transform system.
Definition: tf.h:39
A convenience class for universally unique identifiers (UUIDs).
Definition: uuid.h:29
Fawkes library namespace.