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
Thread aspect to access to BlackBoard.
Definition: blackboard.h:33
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:33
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: engine_thread.h:72
ObjectPositionInterface Fawkes BlackBoard Interface.
Fawkes library namespace.
unsigned long int current_time()
Get current time.
A class for handling time.
Definition: time.h:92
Thread class encapsulation of pthreads.
Definition: thread.h:45
virtual void finalize()
Finalize the thread.
File input class for Xabsl integration.
Definition: xabsl_tools.h:46
Thread aspect to use blocked timing.
Xabsl Engine Thread.
Definition: engine_thread.h:52
Thread aspect to log output.
Definition: logging.h:32
virtual void once()
Execute an action exactly once.
Thread aspect to access configuration data.
Definition: configurable.h:32
XabslEngineThread()
Constructor.
SkillerInterface Fawkes BlackBoard Interface.
Logging error handler for XABSL integration.
Definition: xabsl_tools.h:34
virtual void init()
Initialize the thread.
virtual void loop()
Code to execute in the thread.
Xabsl Skill Wrapper.
Definition: skill_wrapper.h:33