Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * exec_thread.h - Fawkes LuaAgent: Execution Thread 00004 * 00005 * Created: Thu Jan 01 11:12:13 2009 00006 * Copyright 2006-2009 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Library General Public License for more details. 00019 * 00020 * Read the full text in the LICENSE.GPL file in the doc directory. 00021 */ 00022 00023 #ifndef __PLUGINS_LUAAGENT_EXEC_THREAD_H_ 00024 #define __PLUGINS_LUAAGENT_EXEC_THREAD_H_ 00025 00026 #include <core/threading/thread.h> 00027 #include <aspect/blocked_timing.h> 00028 #include <aspect/logging.h> 00029 #include <aspect/configurable.h> 00030 #include <aspect/clock.h> 00031 #include <aspect/blackboard.h> 00032 #include <utils/system/fam.h> 00033 #include <blackboard/interface_listener.h> 00034 00035 #include <string> 00036 #include <cstdlib> 00037 00038 namespace fawkes { 00039 class ComponentLogger; 00040 class Mutex; 00041 class LuaContext; 00042 class LuaInterfaceImporter; 00043 class Interface; 00044 class SkillerInterface; 00045 class SkillerDebugInterface; 00046 } 00047 00048 class LuaAgentExecutionThread 00049 : public fawkes::Thread, 00050 public fawkes::BlockedTimingAspect, 00051 public fawkes::LoggingAspect, 00052 public fawkes::BlackBoardAspect, 00053 public fawkes::ConfigurableAspect, 00054 public fawkes::ClockAspect 00055 { 00056 public: 00057 LuaAgentExecutionThread(); 00058 virtual ~LuaAgentExecutionThread(); 00059 00060 virtual void init(); 00061 virtual void loop(); 00062 virtual void finalize(); 00063 00064 /** Stub to see name in backtrace for easier debugging. @see Thread::run() */ 00065 protected: virtual void run() { Thread::run(); } 00066 00067 private: /* methods */ 00068 void init_failure_cleanup(); 00069 void process_agdbg_messages(); 00070 00071 private: /* members */ 00072 fawkes::ComponentLogger *__clog; 00073 00074 // config values 00075 std::string __cfg_agent; 00076 bool __cfg_watch_files; 00077 00078 fawkes::SkillerInterface *__skiller_if; 00079 fawkes::SkillerDebugInterface *__agdbg_if; 00080 00081 fawkes::LuaContext *__lua; 00082 fawkes::LuaInterfaceImporter *__lua_ifi; 00083 }; 00084 00085 #endif