Fawkes API  Fawkes Development Version
clips_thread.h
1 
2 /***************************************************************************
3  * clips_thread.h - CLIPS aspect provider thread
4  *
5  * Created: Sat Jun 16 14:38:21 2012 (Mexico City)
6  * Copyright 2006-2011 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_CLIPS_CLIPS_THREAD_H_
24 #define _PLUGINS_CLIPS_CLIPS_THREAD_H_
25 
26 #include <aspect/aspect_provider.h>
27 #include <aspect/blackboard.h>
28 #include <aspect/clock.h>
29 #include <aspect/configurable.h>
30 #include <aspect/logging.h>
31 #include <core/threading/thread.h>
32 #include <plugins/clips/aspect/clips_feature_inifin.h>
33 #include <plugins/clips/aspect/clips_inifin.h>
34 #include <plugins/clips/aspect/clips_manager_inifin.h>
35 
36 namespace CLIPS {
37 class Environment;
38 }
39 namespace fawkes {
40 class AspectIniFin;
41 class CLIPSFeature;
42 } // namespace fawkes
43 
45 
46 class CLIPSThread : public fawkes::Thread,
47  public fawkes::LoggingAspect,
48  public fawkes::ClockAspect,
52 {
53 public:
54  CLIPSThread();
55  virtual ~CLIPSThread();
56 
57  virtual void init();
58  virtual void loop();
59  virtual void finalize();
60 
61  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
62 protected:
63  virtual void
64  run()
65  {
66  Thread::run();
67  }
68 
69 private:
70  const std::list<fawkes::AspectIniFin *> inifin_list();
71 
72 private:
73  fawkes::CLIPSAspectIniFin clips_aspect_inifin_;
74  fawkes::CLIPSFeatureAspectIniFin clips_feature_aspect_inifin_;
75  fawkes::CLIPSManagerAspectIniFin clips_manager_aspect_inifin_;
77 
78  std::list<fawkes::CLIPSFeature *> features_;
79 };
80 
81 #endif
fawkes::CLIPSAspectIniFin
CLIPSAspect initializer/finalizer.
Definition: clips_inifin.h:39
fawkes::LockPtr< fawkes::CLIPSEnvManager >
BlackboardCLIPSFeature
CLIPS blackboard feature.
Definition: feature_blackboard.h:46
CLIPSThread::init
virtual void init()
Initialize the thread.
Definition: clips_thread.cpp:53
CLIPSThread
CLIPS environment thread.
Definition: clips_thread.h:52
CLIPSThread::~CLIPSThread
virtual ~CLIPSThread()
Destructor.
Definition: clips_thread.cpp:48
fawkes::AspectProviderAspect
Thread aspect provide a new aspect.
Definition: aspect_provider.h:36
CLIPSThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: clips_thread.h:64
fawkes::BlackBoardAspect
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
fawkes
Fawkes library namespace.
fawkes::LoggingAspect
Thread aspect to log output.
Definition: logging.h:33
fawkes::CLIPSFeatureAspectIniFin
CLIPSFeatureAspect initializer/finalizer.
Definition: clips_feature_inifin.h:38
fawkes::CLIPSManagerAspectIniFin
CLIPSManagerAspect initializer/finalizer.
Definition: clips_manager_inifin.h:38
CLIPSThread::CLIPSThread
CLIPSThread()
Constructor.
Definition: clips_thread.cpp:42
fawkes::Thread
Thread class encapsulation of pthreads.
Definition: thread.h:46
fawkes::ConfigurableAspect
Thread aspect to access configuration data.
Definition: configurable.h:33
CLIPSThread::loop
virtual void loop()
Code to execute in the thread.
Definition: clips_thread.cpp:90
CLIPSThread::finalize
virtual void finalize()
Finalize the thread.
Definition: clips_thread.cpp:80
fawkes::ClockAspect
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:34
Environment
Environment representation for JSON transfer.
Definition: Environment.h:28