Fawkes API  Fawkes Development Version
engine_thread.h
00001 
00002 /***************************************************************************
00003  *  engine_thread.h - Thread driving the XABSL Engine
00004  *
00005  *  Created: Thu Aug 07 14:49:11 2008
00006  *  Copyright  2006-2008  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_XABSL_ENGINE_THREAD_H_
00024 #define __PLUGINS_XABSL_ENGINE_THREAD_H_
00025 
00026 #include "iface_field_wrapper.h"
00027 
00028 #include <core/threading/thread.h>
00029 #include <aspect/blocked_timing.h>
00030 #include <aspect/logging.h>
00031 #include <aspect/configurable.h>
00032 #include <aspect/clock.h>
00033 #include <aspect/blackboard.h>
00034 
00035 #include <map>
00036 #include <string>
00037 
00038 namespace xabsl {
00039   class Engine;
00040 }
00041 
00042 namespace fawkes {
00043   class Time;
00044   class ObjectPositionInterface;
00045   class SkillerInterface;
00046 }
00047 
00048 class XabslLoggingErrorHandler;
00049 class XabslFileInputSource;
00050 class XabslSkillWrapper;
00051 
00052 class XabslEngineThread
00053 : public fawkes::Thread,
00054   public fawkes::BlockedTimingAspect,
00055   public fawkes::LoggingAspect,
00056   public fawkes::ConfigurableAspect,
00057   public fawkes::ClockAspect,
00058   public fawkes::BlackBoardAspect
00059 {
00060  public:
00061   XabslEngineThread();
00062 
00063   virtual void init();
00064   virtual void finalize();
00065   virtual void once();
00066   virtual void loop();
00067 
00068   unsigned long int current_time();
00069 
00070  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
00071  protected: virtual void run() { Thread::run(); }
00072 
00073  private:
00074   xabsl::Engine             *__xe;
00075   XabslLoggingErrorHandler  *__xleh;
00076 
00077   fawkes::Time              *__now;
00078 
00079   fawkes::SkillerInterface        *__skiller_if;
00080   fawkes::ObjectPositionInterface *__wm_ball_if;
00081   fawkes::ObjectPositionInterface *__wm_ball_w_if;
00082 
00083   XabslInterfaceFieldWrapper<double, float> *__ball_rx;
00084   XabslInterfaceFieldWrapper<double, float> *__ball_ry;
00085 
00086   std::map<std::string, XabslSkillWrapper *> __wrappers;
00087   std::map<std::string, XabslSkillWrapper *>::iterator __wit;
00088 };
00089 
00090 
00091 #endif