Fawkes API  Fawkes Development Version
engine_thread.h
1 
2 /***************************************************************************
3  * engine_thread.h - Thread driving the XABSL Engine
4  *
5  * Created: Thu Aug 07 14:49:11 2008
6  * Copyright 2006-2008 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_XABSL_ENGINE_THREAD_H_
24 #define _PLUGINS_XABSL_ENGINE_THREAD_H_
25 
26 #include "iface_field_wrapper.h"
27 
28 #include <aspect/blackboard.h>
29 #include <aspect/blocked_timing.h>
30 #include <aspect/clock.h>
31 #include <aspect/configurable.h>
32 #include <aspect/logging.h>
33 #include <core/threading/thread.h>
34 
35 #include <map>
36 #include <string>
37 
38 namespace xabsl {
39 class Engine;
40 }
41 
42 namespace fawkes {
43 class Time;
44 class ObjectPositionInterface;
45 class SkillerInterface;
46 } // namespace fawkes
47 
50 class XabslSkillWrapper;
51 
54  public fawkes::LoggingAspect,
56  public fawkes::ClockAspect,
58 {
59 public:
61 
62  virtual void init();
63  virtual void finalize();
64  virtual void once();
65  virtual void loop();
66 
67  unsigned long int current_time();
68 
69  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
70 protected:
71  virtual void
72  run()
73  {
74  Thread::run();
75  }
76 
77 private:
78  xabsl::Engine * xe_;
80 
81  fawkes::Time *now_;
82 
83  fawkes::SkillerInterface * skiller_if_;
85  fawkes::ObjectPositionInterface *wm_ball_w_if_;
86 
89 
90  std::map<std::string, XabslSkillWrapper *> wrappers_;
91  std::map<std::string, XabslSkillWrapper *>::iterator wit_;
92 };
93 
94 #endif
XabslEngineThread::current_time
unsigned long int current_time()
Get current time.
Definition: engine_thread.cpp:243
XabslEngineThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: engine_thread.h:72
fawkes::BlockedTimingAspect
Definition: blocked_timing.h:56
XabslEngineThread::finalize
virtual void finalize()
Finalize the thread.
Definition: engine_thread.cpp:176
XabslFileInputSource
Definition: xabsl_tools.h:46
XabslInterfaceFieldWrapper< double, float >
fawkes::BlackBoardAspect
Definition: blackboard.h:38
fawkes
fawkes::LoggingAspect
Definition: logging.h:38
XabslLoggingErrorHandler
Definition: xabsl_tools.h:34
XabslEngineThread::once
virtual void once()
Execute an action exactly once.
Definition: engine_thread.cpp:198
fawkes::SkillerInterface
Definition: SkillerInterface.h:39
fawkes::Time
Definition: time.h:98
XabslEngineThread
Definition: engine_thread.h:52
fawkes::Thread
Definition: thread.h:45
XabslEngineThread::XabslEngineThread
XabslEngineThread()
Constructor.
Definition: engine_thread.cpp:61
XabslEngineThread::init
virtual void init()
Initialize the thread.
Definition: engine_thread.cpp:68
XabslEngineThread::loop
virtual void loop()
Code to execute in the thread.
Definition: engine_thread.cpp:211
fawkes::ConfigurableAspect
Definition: configurable.h:38
XabslSkillWrapper
Definition: skill_wrapper.h:33
fawkes::ClockAspect
Definition: clock.h:40
fawkes::ObjectPositionInterface
Definition: ObjectPositionInterface.h:39