Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * periodic_exec_thread.h - Fawkes LuaAgent: Periodic Execution Thread 00004 * 00005 * Created: Thu Jan 01 11:12:13 2009 00006 * Copyright 2006-2011 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_PERIODIC_EXEC_THREAD_H_ 00024 #define __PLUGINS_LUAAGENT_PERIODIC_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 #ifdef HAVE_TF 00033 # include <aspect/tf.h> 00034 #endif 00035 #include <utils/system/fam.h> 00036 #include <blackboard/interface_listener.h> 00037 00038 #include <string> 00039 #include <cstdlib> 00040 00041 namespace fawkes { 00042 class ComponentLogger; 00043 class Mutex; 00044 class LuaContext; 00045 class LuaInterfaceImporter; 00046 class Interface; 00047 class SkillerInterface; 00048 class SkillerDebugInterface; 00049 } 00050 00051 class LuaAgentPeriodicExecutionThread 00052 : public fawkes::Thread, 00053 public fawkes::BlockedTimingAspect, 00054 public fawkes::LoggingAspect, 00055 public fawkes::BlackBoardAspect, 00056 public fawkes::ConfigurableAspect, 00057 #ifdef HAVE_TF 00058 public fawkes::TransformAspect, 00059 #endif 00060 public fawkes::ClockAspect 00061 { 00062 public: 00063 LuaAgentPeriodicExecutionThread(); 00064 virtual ~LuaAgentPeriodicExecutionThread(); 00065 00066 virtual void init(); 00067 virtual void loop(); 00068 virtual void finalize(); 00069 00070 /** Stub to see name in backtrace for easier debugging. @see Thread::run() */ 00071 protected: virtual void run() { Thread::run(); } 00072 00073 private: /* methods */ 00074 void init_failure_cleanup(); 00075 void process_agdbg_messages(); 00076 00077 private: /* members */ 00078 fawkes::ComponentLogger *__clog; 00079 00080 // config values 00081 std::string __cfg_agent; 00082 bool __cfg_watch_files; 00083 00084 fawkes::SkillerInterface *__skiller_if; 00085 fawkes::SkillerDebugInterface *__agdbg_if; 00086 00087 fawkes::LuaContext *__lua; 00088 fawkes::LuaInterfaceImporter *__lua_ifi; 00089 }; 00090 00091 #endif