Fawkes API  Fawkes Development Version
clips_navgraph_thread.h
1 
2 /***************************************************************************
3  * clips_navgraph_thread.h - NavGraph feature for CLIPS
4  *
5  * Created: Wed Oct 09 19:26:41 2013
6  * Copyright 2006-2013 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_NAVGRAPH_CLIPS_NAVGRAPH_THREAD_H_
24 #define _PLUGINS_CLIPS_NAVGRAPH_CLIPS_NAVGRAPH_THREAD_H_
25 
26 #include <aspect/configurable.h>
27 #include <aspect/logging.h>
28 #include <core/threading/thread.h>
29 #include <navgraph/aspect/navgraph.h>
30 #include <navgraph/navgraph.h>
31 #include <plugins/clips/aspect/clips_feature.h>
32 
33 #include <map>
34 #include <string>
35 #include <vector>
36 
37 namespace fawkes {
38 class NavGraphStaticListEdgeConstraint;
39 }
40 
41 class ClipsNavGraphThread : public fawkes::Thread,
42  public fawkes::LoggingAspect,
45  public fawkes::CLIPSFeature,
48 {
49 public:
51  virtual ~ClipsNavGraphThread();
52 
53  virtual void init();
54  virtual void loop();
55  virtual void finalize();
56 
57  // for CLIPSFeature
58  virtual void clips_context_init(const std::string & env_name,
60  virtual void clips_context_destroyed(const std::string &env_name);
61 
62  virtual void graph_changed() throw();
63 
64  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
65 protected:
66  virtual void
67  run()
68  {
69  Thread::run();
70  }
71 
72 private:
73  void clips_navgraph_load(fawkes::LockPtr<CLIPS::Environment> &clips);
74  void clips_navgraph_block_edge(std::string env_name, std::string from, std::string to);
75  void clips_navgraph_unblock_edge(std::string env_name, std::string from, std::string to);
76 
77 private:
78  std::map<std::string, fawkes::LockPtr<CLIPS::Environment>> envs_;
79 
81 };
82 
83 #endif
ClipsNavGraphThread
Definition: clips_navgraph_thread.h:40
ClipsNavGraphThread::ClipsNavGraphThread
ClipsNavGraphThread()
Constructor.
Definition: clips_navgraph_thread.cpp:37
fawkes::LockPtr< CLIPS::Environment >
ClipsNavGraphThread::init
virtual void init()
Initialize the thread.
Definition: clips_navgraph_thread.cpp:50
ClipsNavGraphThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: clips_navgraph_thread.h:66
ClipsNavGraphThread::finalize
virtual void finalize()
Finalize the thread.
Definition: clips_navgraph_thread.cpp:59
fawkes::NavGraph::ChangeListener
Definition: navgraph.h:181
ClipsNavGraphThread::loop
virtual void loop()
Code to execute in the thread.
Definition: clips_navgraph_thread.cpp:200
fawkes
fawkes::LoggingAspect
Definition: logging.h:36
fawkes::NavGraphAspect
Definition: navgraph.h:39
fawkes::CLIPSFeature
Definition: clips_feature.h:40
ClipsNavGraphThread::clips_context_destroyed
virtual void clips_context_destroyed(const std::string &env_name)
Definition: clips_navgraph_thread.cpp:93
ClipsNavGraphThread::graph_changed
virtual void graph_changed()
Definition: clips_navgraph_thread.cpp:187
fawkes::Thread
Definition: thread.h:44
fawkes::ConfigurableAspect
Definition: configurable.h:36
ClipsNavGraphThread::~ClipsNavGraphThread
virtual ~ClipsNavGraphThread()
Destructor.
Definition: clips_navgraph_thread.cpp:45
ClipsNavGraphThread::clips_context_init
virtual void clips_context_init(const std::string &env_name, fawkes::LockPtr< CLIPS::Environment > &clips)
Definition: clips_navgraph_thread.cpp:69
fawkes::CLIPSFeatureAspect
Definition: clips_feature.h:56
fawkes::NavGraphStaticListEdgeConstraint
Definition: static_list_edge_constraint.h:39